BsGUIMenuBar.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #pragma once
  2. #include "BsEditorPrerequisites.h"
  3. namespace BansheeEditor
  4. {
  5. class GUIMenuBar
  6. {
  7. struct GUIMenuBarData
  8. {
  9. CM::WString name;
  10. BS::GUIMenu* menu;
  11. BS::GUIButton* button;
  12. };
  13. public:
  14. GUIMenuBar(BS::GUIWidget* parent, CM::RenderWindow* parentWindow);
  15. virtual ~GUIMenuBar();
  16. void setArea(CM::INT32 x, CM::INT32 y, CM::UINT32 width, CM::UINT32 height);
  17. const BS::GUIMenuItem* addMenuItem(const CM::WString& path, std::function<void()> callback);
  18. const BS::GUIMenuItem* addSeparator(const CM::WString& path);
  19. const BS::GUIMenuItem* getMenuItem(const CM::WString& path) const;
  20. void removeMenuItem(const CM::WString& path);
  21. private:
  22. static const CM::UINT32 NUM_ELEMENTS_AFTER_CONTENT;
  23. CM::RenderWindow* mParentWindow;
  24. BS::GUIWidget* mParentWidget;
  25. BS::GUIArea* mMainArea;
  26. BS::GUIArea* mBackgroundArea;
  27. BS::GUITexture* mBgTexture;
  28. BS::GUITexture* mLogoTexture;
  29. BS::GUIButton* mMinBtn;
  30. BS::GUIButton* mMaxBtn;
  31. BS::GUIButton* mCloseBtn;
  32. CM::Vector<GUIMenuBarData>::type mChildMenus;
  33. BS::GUIButton* mSubMenuButton;
  34. bool mSubMenuOpen;
  35. const GUIMenuBarData* getSubMenu(const CM::WString& name) const;
  36. GUIMenuBarData* addNewButton(const CM::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(CM::WString& path, CM::WString& pathRoot) const;
  45. void openSubMenu(const CM::WString& name);
  46. void closeSubMenu();
  47. void onSubMenuHover(const CM::WString& name);
  48. void onSubMenuClosed();
  49. void onMinimizeClicked();
  50. void onMaximizeClicked();
  51. void onCloseClicked();
  52. void refreshNonClientAreas();
  53. };
  54. }