BsGUIContextMenu.h 864 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #pragma once
  2. #include "BsPrerequisites.h"
  3. #include "BsGUIMenu.h"
  4. namespace BansheeEngine
  5. {
  6. /**
  7. * @brief Manages display and logic for a context menu.
  8. * Context menus can be opened anywhere within the GUI
  9. * and can contain a hierarchy of menu items.
  10. */
  11. class BS_EXPORT GUIContextMenu : public GUIMenu
  12. {
  13. public:
  14. GUIContextMenu();
  15. ~GUIContextMenu();
  16. /**
  17. * @brief Opens a context menu at the specified position relative
  18. * to the provided widget.
  19. */
  20. void open(const Vector2I& position, GUIWidget& widget);
  21. private:
  22. /**
  23. * @brief Closes the context menu if open.
  24. */
  25. void close();
  26. /**
  27. * @brief Called when the context menu is closed externally
  28. * (e.g. when user selects an item or clicks outside it).
  29. */
  30. void onMenuClosed();
  31. private:
  32. bool mContextMenuOpen;
  33. };
  34. }