neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
context_menu.hpp
Go to the documentation of this file.
1// context_menu.hpp
2/*
3neogfx C++ App/Game Engine
4Copyright (c) 2015, 2020 Leigh Johnston. All Rights Reserved.
5
6This program is free software: you can redistribute it and / or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation, either version 3 of the License, or
9(at your option) any later version.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#pragma once
21
22#include <neogfx/neogfx.hpp>
23#include "popup_menu.hpp"
24
25namespace neogfx
26{
28 {
29 public:
30 define_event(PopupCreated, popup_created, popup_menu&)
31 public:
32 struct widget_not_created_yet : std::logic_error { widget_not_created_yet() : std::logic_error("neogfx::context_menu::widget_not_created_yet") {} };
33 public:
34 context_menu(const point& aPosition, window_style aStyle = popup_menu::DEFAULT_STYLE | window_style::DismissOnParentClick);
35 context_menu(i_widget& aParent, const point& aPosition, window_style aStyle = popup_menu::DEFAULT_STYLE | window_style::DismissOnParentClick);
37 public:
40 void exec();
41 private:
42 std::unique_ptr<i_menu> iMenu;
43 i_widget* iParent;
44 point iPosition;
45 window_style iStyle;
46 static std::unique_ptr<popup_menu> sWidget;
47 };
48}
context_menu(const point &aPosition, window_style aStyle=popup_menu::DEFAULT_STYLE|window_style::DismissOnParentClick)
context_menu(i_widget &aParent, const point &aPosition, window_style aStyle=popup_menu::DEFAULT_STYLE|window_style::DismissOnParentClick)
popup_menu & root_widget()
#define define_event(name, declName,...)
Definition event.hpp:200