BsGUIContextMenu.h 1.1 KB

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