From 98c7ea750726b729c73eaada807d267e65cb33fd Mon Sep 17 00:00:00 2001 From: David Rose Date: Mon, 9 Apr 2001 22:25:13 +0000 Subject: [PATCH] *** empty log message *** --- direct/src/gui/Button.py | 19 +++++++++++++++++++ direct/src/gui/Label.py | 2 +- direct/src/gui/OnscreenPanel.py | 8 ++++++-- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/direct/src/gui/Button.py b/direct/src/gui/Button.py index 211a08b48e..13dd590dcd 100644 --- a/direct/src/gui/Button.py +++ b/direct/src/gui/Button.py @@ -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 diff --git a/direct/src/gui/Label.py b/direct/src/gui/Label.py index ecef31881b..0ca9131985 100644 --- a/direct/src/gui/Label.py +++ b/direct/src/gui/Label.py @@ -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. diff --git a/direct/src/gui/OnscreenPanel.py b/direct/src/gui/OnscreenPanel.py index 490a60db70..71cd3e4453 100644 --- a/direct/src/gui/OnscreenPanel.py +++ b/direct/src/gui/OnscreenPanel.py @@ -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)