neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
popup_menu.hpp
Go to the documentation of this file.
1
// popup_menu.hpp
2
/*
3
neogfx C++ App/Game Engine
4
Copyright (c) 2015, 2020 Leigh Johnston. All Rights Reserved.
5
6
This program is free software: you can redistribute it and / or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation, either version 3 of the License, or
9
(at your option) any later version.
10
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
15
16
You should have received a copy of the GNU General Public License
17
along with this program. If not, see <http://www.gnu.org/licenses/>.
18
*/
19
20
#pragma once
21
22
#include <
neogfx/neogfx.hpp
>
23
#include "
window.hpp
"
24
#include <
neogfx/gui/layout/vertical_layout.hpp
>
25
#include <
neogfx/gui/widget/i_menu.hpp
>
26
27
namespace
neogfx
28
{
29
class
popup_menu
:
public
window
30
{
31
meta_object
(
window
)
32
public
:
33
static
const
window_style
DEFAULT_STYLE =
34
window_style::Weak
|
35
window_style::NoDecoration
|
36
window_style::NoActivate
|
37
window_style::RequiresOwnerFocus
|
38
window_style::HideOnOwnerClick
|
39
window_style::InitiallyHidden
|
40
window_style::InitiallyRenderable
|
41
window_style::DropShadow
|
42
window_style::Popup
|
43
window_style::Menu
;
44
public
:
45
struct
no_menu
: std::logic_error {
no_menu
() : std::logic_error(
"neogfx::popup_menu::no_menu"
) {} };
46
public
:
47
popup_menu
(
const
point
& aPosition,
i_menu
& aMenu,
window_style
aStyle = DEFAULT_STYLE);
48
popup_menu
(
i_widget
& aParent,
const
point
& aPosition,
i_menu
& aMenu,
window_style
aStyle = DEFAULT_STYLE);
49
popup_menu
(
const
point
& aPosition,
window_style
aStyle = DEFAULT_STYLE);
50
popup_menu
(
i_widget
& aParent,
const
point
& aPosition,
window_style
aStyle = DEFAULT_STYLE);
51
~popup_menu
();
52
public
:
53
bool
has_menu
()
const
;
54
i_menu
&
menu
()
const
;
55
void
set_menu
(
i_menu
& aMenu,
const
point
& aPosition =
point
{});
56
void
clear_menu
();
57
public
:
58
void
resized
()
override
;
59
public
:
60
void
dismiss
()
override
;
61
public
:
62
double
rendering_priority
()
const override
;
63
public
:
64
neogfx::size_policy
size_policy
()
const override
;
65
size
minimum_size
(
optional_size
const
& aAvailableSpace =
optional_size
{})
const
override
;
66
size
maximum_size
(
optional_size
const
& aAvailableSpace =
optional_size
{})
const
override
;
67
public
:
68
color
frame_color
()
const override
;
69
public
:
70
bool
key_pressed
(
scan_code_e
aScanCode,
key_code_e
aKeyCode,
key_modifiers_e
aKeyModifiers)
override
;
71
bool
key_released
(
scan_code_e
aScanCode,
key_code_e
aKeyCode,
key_modifiers_e
aKeyModifiers)
override
;
72
bool
text_input
(
i_string
const
& aText)
override
;
73
private
:
74
void
init();
75
void
close_sub_menu();
76
void
update_position();
77
private
:
78
sink
iSink;
79
sink
iSink2;
80
i_widget
* iParentWidget;
81
i_menu
* iMenu;
82
std::unique_ptr<popup_menu> iOpenSubMenu;
83
bool
iOpeningSubMenu;
84
};
85
}
neogfx::basic_point< coordinate >
neogfx::basic_size< coordinate >
neogfx::i_menu
Definition
i_menu.hpp:36
neogfx::i_widget
Definition
i_widget.hpp:50
neogfx::popup_menu
Definition
popup_menu.hpp:30
neogfx::popup_menu::menu
i_menu & menu() const
neogfx::popup_menu::has_menu
bool has_menu() const
neogfx::popup_menu::key_released
bool key_released(scan_code_e aScanCode, key_code_e aKeyCode, key_modifiers_e aKeyModifiers) override
neogfx::popup_menu::key_pressed
bool key_pressed(scan_code_e aScanCode, key_code_e aKeyCode, key_modifiers_e aKeyModifiers) override
neogfx::popup_menu::popup_menu
popup_menu(const point &aPosition, i_menu &aMenu, window_style aStyle=DEFAULT_STYLE)
neogfx::popup_menu::popup_menu
popup_menu(i_widget &aParent, const point &aPosition, i_menu &aMenu, window_style aStyle=DEFAULT_STYLE)
neogfx::popup_menu::maximum_size
size maximum_size(optional_size const &aAvailableSpace=optional_size{}) const override
neogfx::popup_menu::resized
void resized() override
neogfx::popup_menu::popup_menu
popup_menu(i_widget &aParent, const point &aPosition, window_style aStyle=DEFAULT_STYLE)
neogfx::popup_menu::popup_menu
popup_menu(const point &aPosition, window_style aStyle=DEFAULT_STYLE)
neogfx::popup_menu::minimum_size
size minimum_size(optional_size const &aAvailableSpace=optional_size{}) const override
neogfx::popup_menu::text_input
bool text_input(i_string const &aText) override
neogfx::popup_menu::clear_menu
void clear_menu()
neogfx::popup_menu::frame_color
color frame_color() const override
neogfx::popup_menu::set_menu
void set_menu(i_menu &aMenu, const point &aPosition=point{})
neogfx::popup_menu::size_policy
neogfx::size_policy size_policy() const override
neogfx::popup_menu::~popup_menu
~popup_menu()
neogfx::popup_menu::dismiss
void dismiss() override
neogfx::popup_menu::rendering_priority
double rendering_priority() const override
neogfx::sRGB_color
Definition
color.hpp:374
neogfx::window
Definition
window.hpp:37
neolib::i_string
Definition
i_string.hpp:49
neolib::optional
Definition
optional.hpp:55
neolib::sink
Definition
i_event.hpp:255
i_menu.hpp
neogfx
Definition
action.hpp:28
neogfx::key_modifiers_e
key_modifiers_e
Definition
i_keyboard.hpp:588
neogfx::key_code_e
key_code_e
Definition
i_keyboard.hpp:331
neogfx::scan_code_e
scan_code_e
Definition
i_keyboard.hpp:54
neogfx::window_style
window_style
Definition
window_bits.hpp:29
neogfx::window_style::Popup
@ Popup
neogfx::window_style::NoDecoration
@ NoDecoration
neogfx::window_style::HideOnOwnerClick
@ HideOnOwnerClick
neogfx::window_style::RequiresOwnerFocus
@ RequiresOwnerFocus
neogfx::window_style::DropShadow
@ DropShadow
neogfx::window_style::InitiallyRenderable
@ InitiallyRenderable
neogfx::window_style::Weak
@ Weak
neogfx::window_style::NoActivate
@ NoActivate
neogfx::window_style::Menu
@ Menu
neogfx::window_style::InitiallyHidden
@ InitiallyHidden
meta_object
#define meta_object(...)
Definition
i_object.hpp:28
neogfx.hpp
neogfx::popup_menu::no_menu
Definition
popup_menu.hpp:45
neogfx::popup_menu::no_menu::no_menu
no_menu()
Definition
popup_menu.hpp:45
vertical_layout.hpp
window.hpp
include
neogfx
gui
window
popup_menu.hpp
Generated by
1.9.8