|
|
@@ -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
|