*** empty log message ***
This commit is contained in:
parent
773da00dd4
commit
98c7ea7507
|
|
@ -16,16 +16,22 @@ class Button(DirectObject):
|
|||
pos = (0, 0),
|
||||
geomRect = None,
|
||||
supportInactive = 0,
|
||||
inactive = 0,
|
||||
upStyle = Label.ButtonUp,
|
||||
litStyle = Label.ButtonLit,
|
||||
downStyle = Label.ButtonDown,
|
||||
inactiveStyle = Label.ButtonInactive):
|
||||
self.name = name
|
||||
self.width = width
|
||||
|
||||
# if no label given, use the button name
|
||||
if (label == None):
|
||||
label = self.name
|
||||
|
||||
self.inactive = inactive
|
||||
if inactive:
|
||||
supportInactive = 1
|
||||
|
||||
# check to see if this is an actual guiLabel or just text
|
||||
if (type(label) == type('')):
|
||||
# text label, make text button
|
||||
|
|
@ -125,6 +131,15 @@ class Button(DirectObject):
|
|||
self.lDown.setWidth(width)
|
||||
self.lInactive.setWidth(width)
|
||||
|
||||
def setInactive(self, inactive):
|
||||
self.inactive = inactive
|
||||
if self.managed:
|
||||
self.button.exit()
|
||||
if self.inactive:
|
||||
self.button.inactive()
|
||||
else:
|
||||
self.button.up()
|
||||
|
||||
def manage(self, nodepath = aspect2d):
|
||||
if nodepath:
|
||||
self.button.manage(guiMgr, base.eventMgr.eventHandler,
|
||||
|
|
@ -133,6 +148,10 @@ class Button(DirectObject):
|
|||
self.button.manage(guiMgr, base.eventMgr.eventHandler)
|
||||
self.managed = 1
|
||||
|
||||
if self.inactive:
|
||||
self.button.exit()
|
||||
self.button.inactive()
|
||||
|
||||
def unmanage(self):
|
||||
self.button.unmanage()
|
||||
self.managed = 0
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ def textLabelAndText(string, style,
|
|||
elif style == ButtonInactive:
|
||||
# When the button is inactive, it's gray on gray.
|
||||
text.setTextColor(0.4, 0.4, 0.4, 1.0)
|
||||
text.setCardColor(0.6, 0.6, 0.6, 1.0)
|
||||
text.setCardColor(0.9, 0.9, 0.9, 1.0)
|
||||
|
||||
elif style == Sign:
|
||||
# For a sign, we want red text with no background card.
|
||||
|
|
|
|||
|
|
@ -240,7 +240,9 @@ class OnscreenPanel(PandaObject.PandaObject, NodePath):
|
|||
drawOrder = None,
|
||||
font = None,
|
||||
pos = (0, 0),
|
||||
geomRect = None):
|
||||
geomRect = None,
|
||||
supportInactive = 0,
|
||||
inactive = 0):
|
||||
"""makeButton(self, ...)
|
||||
|
||||
Creates a button on the panel. The return value is the button
|
||||
|
|
@ -274,7 +276,9 @@ class OnscreenPanel(PandaObject.PandaObject, NodePath):
|
|||
drawOrder = drawOrder,
|
||||
font = font,
|
||||
pos = pos,
|
||||
geomRect = geomRect)
|
||||
geomRect = geomRect,
|
||||
supportInactive = supportInactive,
|
||||
inactive = inactive)
|
||||
|
||||
self.panelButtons.append(button)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue