neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
widget_bits.hpp
Go to the documentation of this file.
1// widget_bits.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
24namespace neogfx
25{
26 enum class widget_type : uint32_t
27 {
28 Client = 0x00000001,
29 NonClient = 0x00000002,
30 Floating = 0x00010000
31 };
32
33 inline constexpr widget_type operator|(widget_type aLhs, widget_type aRhs)
34 {
35 return static_cast<widget_type>(static_cast<uint32_t>(aLhs) | static_cast<uint32_t>(aRhs));
36 }
37
38 inline constexpr widget_type operator&(widget_type aLhs, widget_type aRhs)
39 {
40 return static_cast<widget_type>(static_cast<uint32_t>(aLhs) & static_cast<uint32_t>(aRhs));
41 }
42
43 inline constexpr widget_type& operator|=(widget_type& aLhs, widget_type aRhs)
44 {
45 return aLhs = static_cast<widget_type>(static_cast<uint32_t>(aLhs) | static_cast<uint32_t>(aRhs));
46 }
47
48 inline constexpr widget_type& operator&=(widget_type& aLhs, widget_type aRhs)
49 {
50 return aLhs = static_cast<widget_type>(static_cast<uint32_t>(aLhs) & static_cast<uint32_t>(aRhs));
51 }
52
53 class i_widget;
54
56 {
59 {
60 Invalid = 0x00000000,
61 Client = 0x00000001,
62 NonClient = 0x00000002,
63 NonClientOther = 0x00000004,
64 TitleBar = 0x00000008,
65 Grab = 0x00000010,
66 Border = 0x00000020,
67 BorderLeft = 0x00000040,
68 BorderTopLeft = 0x00000080,
69 BorderTop = 0x00000100,
70 BorderTopRight = 0x00000200,
71 BorderRight = 0x00000400,
72 BorderBottomRight = 0x00000800,
73 BorderBottom = 0x00001000,
74 BorderBottomLeft = 0x00002000,
75 GrowBox = 0x00004000,
76 CloseButton = 0x00008000,
77 MaximizeButton = 0x00010000,
78 MinimizeButton = 0x00020000,
79 RestoreButton = 0x00040000,
80 Menu = 0x00080000,
81 SystemMenu = 0x00100000,
82 VerticalScrollbar = 0x00200000,
83 HorizontalScrollbar = 0x00400000,
84 Nowhere = 0x40000000,
85 NowhereError = 0x80800000
87 };
88
90
91 inline bool capture_ok(widget_part aWidgetPart)
92 {
93 switch (aWidgetPart.part)
94 {
105 return true;
115 return true;
116 default:
117 return false;
118 }
119 }
120
121 enum class focus_policy : uint32_t
122 {
123 NoFocus = 0x00000000,
124 ClickFocus = 0x00000001,
125 TabFocus = 0x00000002,
128 WheelFocus = 0x00000004, // todo
129 PointerFocus = 0x00000008, // todo
130 KeepChildFocus = 0x00010000,
131 ConsumeTabKey = 0x10000000,
132 ConsumeReturnKey = 0x20000000,
133 ConsumeEscapeKey = 0x20000000,
134 IgnoreNonClient = 0x40000000
135 };
136
138}
139
163declare_enum_string(neogfx::widget_part_e, HorizontalScrollbar)
167
182
183namespace neogfx
184{
185 enum class focus_event
186 {
189 };
190
191 enum class focus_reason
192 {
193 ClickNonClient,
194 ClickClient,
195 Tab,
196 Wheel,
197 Pointer,
198 WindowActivation,
199 Other
200 };
201
202 enum class capture_reason
203 {
204 MouseEvent,
205 Other
206 };
207
209 {
210 return static_cast<focus_policy>(static_cast<uint32_t>(aLhs) | static_cast<uint32_t>(aRhs));
211 }
212
214 {
215 aLhs = static_cast<focus_policy>(static_cast<uint32_t>(aLhs) | static_cast<uint32_t>(aRhs));
216 return aLhs;
217 }
218
220 {
221 return static_cast<focus_policy>(static_cast<uint32_t>(aLhs) & static_cast<uint32_t>(aRhs));
222 }
223
225 {
226 aLhs = static_cast<focus_policy>(static_cast<uint32_t>(aLhs) & static_cast<uint32_t>(aRhs));
227 return aLhs;
228 }
229
231 {
232 return static_cast<focus_policy>(~static_cast<uint32_t>(aLhs));
233 }
234}
#define end_declare_enum(enumName)
Definition i_enum.hpp:62
#define declare_enum_string(enumName, enumEnumerator)
Definition i_enum.hpp:59
#define begin_declare_enum(enumName)
Definition i_enum.hpp:52
constexpr font_style & operator&=(font_style &aLhs, font_style aRhs)
Definition font.hpp:81
constexpr style_aspect operator&(style_aspect aLhs, style_aspect aRhs)
Definition i_style.hpp:60
audio_channel operator~(audio_channel lhs)
bool capture_ok(widget_part aWidgetPart)
optional< focus_policy > optional_focus_policy
constexpr font_style & operator|=(font_style &aLhs, font_style aRhs)
Definition font.hpp:76
constexpr style_aspect operator|(style_aspect aLhs, style_aspect aRhs)
Definition i_style.hpp:55
widget_part::widget_part_e widget_part_e
enum neogfx::widget_part::widget_part_e part
i_widget const & widget