guiManager.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. // Filename: guiManager.h
  2. // Created by: cary (25Oct00)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
  8. //
  9. // All use of this software is subject to the terms of the Panda 3d
  10. // Software license. You should have received a copy of this license
  11. // along with this source code; you will also find a current copy of
  12. // the license at http://www.panda3d.org/license.txt .
  13. //
  14. // To contact the maintainers of this program write to
  15. // [email protected] .
  16. //
  17. ////////////////////////////////////////////////////////////////////
  18. #ifndef __GUIMANAGER_H__
  19. #define __GUIMANAGER_H__
  20. #include <pandabase.h>
  21. #include <graphicsWindow.h>
  22. #include <mouse.h>
  23. #include <mouseWatcher.h>
  24. #include <mouseWatcherRegion.h>
  25. #include <node.h>
  26. #include "pset.h"
  27. #include "guiLabel.h"
  28. #include "config_gui.h"
  29. class EXPCL_PANDA GuiManager {
  30. private:
  31. typedef pmap<GraphicsWindow*, GuiManager*> GuiMap;
  32. static GuiMap* _map;
  33. typedef pset<MouseWatcherRegion*> RegionSet;
  34. RegionSet _regions;
  35. typedef pset<GuiLabel*> LabelSet;
  36. LabelSet _labels;
  37. class SortComp {
  38. public:
  39. inline bool operator()(GuiLabel* a, GuiLabel* b) const {
  40. return (*a) < (*b);
  41. }
  42. };
  43. typedef pset<GuiLabel*, SortComp> SortSet;
  44. SortSet _sorts;
  45. int _start_draw_order;
  46. int _next_draw_order;
  47. Node* _root;
  48. MouseWatcher* _watcher;
  49. EventHandler* _eh;
  50. INLINE GuiManager(MouseWatcher*, Node*, EventHandler*);
  51. PUBLISHED:
  52. static GuiManager* get_ptr(GraphicsWindow*, MouseAndKeyboard*, Node *root2d);
  53. void add_region(MouseWatcherRegion*);
  54. void add_label(GuiLabel*);
  55. void add_label(GuiLabel*, Node*);
  56. void remove_region(MouseWatcherRegion*);
  57. void remove_label(GuiLabel*);
  58. bool has_region(MouseWatcherRegion*);
  59. bool has_label(GuiLabel*);
  60. void recompute_priorities(void);
  61. INLINE int get_next_draw_order(void) const;
  62. INLINE void set_next_draw_order(int);
  63. INLINE int get_start_draw_order(void) const;
  64. INLINE void set_start_draw_order(int);
  65. bool is_sane(void) const;
  66. void sanity_check(void) const;
  67. INLINE EventHandler* get_private_handler(void) const;
  68. };
  69. #include "guiManager.I"
  70. #endif /* __GUIMANAGER_H__ */