1//************************************ bs::framework - Copyright 2018 Marko Pintera **************************************//
2//*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********//
3#pragma once
4
5#include "BsPrerequisites.h"
6#include "GUI/BsGUIMenu.h"
7
8namespace bs
9{
10 /** @addtogroup GUI
11 * @{
12 */
13
14 /**
15 * Manages display and logic for a context menu. Context menus can be opened anywhere within the GUI and can contain a
16 * hierarchy of menu items.
17 */
18 class BS_EXPORT GUIContextMenu : public GUIMenu
19 {
20 public:
21 GUIContextMenu() = default;
22 ~GUIContextMenu();
23
24 /** Opens a context menu at the specified position relative to the provided widget. */
25 void open(const Vector2I& position, GUIWidget& widget);
26
27 private:
28 /** Closes the context menu if open. */
29 void close();
30
31 /**
32 * Called when the context menu is closed externally (for example when user selects an item or clicks outside it).
33 */
34 void onMenuClosed();
35
36 private:
37 bool mContextMenuOpen = false;
38 };
39
40 /** @} */
41}