neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
menu_item_widget.hpp
Go to the documentation of this file.
1
// menu_item_widget.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 <
neogfx/gui/layout/horizontal_layout.hpp
>
24
#include <
neogfx/gui/layout/spacer.hpp
>
25
#include <
neogfx/gui/widget/i_menu_item_widget.hpp
>
26
#include <
neogfx/gui/widget/i_menu_item.hpp
>
27
28
namespace
neogfx
29
{
30
class
popup_menu;
31
32
class
menu_item_widget
:
public
widget
<>,
public
i_menu_item_widget
33
{
34
meta_object
(
widget<>
)
35
public
:
36
menu_item_widget
(
i_menu
& aMenu,
i_menu_item
& aMenuItem);
37
menu_item_widget
(
i_widget
& aParent,
i_menu
& aMenu,
i_menu_item
& aMenuItem);
38
menu_item_widget
(
i_layout
& aLayout,
i_menu
& aMenu,
i_menu_item
& aMenuItem);
39
~menu_item_widget
();
40
public
:
41
i_menu
&
menu
()
const override
;
42
i_menu_item
&
menu_item
()
const override
;
43
public
:
44
image_widget
&
item_icon
()
override
;
// todo: i_image_widget
45
text_widget
&
item_text
()
override
;
// todo: i_text_widget
46
public
:
47
neogfx::size_policy
size_policy
()
const override
;
48
size
minimum_size
(
optional_size
const
& aAvailableSpace =
optional_size
{})
const
override
;
49
public
:
50
void
paint_non_client
(
i_graphics_context
& aGc)
const override
;
51
void
paint
(
i_graphics_context
& aGc)
const override
;
52
public
:
53
color
palette_color
(
color_role
aColorRole)
const override
;
54
public
:
55
bool
can_capture
()
const override
;
56
public
:
57
void
mouse_entered
(
const
point
& aPosition)
override
;
58
void
mouse_left
()
override
;
59
void
mouse_button_pressed
(
mouse_button
aButton,
const
point
& aPosition,
key_modifiers_e
aKeyModifiers)
override
;
60
void
mouse_button_released
(
mouse_button
aButton,
const
point
& aPosition)
override
;
61
bool
key_pressed
(
scan_code_e
aScanCode,
key_code_e
aKeyCode,
key_modifiers_e
aKeyModifiers)
override
;
62
protected
:
63
std::string
mnemonic
()
const override
;
64
void
mnemonic_execute
()
override
;
65
i_widget
&
mnemonic_widget
()
override
;
66
protected
:
67
bool
help_active
()
const override
;
68
neogfx::help_type
help_type
()
const override
;
69
i_string
const
&
help_text
()
const override
;
70
public
:
71
point
sub_menu_position
()
const
;
72
private
:
73
void
init();
74
virtual
void
select_item(
bool
aOpenAnySubMenu =
false
);
75
void
close_menu();
76
private
:
77
sink
iSink;
78
dimension
iGap = 9.0;
79
size
iIconSize =
size
{ 16.0, 16.0 };
80
i_menu
& iMenu;
81
i_menu_item
& iMenuItem;
82
horizontal_layout
iLayout;
83
image_widget
iIcon;
84
text_widget
iText;
85
horizontal_spacer
iSpacer;
86
text_widget
iShortcutText;
87
std::optional<std::unique_ptr<widget_timer>> iSubMenuOpener;
88
mutable
std::optional<std::pair<color, texture>> iSubMenuArrow;
89
};
90
}
neogfx::basic_point< coordinate >
neogfx::basic_size< coordinate >
neogfx::horizontal_layout
Definition
horizontal_layout.hpp:29
neogfx::horizontal_spacer
Definition
spacer.hpp:77
neogfx::i_graphics_context
Definition
i_graphics_context.hpp:124
neogfx::i_layout
Definition
i_layout.hpp:231
neogfx::i_menu_item_widget
Definition
i_menu_item_widget.hpp:34
neogfx::i_menu_item
Definition
i_menu_item.hpp:38
neogfx::i_menu
Definition
i_menu.hpp:36
neogfx::i_widget
Definition
i_widget.hpp:50
neogfx::image_widget
Definition
image_widget.hpp:31
neogfx::menu_item_widget
Definition
menu_item_widget.hpp:33
neogfx::menu_item_widget::item_icon
image_widget & item_icon() override
neogfx::menu_item_widget::palette_color
color palette_color(color_role aColorRole) const override
neogfx::menu_item_widget::help_active
bool help_active() const override
neogfx::menu_item_widget::menu_item
i_menu_item & menu_item() const override
neogfx::menu_item_widget::mouse_entered
void mouse_entered(const point &aPosition) override
neogfx::menu_item_widget::item_text
text_widget & item_text() override
neogfx::menu_item_widget::size_policy
neogfx::size_policy size_policy() const override
neogfx::menu_item_widget::mouse_left
void mouse_left() override
neogfx::menu_item_widget::mnemonic_widget
i_widget & mnemonic_widget() override
neogfx::menu_item_widget::mouse_button_pressed
void mouse_button_pressed(mouse_button aButton, const point &aPosition, key_modifiers_e aKeyModifiers) override
neogfx::menu_item_widget::menu
i_menu & menu() const override
neogfx::menu_item_widget::mnemonic
std::string mnemonic() const override
neogfx::menu_item_widget::paint
void paint(i_graphics_context &aGc) const override
neogfx::menu_item_widget::mouse_button_released
void mouse_button_released(mouse_button aButton, const point &aPosition) override
neogfx::menu_item_widget::help_text
i_string const & help_text() const override
neogfx::menu_item_widget::key_pressed
bool key_pressed(scan_code_e aScanCode, key_code_e aKeyCode, key_modifiers_e aKeyModifiers) override
neogfx::menu_item_widget::sub_menu_position
point sub_menu_position() const
neogfx::menu_item_widget::help_type
neogfx::help_type help_type() const override
neogfx::menu_item_widget::mnemonic_execute
void mnemonic_execute() override
neogfx::menu_item_widget::paint_non_client
void paint_non_client(i_graphics_context &aGc) const override
neogfx::menu_item_widget::minimum_size
size minimum_size(optional_size const &aAvailableSpace=optional_size{}) const override
neogfx::menu_item_widget::can_capture
bool can_capture() const override
neogfx::sRGB_color
Definition
color.hpp:374
neogfx::text_widget
Definition
text_widget.hpp:28
neogfx::widget
Definition
widget.hpp:35
neolib::i_string
Definition
i_string.hpp:49
neolib::optional
Definition
optional.hpp:55
neolib::sink
Definition
i_event.hpp:255
horizontal_layout.hpp
i_menu_item.hpp
i_menu_item_widget.hpp
neogfx
Definition
action.hpp:28
neogfx::key_modifiers_e
key_modifiers_e
Definition
i_keyboard.hpp:588
neogfx::dimension
default_geometry_value_type dimension
Definition
geometrical.hpp:35
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::mouse_button
mouse_button
Definition
i_mouse.hpp:31
neogfx::help_type
help_type
Definition
i_help.hpp:28
neogfx::color_role
color_role
Definition
i_palette.hpp:31
meta_object
#define meta_object(...)
Definition
i_object.hpp:28
neogfx.hpp
spacer.hpp
include
neogfx
gui
widget
menu_item_widget.hpp
Generated by
1.9.8