10#include "structure/design_pattern/spk_activable_object.hpp"
11#include "structure/design_pattern/spk_inherence_object.hpp"
13#include "structure/graphics/spk_extend_2d.hpp"
15#include "structure/system/event/spk_keyboard_event.hpp"
16#include "structure/system/event/spk_mouse_event.hpp"
17#include "structure/system/event/spk_paint_event.hpp"
18#include "structure/system/event/spk_system_event.hpp"
19#include "structure/system/event/spk_update_event.hpp"
21#include "structure/opengl/spk_view_region.hpp"
23#include "structure/widget/spk_resizable_element.hpp"
25#include "structure/graphics/spk_font.hpp"
26#include "structure/graphics/spk_sprite_sheet.hpp"
28#include "structure/graphics/painter/spk_texture_painter.hpp"
97 static inline std::array<Widget *, NbFocusType> _focusedWidgets = {
nullptr,
nullptr};
138 template <
typename TEvent>
139 using EventHandler = void (
Widget::*)(TEvent &);
141 template <
typename TEvent>
142 void _propagateEvent(TEvent &p_event, EventHandler<TEvent> p_onEventHandler, EventHandler<TEvent> p_childHandler)
144 if (
isActive() ==
false || p_event.isConsumed ==
true)
151 if (child !=
nullptr)
153 (child->*p_childHandler)(p_event);
155 if (p_event.isConsumed ==
true)
162 if (p_event.isConsumed ==
true)
167 (this->*p_onEventHandler)(p_event);
173 bool _isViewRegionUpdatePending =
false;
174 spk::Vector2 _anchorRatio = {0.0f, 0.0f};
175 spk::Vector2 _sizeRatio = {1.0f, 1.0f};
176 spk::OpenGL::ViewRegion _viewRegion;
177 spk::Extend2D _geometry = {{0.0f, 0.0f}, {0.0f, 0.0f}};
179 std::recursive_mutex _geometryEditionMutex;
181 spk::OpenGL::FrameBufferObject _fbo;
183 spk::TexturePainter _painter;
184 spk::TextureMesh _fboMesh;
188 void _computeRatio();
190 void _sortChildByLayer();
213 const float &
layer()
const;
219 void setLayer(
const float &p_newLayer);
225 const std::wstring &
name()
const;
231 void setName(
const std::wstring &p_name);
238 void setGeometry(
const spk::Extend2D &p_geometry)
override;
244 const spk::Extend2D &
geometry()
const;
250 const spk::OpenGL::ViewRegion &
viewRegion()
const;
263 const spk::OpenGL::FrameBufferObject &
fbo()
const;
383 friend class Module::KeyboardModule;
384 friend class Module::MouseModule;
385 friend class Module::SystemModule;
386 friend class Module::UpdateModule;
387 friend class Module::PaintModule;
389 void _handlePaintEvent(spk::PaintEvent &p_event);
391 void _handleKeyPressEvent(spk::KeyPressEvent &p_event);
393 void _handleKeyReleaseEvent(spk::KeyReleaseEvent &p_event);
395 void _handleGlyphEvent(spk::GlyphEvent &p_event);
397 void _handleMousePressEvent(spk::MousePressEvent &p_event);
399 void _handleMouseReleaseEvent(spk::MouseReleaseEvent &p_event);
401 void _handleMouseDoubleClickEvent(spk::MouseDoubleClickEvent &p_event);
403 void _handleMouseMotionEvent(spk::MouseMotionEvent &p_event);
405 void _handleMouseWheelEvent(spk::MouseWheelEvent &p_event);
407 void _handleEnterResizeModeEvent(spk::EnterResizeModeEvent &p_event);
409 void _handleResizeEvent(spk::ResizeEvent &p_event);
411 void _handleExitResizeModeEvent(spk::ExitResizeModeEvent &p_event);
413 void _handleQuitEvent(spk::QuitEvent &p_event);
415 void _handleMoveEvent(spk::MoveEvent &p_event);
417 void _handleFullScreenModeEvent(spk::FullScreenModeEvent &p_event);
419 void _handleMaximizedModeEvent(spk::MaximizedModeEvent &p_event);
421 void _handleFocusEvent(spk::FocusEvent &p_event);
423 void _handleUpdateEvent(spk::UpdateEvent &p_event);
ActivableObject()
Builds a deactivated object.
Definition spk_activable_object.hpp:35
bool isActive() const
Checks whether the object is currently activated.
Definition spk_activable_object.hpp:77
Loads font data and provides cached bitmap atlases per size.
Definition spk_font.hpp:33
virtual std::vector< Widget * > & children()
Definition spk_inherence_object.hpp:94
Dispatches keyboard events to a bound widget and tracks keyboard state.
Definition spk_keyboard_module.hpp:23
Dispatches mouse events to a bound widget and tracks mouse state.
Definition spk_mouse_module.hpp:23
Forwards paint events to the bound widget.
Definition spk_paint_module.hpp:17
Handles system-level events (creation, resize, quit) for the application and its widget tree.
Definition spk_system_module.hpp:18
Forwards update ticks to the bound widget.
Definition spk_update_module.hpp:17
Loads an image and exposes individual sprite regions.
Definition spk_sprite_sheet.hpp:21
Defines glyph and outline sizes for a font bitmap.
Definition spk_font.hpp:40