neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
menu_item.hpp
Go to the documentation of this file.
1
// menu_item.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/widget/i_menu_item.hpp
>
24
25
namespace
neogfx
26
{
27
class
i_menu;
28
29
class
menu_item
:
public
i_menu_item
30
{
31
public
:
32
define_declared_event
(
Selected
, selected)
33
define_declared_event
(Deselected, deselected)
34
private
:
35
typedef
ref_ptr<i_action>
action_pointer;
36
typedef
std::shared_ptr<i_menu> menu_pointer;
37
typedef
std::variant<std::monostate, action_pointer, menu_pointer> contents;
38
public
:
39
menu_item
(
i_action
& aAction);
40
menu_item
(
i_ref_ptr<i_action>
const
& aAction);
41
menu_item
(
i_menu
& aSubMenu);
42
menu_item
(std::shared_ptr<i_menu> aSubMenu);
43
public
:
44
menu_item_type
type
()
const override
;
45
uuid
const
&
group
()
const override
;
46
const
i_action
&
action
()
const override
;
47
i_action
&
action
()
override
;
48
const
i_menu
&
sub_menu
()
const override
;
49
i_menu
&
sub_menu
()
override
;
50
public
:
51
const
i_menu_item_widget
&
as_widget
()
const override
;
52
i_menu_item_widget
&
as_widget
()
override
;
53
void
set_widget
(
i_menu_item_widget
& aWidget)
override
;
54
void
unset_widget
()
override
;
55
public
:
56
bool
available
()
const override
;
57
void
select
(
bool
aOpenAnySubMenu =
true
)
override
;
58
bool
open_any_sub_menu
()
const override
;
59
private
:
60
contents iContents;
61
bool
iOpenAnySubMenu;
62
i_menu_item_widget
* iWidget;
63
};
64
}
neogfx::i_action
Definition
i_action.hpp:32
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::menu_item
Definition
menu_item.hpp:30
neogfx::menu_item::define_declared_event
define_declared_event(Selected, selected) define_declared_event(Deselected
neogfx::menu_item::menu_item
menu_item(std::shared_ptr< i_menu > aSubMenu)
neogfx::menu_item::as_widget
i_menu_item_widget & as_widget() override
neogfx::menu_item::action
const i_action & action() const override
neogfx::menu_item::open_any_sub_menu
bool open_any_sub_menu() const override
neogfx::menu_item::unset_widget
void unset_widget() override
neogfx::menu_item::available
bool available() const override
neogfx::menu_item::group
uuid const & group() const override
neogfx::menu_item::action
i_action & action() override
neogfx::menu_item::sub_menu
i_menu & sub_menu() override
neogfx::menu_item::select
void select(bool aOpenAnySubMenu=true) override
neogfx::menu_item::type
menu_item_type type() const override
neogfx::menu_item::sub_menu
const i_menu & sub_menu() const override
neogfx::menu_item::menu_item
menu_item(i_action &aAction)
neogfx::menu_item::as_widget
const i_menu_item_widget & as_widget() const override
neogfx::menu_item::menu_item
menu_item(i_ref_ptr< i_action > const &aAction)
neogfx::menu_item::menu_item
menu_item(i_menu &aSubMenu)
neogfx::menu_item::set_widget
void set_widget(i_menu_item_widget &aWidget) override
neolib::i_ref_ptr
Definition
i_reference_counted.hpp:78
neolib::ref_ptr
Definition
reference_counted.hpp:185
i_menu_item.hpp
neogfx
Definition
action.hpp:28
neogfx::menu_item_type
menu_item_type
Definition
i_menu_item.hpp:30
neogfx::item_cell_selection_flags::Selected
@ Selected
neogfx.hpp
define_declared_event
#define define_declared_event(name, declName,...)
Definition
event.hpp:195
neolib::uuid
Definition
uuid.hpp:51
include
neogfx
gui
widget
menu_item.hpp
Generated by
1.9.8