DirectGuiGlobals.py 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. """
  2. Global definitions used by Direct Gui Classes and handy constants
  3. that can be used during widget construction
  4. """
  5. from PandaModules import *
  6. #from PGTop import *
  7. #from PGButton import *
  8. # Import these after PGButton to get actual class definitions
  9. #from PGItem import *
  10. #from PGFrameStyle import *
  11. # Helper classes used as components of Direct Gui Widgets
  12. import OnscreenText
  13. import OnscreenGeom
  14. import OnscreenImage
  15. import types
  16. # USEFUL GUI CONSTANTS
  17. # Constant used to indicate that an option can only be set by a call
  18. # to the constructor.
  19. INITOPT = ['initopt']
  20. # Mouse buttons
  21. LMB = 0
  22. MMB = 1
  23. RMB = 2
  24. # Widget state
  25. NORMAL = 'normal'
  26. DISABLED = 'disabled'
  27. # Frame style
  28. FLAT = PGFrameStyle.TFlat
  29. RAISED = PGFrameStyle.TBevelOut
  30. SUNKEN = PGFrameStyle.TBevelIn
  31. GROOVE = PGFrameStyle.TGroove
  32. RIDGE = PGFrameStyle.TRidge
  33. FrameStyleDict = {'flat' : FLAT, 'raised' : RAISED, 'sunken': SUNKEN,
  34. 'groove' : GROOVE, 'ridge' : RIDGE
  35. }
  36. # User can bind commands to these gui events
  37. DESTROY = 'destroy-'
  38. PRINT = 'print-'
  39. ENTER = PGButton.getEnterPrefix()
  40. EXIT = PGButton.getExitPrefix()
  41. B1CLICK = PGButton.getClickPrefix() + MouseButton.one().getName() + '-'
  42. B2CLICK = PGButton.getClickPrefix() + MouseButton.two().getName() + '-'
  43. B3CLICK = PGButton.getClickPrefix() + MouseButton.three().getName() + '-'
  44. B1PRESS = PGButton.getPressPrefix() + MouseButton.one().getName() + '-'
  45. B2PRESS = PGButton.getPressPrefix() + MouseButton.two().getName() + '-'
  46. B3PRESS = PGButton.getPressPrefix() + MouseButton.three().getName() + '-'
  47. B1RELEASE = PGButton.getReleasePrefix() + MouseButton.one().getName() + '-'
  48. B2RELEASE = PGButton.getReleasePrefix() + MouseButton.two().getName() + '-'
  49. B3RELEASE = PGButton.getReleasePrefix() + MouseButton.three().getName() + '-'
  50. # For setting the sorting order of a widget's visible components
  51. IMAGE_SORT_INDEX = 10
  52. GEOM_SORT_INDEX = 20
  53. TEXT_SORT_INDEX = 30