neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
i_widget.hpp
Go to the documentation of this file.
1// i_widget.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>
24#include <neogfx/core/event.hpp>
26#include <neogfx/hid/mouse.hpp>
35
36namespace neogfx
37{
38 class i_surface;
39 class i_layout;
40 class i_window;
41
42 enum class layout_reason
43 {
45 Async,
46 Resize
47 };
48
49 class i_widget : public i_layout_item, public i_keyboard_handler, public i_mouse_handler, public virtual i_skinnable_item
50 {
51 public:
52 declare_event(device_metrics_updated, const i_widget&)
53 declare_event(child_added, i_widget&)
54 declare_event(child_removed, i_widget&)
55 declare_event(visibility_changed)
56 declare_event(position_changed)
57 declare_event(parent_position_changed)
58 declare_event(size_changed)
59 declare_event(layout_completed)
61 declare_event(painting_children, i_graphics_context&)
65 declare_event(query_mouse_cursor, neogfx::mouse_cursor&)
67 declare_event(focus_event, neogfx::focus_event, focus_reason)
68 public:
69 typedef i_widget abstract_type;
71 public:
72 struct no_parent : std::logic_error { no_parent() : std::logic_error("neogfx::i_widget::no_parent") {} };
73 struct no_root : std::logic_error { no_root() : std::logic_error("neogfx::i_widget::no_root") {} };
74 struct no_surface : std::logic_error { no_surface() : std::logic_error("neogfx::i_widget::no_surface") {} };
75 struct no_children : std::logic_error { no_children() : std::logic_error("neogfx::i_widget::no_children") {} };
76 struct not_child : std::logic_error { not_child() : std::logic_error("neogfx::i_widget::not_child") {} };
77 struct no_update_rect : std::logic_error { no_update_rect() : std::logic_error("neogfx::i_widget::no_update_rect") {} };
78 struct widget_not_entered : std::logic_error { widget_not_entered() : std::logic_error("neogfx::i_widget::widget_not_entered") {} };
79 struct widget_cannot_capture : std::logic_error { widget_cannot_capture() : std::logic_error("neogfx::i_widget::widget_cannot_capture") {} };
80 struct widget_not_focused : std::logic_error { widget_not_focused() : std::logic_error("neogfx::i_widget::widget_not_focused") {} };
81 struct widget_cannot_defer_layout : std::logic_error { widget_cannot_defer_layout() : std::logic_error("neogfx::i_widget::widget_cannot_defer_layout") {} };
82 struct layout_already_set : std::logic_error { layout_already_set() : std::logic_error("neogfx::i_widget::layout_already_set") {} };
83 struct no_layout : std::logic_error { no_layout() : std::logic_error("neogfx::i_widget::no_layout") {} };
84 public:
85 virtual ~i_widget() = default;
86 public:
88 public:
89 virtual bool is_singular() const = 0;
90 virtual void set_singular(bool aSingular) = 0;
91 virtual bool is_root() const = 0;
92 virtual bool has_root() const = 0;
93 virtual const i_window& root() const = 0;
94 virtual i_window& root() = 0;
95 virtual void set_root(i_window& aRoot) = 0;
96 virtual bool has_surface() const = 0;
97 virtual bool is_surface() const = 0;
98 virtual const i_surface& surface() const = 0;
99 virtual i_surface& surface() = 0;
100 virtual const i_surface& real_surface() const = 0;
101 virtual i_surface& real_surface() = 0;
102 virtual bool has_parent() const = 0;
103 virtual const i_widget& parent() const = 0;
104 virtual i_widget& parent() = 0;
105 virtual void set_parent(i_widget& aParent) = 0;
106 virtual void parent_changed() = 0;
107 virtual bool adding_child() const = 0;
108 virtual i_widget& add(i_widget& aChild) = 0;
109 virtual i_widget& add(const i_ref_ptr<i_widget>& aChild) = 0;
110 virtual void remove(i_widget& aChild, bool aSingular, i_ref_ptr<i_widget>& aChildRef) = 0;
111 virtual void remove_all() = 0;
112 virtual bool has_children() const = 0;
113 virtual const widget_list& children() const = 0;
114 virtual widget_list::const_iterator last() const = 0;
115 virtual widget_list::iterator last() = 0;
116 virtual widget_list::const_iterator find(const i_widget& aChild, bool aThrowIfNotFound = true) const = 0;
117 virtual widget_list::iterator find(const i_widget& aChild, bool aThrowIfNotFound = true) = 0;
118 public:
119 virtual void bring_child_to_front(const i_widget& aChild) = 0;
120 virtual void send_child_to_back(const i_widget& aChild) = 0;
121 virtual layer_t layer() const = 0;
122 virtual void set_layer(layer_t aLayer) = 0;
123 public:
124 virtual const i_widget& before() const = 0;
125 virtual i_widget& before() = 0;
126 virtual const i_widget& after() const = 0;
127 virtual i_widget& after() = 0;
128 virtual void link_before(i_widget* aPreviousWidget) = 0;
129 virtual void link_after(i_widget* aNextWidget) = 0;
130 virtual void unlink() = 0;
131 public:
132 virtual bool has_layout() const = 0;
133 virtual void set_layout(i_layout& aLayout, bool aMoveExistingItems = true) = 0;
134 virtual void set_layout(const i_ref_ptr<i_layout>& aLayout, bool aMoveExistingItems = true) = 0;
135 virtual const i_layout& layout() const = 0;
136 virtual i_layout& layout() = 0;
137 virtual bool can_defer_layout() const = 0;
138 virtual bool has_layout_manager() const = 0;
139 virtual const i_widget& layout_manager() const = 0;
140 virtual i_widget& layout_manager() = 0;
141 virtual bool is_managing_layout() const = 0;
142 virtual bool has_parent_layout() const = 0;
143 virtual const i_layout& parent_layout() const = 0;
144 virtual i_layout& parent_layout() = 0;
146 virtual void layout_items(bool aDefer = false) = 0;
147 virtual void layout_items_started() = 0;
148 virtual bool layout_items_in_progress() const = 0;
149 virtual void layout_items_completed() = 0;
150 public:
151 virtual bool has_logical_coordinate_system() const = 0;
153 virtual void set_logical_coordinate_system(const optional_logical_coordinate_system& aLogicalCoordinateSystem) = 0;
154 virtual rect non_client_rect() const = 0;
155 virtual rect client_rect(bool aExtendIntoPadding = true) const = 0;
156 virtual void move(const point& aPosition) = 0;
157 virtual void moved() = 0;
158 virtual void parent_moved() = 0;
159 virtual size extents() const = 0;
160 virtual bool resizing() const = 0;
161 virtual void resize(const size& aSize) = 0;
162 virtual void resized() = 0;
163 virtual const i_widget& get_widget_at(const point& aPosition) const = 0;
164 virtual i_widget& get_widget_at(const point& aPosition) = 0;
165 virtual neogfx::widget_type widget_type() const = 0;
166 virtual bool part_active(widget_part aPart) const = 0;
167 virtual widget_part part(const point& aPosition) const = 0;
168 virtual widget_part hit_test(const point& aPosition) const = 0;
169 public:
170 virtual neogfx::view const& view() const = 0;
171 virtual neogfx::view& view() = 0;
172 virtual layer_t render_layer() const = 0;
173 virtual void set_render_layer(const std::optional<layer_t>& aLayer) = 0;
174 virtual bool can_update() const = 0;
175 virtual bool update(bool aIncludeNonClient = false) = 0;
176 virtual bool update(const rect& aUpdateRect) = 0;
177 virtual bool requires_update() const = 0;
178 virtual rect update_rect() const = 0;
179 virtual rect default_clip_rect(bool aIncludeNonClient = false) const = 0;
180 virtual bool ready_to_render() const = 0;
181 virtual void render(i_graphics_context& aGc) const = 0;
182 virtual void paint_non_client(i_graphics_context& aGc) const = 0;
183 virtual void paint_non_client_after(i_graphics_context& aGc) const = 0;
184 virtual void paint(i_graphics_context& aGc) const = 0;
185 public:
186 virtual double opacity() const = 0;
187 virtual void set_opacity(double aOpacity) = 0;
188 virtual bool has_background_opacity() const = 0;
189 virtual double background_opacity() const = 0;
190 virtual void set_background_opacity(double aOpacity) = 0;
191 virtual bool has_palette() const = 0;
192 virtual const i_palette& palette() const = 0;
193 virtual void set_palette(const i_palette& aPalette) = 0;
194 virtual bool has_palette_color(color_role aColorRole) const = 0;
195 virtual color palette_color(color_role aColorRole) const = 0;
196 virtual void set_palette_color(color_role aColorRole, const optional_color& aColor) = 0;
198 virtual bool has_font_role() const = 0;
199 virtual neogfx::font_role font_role() const = 0;
200 virtual void set_font_role(const optional_font_role& aFontRole) = 0;
201 virtual bool has_font() const = 0;
202 virtual const neogfx::font& font() const = 0;
203 virtual void set_font(optional_font const& aFont) = 0;
204 public:
205 virtual bool visible() const = 0;
206 virtual bool effectively_visible() const = 0;
207 virtual bool hidden() const = 0;
208 virtual bool effectively_hidden() const = 0;
209 virtual bool show(bool aVisible) = 0;
210 virtual bool enabled() const = 0;
211 virtual bool effectively_enabled() const = 0;
212 virtual bool disabled() const = 0;
213 virtual bool effectively_disabled() const = 0;
214 virtual bool enable(bool aEnable) = 0;
215 virtual bool entered(bool aChildEntered = false) const = 0;
216 virtual bool can_capture() const = 0;
217 virtual bool capturing() const = 0;
218 virtual const optional_point& capture_position() const = 0;
219 virtual void set_capture(capture_reason aReason = capture_reason::Other, const optional_point& aPosition = {}) = 0;
220 virtual void release_capture(capture_reason aReason = capture_reason::Other) = 0;
221 virtual void non_client_set_capture() = 0;
222 virtual void non_client_release_capture() = 0;
223 virtual void captured() = 0;
224 virtual void capture_released() = 0;
225 virtual bool has_focus_policy() const = 0;
227 virtual void set_focus_policy(const optional_focus_policy& aFocusPolicy) = 0;
228 virtual bool can_set_focus(focus_reason aFocusReason) const = 0;
229 virtual bool has_focus() const = 0;
230 virtual bool child_has_focus() const = 0;
231 virtual bool set_focus(focus_reason aFocusReason = focus_reason::Other) = 0;
232 virtual bool release_focus() = 0;
233 virtual void focus_gained(focus_reason aFocusReason) = 0;
234 virtual void focus_lost(focus_reason aFocusReason) = 0;
235 public:
236 virtual bool consider_ancestors_for_mouse_events() const = 0;
237 virtual void set_consider_ancestors_for_mouse_events(bool aConsiderAncestors = true) = 0;
238 virtual bool ignore_mouse_events(bool aConsiderAncestors = true) const = 0;
239 virtual void set_ignore_mouse_events(bool aIgnoreMouseEvents) = 0;
240 virtual bool ignore_non_client_mouse_events(bool aConsiderAncestors = true) const = 0;
241 virtual void set_ignore_non_client_mouse_events(bool aIgnoreNonClientMouseEvents) = 0;
243 virtual bool mouse_wheel_scrolled(mouse_wheel aWheel, const point& aPosition, delta aDelta, key_modifiers_e aKeyModifiers) = 0;
244 virtual void mouse_button_pressed(mouse_button aButton, const point& aPosition, key_modifiers_e aKeyModifiers) = 0;
245 virtual void mouse_button_double_clicked(mouse_button aButton, const point& aPosition, key_modifiers_e aKeyModifiers) = 0;
246 virtual void mouse_button_released(mouse_button aButton, const point& aPosition) = 0;
247 virtual void mouse_moved(const point& aPosition, key_modifiers_e aKeyModifiers) = 0;
248 virtual void mouse_entered(const point& aPosition) = 0;
249 virtual void mouse_left() = 0;
250 virtual point mouse_position() const = 0;
252 public:
253 virtual const i_widget& widget_for_mouse_event(const point& aPosition, bool aForHitTest = false) const = 0;
254 virtual i_widget& widget_for_mouse_event(const point& aPosition, bool aForHitTest = false) = 0;
255 // helpers
256 public:
257 template <typename WidgetType, typename... Args>
258 WidgetType& emplace(Args&&... args)
259 {
260 auto newWidget = std::make_shared<WidgetType>(std::forward<Args>(args)...);
261 add(newWidget);
262 return *newWidget;
263 }
264 public:
265 bool same_surface(const i_widget& aWidget) const
266 {
267 return has_surface() && aWidget.has_surface() &&
268 &surface() == &aWidget.surface();
269 }
270 bool same_real_surface(const i_widget& aWidget) const
271 {
272 return has_surface() && aWidget.has_surface() &&
273 &real_surface() == &aWidget.real_surface();
274 }
275 public:
276 bool is_parent_of(const i_widget& aWidget) const
277 {
278 return aWidget.has_parent() && &aWidget.parent() == this;
279 }
280 bool is_ancestor_of(const i_widget& aWidget) const
281 {
282 const i_widget* w = &aWidget;
283 while (w->has_parent())
284 {
285 w = &w->parent();
286 if (w == this)
287 return true;
288 }
289 return false;
290 }
291 bool is_descendent_of(const i_widget& aWidget) const
292 {
293 return aWidget.is_ancestor_of(*this);
294 }
295 bool is_sibling_of(const i_widget& aWidget) const
296 {
297 return has_parent() && aWidget.has_parent() && &parent() == &aWidget.parent();
298 }
299 ref_ptr<i_widget> remove(i_widget& aChild, bool aSingular = true)
300 {
302 remove(aChild, aSingular, ref);
303 return ref;
304 }
305 public:
307 {
308 if (has_parent())
310 }
312 {
313 if (has_parent())
314 parent().send_child_to_back(*this);
315 }
316 public:
317 point to_window_coordinates(const point& aClientCoordinates) const
318 {
319 return aClientCoordinates + non_client_rect().top_left();
320 }
321 rect to_window_coordinates(const rect& aClientCoordinates) const
322 {
323 return aClientCoordinates + non_client_rect().top_left();
324 }
325 point to_client_coordinates(const point& aWindowCoordinates) const
326 {
327 return aWindowCoordinates - non_client_rect().top_left();
328 }
329 rect to_client_coordinates(const rect& aWindowCoordinates) const
330 {
331 return aWindowCoordinates - non_client_rect().top_left();
332 }
333 public:
334 bool show()
335 {
336 return show(true);
337 }
338 bool hide()
339 {
340 return show(false);
341 }
342 bool enable()
343 {
344 return enable(true);
345 }
346 bool disable()
347 {
348 return enable(false);
349 }
350 public:
351 double transparency() const
352 {
353 return 1.0 - opacity();
354 }
355 void set_transparency(double aTransparency)
356 {
357 set_opacity(1.0 - aTransparency);
358 }
360 {
361 return 1.0 - background_opacity();
362 }
363 void set_background_transparency(double aTransparency)
364 {
365 set_background_opacity(1.0 - aTransparency);
366 }
368 {
369 return background_opacity() == 0.0;
370 }
372 {
373 i_widget const* w = this;
374 while (!w->has_background_color() && w->background_is_transparent() && w->has_parent())
375 w = &w->parent();
376 return w->background_color();
377 }
379 {
381 }
386 void set_background_color(const optional_color& aBackgroundColor = optional_color{})
387 {
388 set_palette_color(color_role::Background, aBackgroundColor);
389 }
391 {
393 }
398 void set_foreground_color(const optional_color& aForegroundColor = optional_color{})
399 {
400 set_palette_color(color_role::Foreground, aForegroundColor);
401 }
402 bool has_base_color() const
403 {
405 }
407 {
409 }
410 void set_base_color(const optional_color& aBaseColor = optional_color{})
411 {
413 }
422 void set_alternate_base_color(const optional_color& aAlternateBaseColor = optional_color{})
423 {
424 set_palette_color(color_role::AlternateBase, aAlternateBaseColor);
425 }
426 public:
439 };
440
441 // todo: make being a layout manager a property?
442 template <typename WidgetType, typename... OtherBases>
443 class layout_manager : public WidgetType, public OtherBases...
444 {
445 public:
446 typedef WidgetType widget_type;
447 public:
448 template <typename... Args>
449 layout_manager(Args&&... aArgs) :
450 widget_type{ std::forward<Args>(aArgs)... }
451 {
452 }
453 public:
454 bool is_managing_layout() const override
455 {
456 return true;
457 }
458 };
459}
point_type top_left() const
virtual const i_widget & as_widget() const =0
virtual bool enabled() const =0
virtual neogfx::color container_background_color() const =0
virtual const i_surface & real_surface() const =0
virtual void render(i_graphics_context &aGc) const =0
ref_ptr< i_widget > remove(i_widget &aChild, bool aSingular=true)
Definition i_widget.hpp:299
virtual void parent_moved()=0
bool same_real_surface(const i_widget &aWidget) const
Definition i_widget.hpp:270
virtual bool hidden() const =0
virtual rect update_rect() const =0
virtual neogfx::mouse_event_location mouse_event_location() const =0
virtual void set_singular(bool aSingular)=0
virtual bool ignore_non_client_mouse_events(bool aConsiderAncestors=true) const =0
virtual ~i_widget()=default
virtual neogfx::view const & view() const =0
virtual i_widget & before()=0
virtual double background_opacity() const =0
double background_transparency() const
Definition i_widget.hpp:359
virtual const i_widget & get_widget_at(const point &aPosition) const =0
virtual bool show(bool aVisible)=0
virtual const widget_list & children() const =0
virtual i_widget & parent()=0
virtual bool effectively_hidden() const =0
virtual rect non_client_rect() const =0
virtual void set_focus_policy(const optional_focus_policy &aFocusPolicy)=0
virtual const i_widget & widget_for_mouse_event(const point &aPosition, bool aForHitTest=false) const =0
virtual bool has_parent() const =0
virtual bool capturing() const =0
virtual bool has_root() const =0
virtual void resize(const size &aSize)=0
virtual const i_window & root() const =0
bool mouse_event_is_client() const
Definition i_widget.hpp:431
color effective_background_color() const
Definition i_widget.hpp:371
virtual size extents() const =0
virtual bool effectively_visible() const =0
virtual bool requires_update() const =0
virtual neogfx::logical_coordinate_system logical_coordinate_system() const =0
virtual void bring_child_to_front(const i_widget &aChild)=0
virtual void set_consider_ancestors_for_mouse_events(bool aConsiderAncestors=true)=0
virtual widget_list::const_iterator find(const i_widget &aChild, bool aThrowIfNotFound=true) const =0
virtual void set_palette(const i_palette &aPalette)=0
virtual const i_layout & parent_layout() const =0
rect to_window_coordinates(const rect &aClientCoordinates) const
Definition i_widget.hpp:321
virtual i_surface & real_surface()=0
virtual i_widget & widget_for_mouse_event(const point &aPosition, bool aForHitTest=false)=0
virtual void moved()=0
virtual void set_render_layer(const std::optional< layer_t > &aLayer)=0
virtual void set_capture(capture_reason aReason=capture_reason::Other, const optional_point &aPosition={})=0
virtual const neogfx::font & font() const =0
color background_color() const
Definition i_widget.hpp:382
virtual void paint_non_client_after(i_graphics_context &aGc) const =0
virtual bool has_children() const =0
virtual bool can_defer_layout() const =0
point to_client_coordinates(const point &aWindowCoordinates) const
Definition i_widget.hpp:325
virtual bool visible() const =0
color base_color() const
Definition i_widget.hpp:406
virtual bool mouse_wheel_scrolled(mouse_wheel aWheel, const point &aPosition, delta aDelta, key_modifiers_e aKeyModifiers)=0
virtual i_surface & surface()=0
virtual void set_opacity(double aOpacity)=0
virtual i_widget & get_widget_at(const point &aPosition)=0
virtual widget_part part(const point &aPosition) const =0
virtual layer_t render_layer() const =0
bool has_base_color() const
Definition i_widget.hpp:402
virtual bool has_logical_coordinate_system() const =0
virtual rect client_rect(bool aExtendIntoPadding=true) const =0
bool same_surface(const i_widget &aWidget) const
Definition i_widget.hpp:265
virtual const i_widget & layout_manager() const =0
virtual bool can_set_focus(focus_reason aFocusReason) const =0
virtual const optional_point & capture_position() const =0
virtual void focus_lost(focus_reason aFocusReason)=0
virtual bool is_surface() const =0
virtual neogfx::focus_policy focus_policy() const =0
virtual bool has_parent_layout() const =0
virtual widget_part hit_test(const point &aPosition) const =0
color alternate_base_color() const
Definition i_widget.hpp:418
virtual bool update(bool aIncludeNonClient=false)=0
virtual void remove(i_widget &aChild, bool aSingular, i_ref_ptr< i_widget > &aChildRef)=0
virtual void set_layout(const i_ref_ptr< i_layout > &aLayout, bool aMoveExistingItems=true)=0
virtual void set_layout(i_layout &aLayout, bool aMoveExistingItems=true)=0
virtual const i_widget & parent() const =0
void set_transparency(double aTransparency)
Definition i_widget.hpp:355
virtual bool child_has_focus() const =0
virtual bool part_active(widget_part aPart) const =0
void set_background_transparency(double aTransparency)
Definition i_widget.hpp:363
virtual i_layout & parent_layout()=0
virtual bool ready_to_render() const =0
virtual i_layout & layout()=0
rect to_client_coordinates(const rect &aWindowCoordinates) const
Definition i_widget.hpp:329
bool is_sibling_of(const i_widget &aWidget) const
Definition i_widget.hpp:295
virtual void resized()=0
virtual color palette_color(color_role aColorRole) const =0
virtual bool effectively_disabled() const =0
virtual void captured()=0
virtual void send_child_to_back(const i_widget &aChild)=0
virtual bool is_managing_layout() const =0
virtual bool resizing() const =0
virtual void release_capture(capture_reason aReason=capture_reason::Other)=0
bool handling_mouse_event() const
Definition i_widget.hpp:427
virtual void unlink()=0
virtual bool has_background_opacity() const =0
virtual void set_palette_color(color_role aColorRole, const optional_color &aColor)=0
virtual const i_surface & surface() const =0
virtual i_widget & after()=0
void set_base_color(const optional_color &aBaseColor=optional_color{})
Definition i_widget.hpp:410
virtual void mouse_moved(const point &aPosition, key_modifiers_e aKeyModifiers)=0
virtual void move(const point &aPosition)=0
virtual void mouse_button_pressed(mouse_button aButton, const point &aPosition, key_modifiers_e aKeyModifiers)=0
virtual rect default_clip_rect(bool aIncludeNonClient=false) const =0
virtual void mouse_button_double_clicked(mouse_button aButton, const point &aPosition, key_modifiers_e aKeyModifiers)=0
declare_event(device_metrics_updated, const i_widget &) declare_event(child_added
virtual bool has_font_role() const =0
virtual void parent_changed()=0
virtual bool ignore_mouse_events(bool aConsiderAncestors=true) const =0
virtual void layout_items_completed()=0
virtual bool effectively_enabled() const =0
i_widget i_graphics_context i_graphics_context const neogfx::non_client_mouse_event const neogfx::keyboard_event &declare_event(focus_event, neogfx::focus_event, focus_reason) public typedef neolib::i_vector< i_ref_ptr< i_widget > > widget_list
Definition i_widget.hpp:67
virtual void mouse_entered(const point &aPosition)=0
void set_alternate_base_color(const optional_color &aAlternateBaseColor=optional_color{})
Definition i_widget.hpp:422
virtual void set_parent(i_widget &aParent)=0
virtual i_widget & add(i_widget &aChild)=0
virtual widget_list::const_iterator last() const =0
virtual i_optional< neogfx::layout_reason > & layout_reason()=0
virtual bool consider_ancestors_for_mouse_events() const =0
virtual void focus_gained(focus_reason aFocusReason)=0
virtual void layout_items_started()=0
virtual bool can_capture() const =0
virtual void set_background_opacity(double aOpacity)=0
virtual widget_list::iterator find(const i_widget &aChild, bool aThrowIfNotFound=true)=0
virtual void set_ignore_mouse_events(bool aIgnoreMouseEvents)=0
virtual bool is_singular() const =0
point to_window_coordinates(const point &aClientCoordinates) const
Definition i_widget.hpp:317
virtual i_widget & layout_manager()=0
virtual double opacity() const =0
virtual bool can_update() const =0
bool background_is_transparent() const
Definition i_widget.hpp:367
virtual const i_widget & after() const =0
virtual neogfx::view & view()=0
virtual void non_client_set_capture()=0
virtual bool has_focus_policy() const =0
virtual const i_layout & layout() const =0
virtual void mouse_left()=0
virtual void non_client_release_capture()=0
bool has_background_color() const
Definition i_widget.hpp:378
color foreground_color() const
Definition i_widget.hpp:394
void set_background_color(const optional_color &aBackgroundColor=optional_color{})
Definition i_widget.hpp:386
virtual void paint_non_client(i_graphics_context &aGc) const =0
bool mouse_event_is_non_client() const
Definition i_widget.hpp:435
virtual bool disabled() const =0
virtual bool has_focus() const =0
virtual bool entered(bool aChildEntered=false) const =0
virtual bool has_palette() const =0
virtual void link_before(i_widget *aPreviousWidget)=0
virtual point mouse_position() const =0
virtual bool release_focus()=0
virtual void mouse_button_released(mouse_button aButton, const point &aPosition)=0
bool is_parent_of(const i_widget &aWidget) const
Definition i_widget.hpp:276
virtual void set_font_role(const optional_font_role &aFontRole)=0
virtual bool has_surface() const =0
virtual bool has_layout() const =0
virtual bool enable(bool aEnable)=0
virtual bool set_focus(focus_reason aFocusReason=focus_reason::Other)=0
virtual void link_after(i_widget *aNextWidget)=0
virtual bool adding_child() const =0
bool has_alternate_base_color() const
Definition i_widget.hpp:414
bool has_foreground_color() const
Definition i_widget.hpp:390
virtual void layout_items(bool aDefer=false)=0
virtual i_widget & add(const i_ref_ptr< i_widget > &aChild)=0
virtual bool is_root() const =0
virtual const i_palette & palette() const =0
WidgetType & emplace(Args &&... args)
Definition i_widget.hpp:258
virtual bool has_layout_manager() const =0
virtual bool has_palette_color(color_role aColorRole) const =0
virtual void remove_all()=0
bool is_descendent_of(const i_widget &aWidget) const
Definition i_widget.hpp:291
virtual void set_font(optional_font const &aFont)=0
virtual bool has_font() const =0
virtual neogfx::widget_type widget_type() const =0
virtual bool update(const rect &aUpdateRect)=0
void set_foreground_color(const optional_color &aForegroundColor=optional_color{})
Definition i_widget.hpp:398
double transparency() const
Definition i_widget.hpp:351
virtual void set_logical_coordinate_system(const optional_logical_coordinate_system &aLogicalCoordinateSystem)=0
virtual layer_t layer() const =0
void bring_to_front()
Definition i_widget.hpp:306
virtual void capture_released()=0
virtual void set_layer(layer_t aLayer)=0
virtual neogfx::mouse_cursor mouse_cursor() const =0
virtual i_window & root()=0
bool is_ancestor_of(const i_widget &aWidget) const
Definition i_widget.hpp:280
virtual neogfx::font_role font_role() const =0
virtual void set_ignore_non_client_mouse_events(bool aIgnoreNonClientMouseEvents)=0
virtual widget_list::iterator last()=0
virtual void set_root(i_window &aRoot)=0
virtual void paint(i_graphics_context &aGc) const =0
virtual const i_widget & before() const =0
virtual bool layout_items_in_progress() const =0
bool is_managing_layout() const override
Definition i_widget.hpp:454
layout_manager(Args &&... aArgs)
Definition i_widget.hpp:449
logical_coordinate_system
basic_mouse_event< mouse_event_location::NonClient > non_client_mouse_event
mouse_wheel
Definition i_mouse.hpp:42
layout_reason
Definition i_widget.hpp:43
mouse_button
Definition i_mouse.hpp:31
@ AlternateBase
Definition i_palette.hpp:36
@ Foreground
Definition i_palette.hpp:34
@ Background
Definition i_palette.hpp:33
Definition plf_hive.h:79
#define declare_event(declName,...)
Definition i_event.hpp:305