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/*
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>
24
25namespace neogfx
26{
27 class i_menu;
28
29 enum class menu_item_type : uint32_t
30 {
31 Action,
33 };
34
35 class i_menu_item_widget;
36
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;
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 {
67 }
68 };
69}
virtual bool is_separator() const =0
virtual void set_widget(i_menu_item_widget &aWidget)=0
virtual i_menu_item_widget & as_widget()=0
virtual void unset_widget()=0
virtual menu_item_type type() const =0
bool is_separator() const
virtual ~i_menu_item()=default
virtual const i_menu & sub_menu() const =0
virtual bool open_any_sub_menu() const =0
virtual i_action & action()=0
virtual const i_action & action() const =0
virtual uuid const & group() const =0
virtual const i_menu_item_widget & as_widget() const =0
virtual bool available() const =0
virtual void select(bool aOpenAnySubMenu=true)=0
virtual i_menu & sub_menu()=0
#define declare_event(declName,...)
Definition i_event.hpp:305