Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
GUIElement.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2018 DIVIDE-Studio
3 Copyright (c) 2009 Ionut Cava
4
5 This file is part of DIVIDE Framework.
6
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software
9 and associated documentation files (the "Software"), to deal in the Software
10 without restriction,
11 including without limitation the rights to use, copy, modify, merge, publish,
12 distribute, sublicense,
13 and/or sell copies of the Software, and to permit persons to whom the
14 Software is furnished to do so,
15 subject to the following conditions:
16
17 The above copyright notice and this permission notice shall be included in
18 all copies or substantial portions of the Software.
19
20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 IMPLIED,
22 INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
23 PARTICULAR PURPOSE AND NONINFRINGEMENT.
24 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
25 DAMAGES OR OTHER LIABILITY,
26 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
27 IN CONNECTION WITH THE SOFTWARE
28 OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
30 */
31
32#pragma once
33#ifndef DVD_GUI_ELEMENT_H_
34#define DVD_GUI_ELEMENT_H_
35
36namespace CEGUI {
37 class Window;
38};
39
40namespace Divide {
41
42namespace GFX {
43 class CommandBuffer;
44};
45
46enum class GUIType : U8 {
47 GUI_TEXT = 0,
48 GUI_BUTTON = 1,
49 GUI_FLASH = 2,
50 GUI_CONSOLE = 3,
53 COUNT
54};
55
56class GFXDevice;
57struct SizeChangeParams;
58
59template<GUIType TypeEnum>
60struct TypeHelper {
61 static const GUIType STATIC_GUI_TYPE_ID = TypeEnum;
62};
63
64class GUIElement : public GUIDWrapper {
65 friend class GUI;
66 public:
67 GUIElement(string name, CEGUI::Window* parent) noexcept;
68
69 virtual void setTooltip([[maybe_unused]] const string& tooltipText) {}
70
71 PROPERTY_RW(string, name, "");
72
73 VIRTUAL_PROPERTY_RW(bool, visible, true);
74 VIRTUAL_PROPERTY_RW(bool, active, false);
75
76 static constexpr GUIType Type = GUIType::COUNT;
77
78 [[nodiscard]] virtual GUIType type() const noexcept { return Type; }
79
80 protected:
81 CEGUI::Window* _parent;
82};
83
84template<GUIType EnumVal>
86
87 GUIElementBase(const string& name, CEGUI::Window* const parent)
88 : GUIElement(name, parent)
89 {}
90
91 static constexpr GUIType Type = EnumVal;
92
93 [[nodiscard]] GUIType type() const noexcept override { return Type; }
94};
95
96}; // namespace Divide
97
98#endif //DVD_GUI_ELEMENT_H_
Utility class that adds basic GUID management to objects.
Definition: GUIDWrapper.h:44
CEGUI::Window * _parent
Definition: GUIElement.h:81
VIRTUAL_PROPERTY_RW(bool, active, false)
virtual void setTooltip(const string &tooltipText)
Definition: GUIElement.h:69
PROPERTY_RW(string, name, "")
VIRTUAL_PROPERTY_RW(bool, visible, true)
virtual GUIType type() const noexcept
Definition: GUIElement.h:78
static constexpr GUIType Type
Definition: GUIElement.h:76
Graphical User Interface.
Definition: GUI.h:81
Handle console commands that start with a forward slash.
Definition: AIProcessor.cpp:7
uint8_t U8
Project & parent
Definition: DefaultScene.h:41
GUIType type() const noexcept override
Definition: GUIElement.h:93
GUIElementBase(const string &name, CEGUI::Window *const parent)
Definition: GUIElement.h:87
static constexpr GUIType Type
Definition: GUIElement.h:91
static const GUIType STATIC_GUI_TYPE_ID
Definition: GUIElement.h:61