neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
i_menu_item.hpp
Go to the documentation of this file.
1
// i_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/app/i_action.hpp
>
24
25
namespace
neogfx
26
{
27
class
i_menu;
28
29
enum class
menu_item_type
: uint32_t
30
{
31
Action
,
32
SubMenu
33
};
34
35
class
i_menu_item_widget;
36
37
class
i_menu_item
38
{
39
public
:
40
declare_event
(selected)
41
declare_event
(deselected)
42
public
:
43
struct
wrong_type : std::logic_error { wrong_type() : std::logic_error(
"neogfx::i_menu_item::wrong_type"
) {} };
44
struct
no_widget
: std::logic_error {
no_widget
() : std::logic_error(
"neogfx::i_menu_item::no_widget"
) {} };
45
public
:
46
virtual
~i_menu_item
() =
default
;
47
public
:
48
virtual
menu_item_type
type
()
const
= 0;
49
virtual
uuid
const
&
group
()
const
= 0;
50
virtual
const
i_action
&
action
()
const
= 0;
51
virtual
i_action
&
action
() = 0;
52
virtual
const
i_menu
&
sub_menu
()
const
= 0;
53
virtual
i_menu
&
sub_menu
() = 0;
54
public
:
55
virtual
const
i_menu_item_widget
&
as_widget
()
const
= 0;
56
virtual
i_menu_item_widget
&
as_widget
() = 0;
57
virtual
void
set_widget
(
i_menu_item_widget
& aWidget) = 0;
58
virtual
void
unset_widget
() = 0;
59
public
:
60
virtual
bool
available
()
const
= 0;
61
virtual
void
select
(
bool
aOpenAnySubMenu =
true
) = 0;
62
virtual
bool
open_any_sub_menu
()
const
= 0;
63
public
:
64
bool
is_separator
()
const
65
{
66
return
type
() ==
menu_item_type::Action
&&
action
().
is_separator
();
67
}
68
};
69
}
neogfx::i_action
Definition
i_action.hpp:32
neogfx::i_action::is_separator
virtual bool is_separator() const =0
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_item::set_widget
virtual void set_widget(i_menu_item_widget &aWidget)=0
neogfx::i_menu_item::as_widget
virtual i_menu_item_widget & as_widget()=0
neogfx::i_menu_item::unset_widget
virtual void unset_widget()=0
neogfx::i_menu_item::type
virtual menu_item_type type() const =0
neogfx::i_menu_item::is_separator
bool is_separator() const
Definition
i_menu_item.hpp:64
neogfx::i_menu_item::~i_menu_item
virtual ~i_menu_item()=default
neogfx::i_menu_item::sub_menu
virtual const i_menu & sub_menu() const =0
neogfx::i_menu_item::open_any_sub_menu
virtual bool open_any_sub_menu() const =0
neogfx::i_menu_item::action
virtual i_action & action()=0
neogfx::i_menu_item::action
virtual const i_action & action() const =0
neogfx::i_menu_item::group
virtual uuid const & group() const =0
neogfx::i_menu_item::as_widget
virtual const i_menu_item_widget & as_widget() const =0
neogfx::i_menu_item::available
virtual bool available() const =0
neogfx::i_menu_item::select
virtual void select(bool aOpenAnySubMenu=true)=0
neogfx::i_menu_item::sub_menu
virtual i_menu & sub_menu()=0
neogfx::i_menu
Definition
i_menu.hpp:36
i_action.hpp
neogfx
Definition
action.hpp:28
neogfx::menu_item_type
menu_item_type
Definition
i_menu_item.hpp:30
neogfx::menu_item_type::Action
@ Action
neogfx::menu_item_type::SubMenu
@ SubMenu
neogfx::help_type::Action
@ Action
neogfx.hpp
declare_event
#define declare_event(declName,...)
Definition
i_event.hpp:305
neogfx::i_menu_item::no_widget
Definition
i_menu_item.hpp:44
neogfx::i_menu_item::no_widget::no_widget
no_widget()
Definition
i_menu_item.hpp:44
neolib::uuid
Definition
uuid.hpp:51
include
neogfx
gui
widget
i_menu_item.hpp
Generated by
1.9.8