BsGUIMenuBar.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #pragma once
  2. #include "BsEditorPrerequisites.h"
  3. namespace BansheeEngine
  4. {
  5. class GUIMenuBar
  6. {
  7. struct GUIMenuBarData
  8. {
  9. WString name;
  10. GUIMenu* menu;
  11. GUIButton* button;
  12. };
  13. public:
  14. GUIMenuBar(GUIWidget* parent, RenderWindow* parentWindow);
  15. virtual ~GUIMenuBar();
  16. void setArea(INT32 x, INT32 y, UINT32 width, UINT32 height);
  17. const GUIMenuItem* addMenuItem(const WString& path, std::function<void()> callback);
  18. const GUIMenuItem* addSeparator(const WString& path);
  19. const GUIMenuItem* getMenuItem(const WString& path) const;
  20. void removeMenuItem(const WString& path);
  21. private:
  22. static const UINT32 NUM_ELEMENTS_AFTER_CONTENT;
  23. RenderWindow* mParentWindow;
  24. GUIWidget* mParentWidget;
  25. GUIArea* mMainArea;
  26. GUIArea* mBackgroundArea;
  27. GUITexture* mBgTexture;
  28. GUITexture* mLogoTexture;
  29. GUIButton* mMinBtn;
  30. GUIButton* mMaxBtn;
  31. GUIButton* mCloseBtn;
  32. Vector<GUIMenuBarData> mChildMenus;
  33. GUIButton* mSubMenuButton;
  34. bool mSubMenuOpen;
  35. const GUIMenuBarData* getSubMenu(const WString& name) const;
  36. GUIMenuBarData* addNewButton(const WString& name);
  37. /**
  38. * @brief Attempts to remove the first element from the specified path. First element
  39. * returned in specified in "pathRoot", and original "path" parameter is modified so
  40. * it no longer includes the first element.
  41. *
  42. * @return False if first element doesn't exist, true otherwise.
  43. */
  44. bool stripPath(WString& path, WString& pathRoot) const;
  45. void openSubMenu(const WString& name);
  46. void closeSubMenu();
  47. void onSubMenuHover(const WString& name);
  48. void onSubMenuClosed();
  49. void onMinimizeClicked();
  50. void onMaximizeClicked();
  51. void onCloseClicked();
  52. void refreshNonClientAreas();
  53. };
  54. }