make label and frame unclickable by default

This commit is contained in:
David Rose 2001-09-05 00:43:20 +00:00
parent f63a1f74c2
commit f4866cc88d
5 changed files with 17 additions and 2 deletions

View File

@ -27,6 +27,7 @@ class DirectButton(DirectFrame):
# Define type of DirectGuiWidget
('pgFunc', PGButton, None),
('numStates', 4, None),
('state', NORMAL, None),
('invertedFrames', (1,), None),
# Command to be called on button click
('command', None, None),

View File

@ -25,6 +25,7 @@ class DirectEntry(DirectFrame):
# Define type of DirectGuiWidget
('pgFunc', PGEntry, None),
('numStates', 3, None),
('state', NORMAL, None),
('width', 10, self.setup),
('numLines', 5, self.setup),
('focus', 0, self.setFocus),

View File

@ -15,6 +15,7 @@ class DirectFrame(DirectGuiWidget):
# Define type of DirectGuiWidget
('pgFunc', PGItem, None),
('numStates', 1, None),
('state', self.inactiveInitState, None),
# Frame can have:
# A background texture
('image', None, self.setImage),

View File

@ -643,7 +643,17 @@ class DirectGuiWidget(DirectGuiBase, NodePath):
# Toggle if you wish widget's to snap to grid when draggin
snapToGrid = 0
gridSpacing = 0.05
# Determine the default initial state for inactive (or
# unclickable) components. If we are in edit mode, these are
# actually clickable by default.
guiEdit = base.config.GetBool('direct-gui-edit', 0)
if guiEdit:
inactiveInitState = NORMAL
else:
inactiveInitState = DISABLED
def __init__(self, parent = guiTop, **kw):
# Direct gui widgets are node paths
# Direct gui widgets have:
@ -730,7 +740,7 @@ class DirectGuiWidget(DirectGuiBase, NodePath):
self.ur = Point3(0)
# Is drag and drop enabled?
if base.config.GetBool('direct-gui-edit', 0):
if self.guiEdit:
self.enableEdit()
# Bind destroy hook

View File

@ -16,10 +16,12 @@ class DirectLabel(DirectFrame):
# The same image/geom/text can be used for all states or each
# state can have a different text/geom/image
# State transitions happen under user control
optiondefs = (
# Define type of DirectGuiWidget
('pgFunc', PGItem, None),
('numStates', 1, None),
('state', self.inactiveInitState, None),
('activeState', 0, self.setActiveState),
)
# Merge keyword options with default options