Panda3D
Loading...
Searching...
No Matches
DirectOptionMenu Class Reference
Inheritance diagram for DirectOptionMenu:
DirectButton DirectFrame DirectGuiWidget DirectGuiBase DirectObject

Public Member Functions

 __init__ (self, parent=None, **kw)
 
 commandFunc (self, event)
 
 get (self)
 
 hidePopupMenu (self, event=None)
 
 index (self, index)
 
 selectHighlightedIndex (self, event=None)
 
 set (self, index, fCommand=1)
 
 setItems (self)
 
 showPopupMenu (self, event=None)
 
- Public Member Functions inherited from DirectButton
 __init__ (self, parent=None, **kw)
 
 setClickSound (self)
 
 setCommandButtons (self)
 
 setRolloverSound (self)
 
- Public Member Functions inherited from DirectFrame
 __init__ (self, parent=None, **kw)
 
 clearGeom (self)
 
 clearImage (self)
 
 clearText (self)
 
 destroy (self)
 
 setGeom (self, geom=None)
 
 setImage (self, image=None)
 
 setText (self, text=None)
 
- Public Member Functions inherited from DirectGuiWidget
 __init__ (self, parent=None, **kw)
 
 copyOptions (self, other)
 
 disableEdit (self)
 
 editStart (self, event)
 
 editStop (self, event)
 
 enableEdit (self)
 
 frameInitialiseFunc (self)
 
 getBounds (self, state=0)
 
 getCenter (self)
 
 getFrameType (self, state=0)
 
 getHeight (self)
 
 getWidth (self)
 
 guiDragTask (self, state)
 
 guiScaleTask (self, state)
 
 printConfig (self, indent=0)
 
 resetFrameSize (self)
 
 setBorderUvWidth (self)
 
 setBorderWidth (self)
 
 setFrameColor (self)
 
 setFrameSize (self, fClearFrame=0)
 
 setFrameTexture (self)
 
 setFrameVisibleScale (self)
 
 setProp (self, propString, value)
 
 setRelief (self, fSetStyle=1)
 
 setState (self)
 
 taskName (self, idString)
 
 uniqueName (self, idString)
 
 updateFrameStyle (self)
 
- Public Member Functions inherited from DirectGuiBase
 __init__ (self)
 
 __setitem__ (self, key, value)
 
 addoptions (self, optionDefs, optionkeywords)
 
 bind (self, event, command, extraArgs=[])
 
 cget (self, option)
 
 component (self, name)
 
 components (self)
 
 configure (self, option=None, **kw)
 
 createcomponent (self, componentName, componentAliases, componentGroup, widgetClass, *widgetArgs, **kw)
 
 defineoptions (self, keywords, optionDefs, dynamicGroups=())
 
 destroycomponent (self, name)
 
 hascomponent (self, component)
 
 initialiseoptions (self, myClass)
 
 isinitoption (self, option)
 
 options (self)
 
 postInitialiseFunc (self)
 
 unbind (self, event)
 
- Public Member Functions inherited from DirectObject
 __init__ (self)
 
 accept (self, event, method, extraArgs=[])
 
 acceptOnce (self, event, method, extraArgs=[])
 
 addTask (self, *args, **kwargs)
 
 detectLeaks (self)
 
 doMethodLater (self, *args, **kwargs)
 
 getAllAccepting (self)
 
 ignore (self, event)
 
 ignoreAll (self)
 
 isAccepting (self, event)
 
 isIgnoring (self, event)
 
 removeAllTasks (self)
 
 removeTask (self, taskOrName)
 

Public Attributes

 cancelFrame
 
 hidePopupMenu
 
 highlightedIndex = None
 
 initFrameSize = self['frameSize']
 
 initPopupMarkerPos = self['popupMarker_pos']
 
 maxHeight = self.maxZ - self.minZ
 
 maxWidth = self.maxX - self.minX
 
 maxX = None:
 
 maxZ = None:
 
 minX = None
 
 minZ = None:
 
 popupMarker
 
 popupMenu = None
 
 selectedIndex = None
 
 selectHighlightedIndex
 
 showPopupMenu
 
- Public Attributes inherited from DirectGuiWidget
list bounds = self['frameSize']
 
 editStart
 
 editStop
 
 ll
 
 printConfig
 
 stateNodePath = self.guiDict.get(parts[-1])
 
 ur
 
- Public Attributes inherited from DirectGuiBase
int fInit = 1
 
str guiId = 'guiObject'
 
list postInitialiseFuncList = []
 

Protected Member Functions

 _highlightItem (self, item, index)
 
 _unhighlightItem (self, item, frameColor)
 
- Protected Member Functions inherited from DirectObject
 _addTask (self, task)
 
 _clearTask (self, task)
 

Protected Attributes

tuple _prevItemTextScale = kw['item_text_scale']
 
- Protected Attributes inherited from DirectGuiBase
dict _constructorKeywords = tmp
 
tuple _dynamicGroups = ()
 
dict _optionInfo = {}
 
- Protected Attributes inherited from DirectObject
dict _taskList = {}
 

Additional Inherited Members

- Static Public Attributes inherited from DirectFrame
tuple DefDynGroups = ('text', 'geom', 'image')
 
- Static Public Attributes inherited from DirectGuiWidget
float gridSpacing = 0.05
 
dict guiDict = {}
 
 guiEdit = ShowBaseGlobal.config.GetBool('direct-gui-edit', False)
 
 inactiveInitState = DGG.NORMAL
 
int snapToGrid = 0
 
- Static Public Attributes inherited from DirectObject
 accept_once = acceptOnce
 
 add_task = addTask
 
 detect_leaks = detectLeaks
 
 do_method_later = doMethodLater
 
 get_all_accepting = getAllAccepting
 
 ignore_all = ignoreAll
 
 is_accepting = isAccepting
 
 is_ignoring = isIgnoring
 
 remove_all_tasks = removeAllTasks
 
 remove_task = removeTask
 

Detailed Description

DirectOptionMenu(parent) - Create a DirectButton which pops up a
menu which can be used to select from a list of items.
Execute button command (passing the selected item through) if defined
To cancel the popup menu click anywhere on the screen outside of the
popup menu.  No command is executed in this case.

Constructor & Destructor Documentation

◆ __init__()

__init__ ( self,
parent = None,
** kw )

Member Function Documentation

◆ _highlightItem()

_highlightItem ( self,
item,
index )
protected
 Set frame color of highlighted item, record index 

◆ _unhighlightItem()

_unhighlightItem ( self,
item,
frameColor )
protected
 Clear frame color, clear highlightedIndex 

◆ commandFunc()

commandFunc ( self,
event )
Override popup menu button's command func
Command is executed in response to selecting menu items

Reimplemented from DirectButton.

◆ get()

get ( self)
 Get currently selected item 

◆ hidePopupMenu()

hidePopupMenu ( self,
event = None )
 Put away popup and cancel frame 

◆ index()

index ( self,
index )

◆ selectHighlightedIndex()

selectHighlightedIndex ( self,
event = None )
Check to see if item is highlighted (by cursor being within
that item).  If so, selected it.  If not, do nothing

◆ set()

set ( self,
index,
fCommand = 1 )

◆ setItems()

setItems ( self)
self['items'] = itemList
Create new popup menu to reflect specified set of items

◆ showPopupMenu()

showPopupMenu ( self,
event = None )
Make popup visible and try to position it just to right of
mouse click with currently selected item aligned with button.
Adjust popup position if default position puts it outside of
visible screen region

Member Data Documentation

◆ _prevItemTextScale

tuple _prevItemTextScale = kw['item_text_scale']
protected

◆ cancelFrame

cancelFrame
Initial value:
= self.createcomponent(
'cancelframe', (), None,
DirectFrame, (self,),
frameSize = (-1, 1, -1, 1),
relief = None,
state = 'normal')

◆ hidePopupMenu

hidePopupMenu

◆ highlightedIndex

highlightedIndex = None

◆ initFrameSize

initFrameSize = self['frameSize']

◆ initPopupMarkerPos

initPopupMarkerPos = self['popupMarker_pos']

◆ maxHeight

maxHeight = self.maxZ - self.minZ

◆ maxWidth

maxWidth = self.maxX - self.minX

◆ maxX

maxX = None:

◆ maxZ

maxZ = None:

◆ minX

minX = None

◆ minZ

minZ = None:

◆ popupMarker

popupMarker
Initial value:
= self.createcomponent(
'popupMarker', (), None,
DirectFrame, (self,),
frameSize = (-0.5, 0.5, -0.2, 0.2),
scale = 0.4,
relief = DGG.RAISED)

◆ popupMenu

popupMenu = None

◆ selectedIndex

selectedIndex = None

◆ selectHighlightedIndex

selectHighlightedIndex

◆ showPopupMenu

showPopupMenu