15#include <egt/detail/enum.h>
16#include <egt/detail/meta.h>
17#include <egt/detail/range.h>
21#include <egt/geometry.h>
22#include <egt/imagegroup.h>
23#include <egt/object.h>
24#include <egt/palette.h>
25#include <egt/screen.h>
26#include <egt/serialize.h>
27#include <egt/signal.h>
29#include <egt/widgetflags.h>
64 plane_window = detail::bit(0),
69 window = detail::bit(1),
74 frame = detail::bit(2),
83 disabled = detail::bit(3),
88 readonly = detail::bit(4),
100 active = detail::bit(5),
105 invisible = detail::bit(6),
114 grab_mouse = detail::bit(7),
121 no_clip = detail::bit(8),
126 no_layout = detail::bit(9),
131 no_autoresize = detail::bit(10),
136 checked = detail::bit(11),
141 component = detail::bit(12),
147 user_drag = detail::bit(13),
153 user_track_drag = detail::bit(14),
276 virtual
void resize(const
Size& size);
300 resize_by_ratio(ratio, ratio);
311 virtual void scale(
float hscale,
float vscale)
313 detail::ignoreparam(hscale);
314 detail::ignoreparam(vscale);
326 this->scale(scale, scale);
336 if (!parent_in_layout() && !in_layout())
337 m_user_requested_box.width(w);
339 resize(
Size(w, height()));
349 if (!parent_in_layout() && !in_layout())
350 m_user_requested_box.height(h);
352 resize(
Size(width(), h));
372 if (!parent_in_layout() && !in_layout())
373 m_user_requested_box.x(x);
385 if (!parent_in_layout() && !in_layout())
386 m_user_requested_box.y(y);
433 return !flags().
is_set(Widget::Flag::invisible);
475 return flags().
is_set(Widget::Flag::readonly);
496 readonly(!readonly());
517 return flags().
is_set(Widget::Flag::disabled);
550 return flags().
is_set(Widget::Flag::user_drag);
555 if (flags().is_set(Widget::Flag::user_drag) != value)
558 flags().
set(Widget::Flag::user_drag);
560 flags().
clear(Widget::Flag::user_drag);
566 return flags().
is_set(Widget::Flag::user_track_drag);
571 if (flags().is_set(Widget::Flag::user_track_drag) != value)
574 flags().
set(Widget::Flag::user_track_drag);
576 flags().
clear(Widget::Flag::user_track_drag);
585 return !m_widget_flags.is_set(Flag::readonly) &&
586 !m_widget_flags.is_set(Flag::invisible) &&
587 !m_widget_flags.is_set(Flag::disabled);
595 auto pos = display_to_local(point);
596 return local_box().intersect(pos);
640 EGT_NODISCARD
bool clip()
const;
733 return m_user_requested_box;
749 return box().point();
814 EGT_NODISCARD
bool has_palette()
const {
return (
bool)m_palette; }
871 bool allow_fallback =
false)
const;
910 EGT_NODISCARD
virtual bool has_screen()
const {
return false; }
938 if (detail::change_if_diff<>(m_padding, padding))
959 if (detail::change_if_diff<>(m_margin, margin))
980 if (detail::change_if_diff<>(m_border, border))
999 if (detail::change_if_diff<>(m_border_radius, radius))
1015 if (detail::change_if_diff<>(m_border_flags, flags))
1035 this->ratio(ratio, ratio);
1047 auto a = detail::change_if_diff<>(m_horizontal_ratio,
horizontal);
1048 auto b = detail::change_if_diff<>(m_vertical_ratio,
vertical);
1060 if (detail::change_if_diff<>(m_vertical_ratio,
vertical))
1076 if (detail::change_if_diff<>(m_horizontal_ratio,
horizontal))
1092 if (detail::change_if_diff<>(m_yratio, yratio))
1108 if (detail::change_if_diff<>(m_xratio, xratio))
1136 if (detail::change_if_diff<>(m_min_size, size))
1190 EGT_NODISCARD
bool focus()
const {
return m_focus; }
1206 if (detail::change_if_diff<>(m_fill_flags, flags))
1217 return m_fill_flags;
1227 return m_fill_flags;
1402 if (m_font && *m_font == font)
1405 m_font = std::make_unique<Font>(font);
1440 return flags().
is_set(Widget::Flag::checked);
1453 EGT_NODISCARD
virtual std::string
type()
const;
1520 virtual
void damage_from_subordinate(const
Rect& rect)
1527 detail::ignoreparam(subordinate);
1644 return m_special_child_draw_callback;
1664 m_special_child_draw_callback = std::move(func);
1678 if (m_special_child_draw_callback)
1679 m_special_child_draw_callback(painter, widget);
1733 EGT_NODISCARD
virtual bool top_level()
const {
return false; }
1776 bool track_drag()
const {
return internal_track_drag() || user_track_drag(); }
1820 bool m_in_layout{
false};
1864 return m_components;
1870 return m_components;
1884 m_children.
begin(m_subordinates.begin());
1885 m_children.
end(m_components_begin);
1886 m_components.
begin(m_components_begin);
1887 m_components.
end(m_subordinates.end());
1893 return widget.
component() ? components() : children();
1899 return widget.
component() ? components() : children();
1925 bool m_in_draw{
false};
1938 std::unique_ptr<Palette> m_palette;
1948 Widget::Flags m_widget_flags{};
1953 AlignFlags m_align{};
1968 float m_border_radius{};
1973 Theme::BorderFlags m_border_flags{};
2003 bool m_focus{
false};
2008 float m_alpha{1.0f};
2013 Theme::FillFlags m_fill_flags{};
2026 std::unique_ptr<Font> m_font;
2031 void deserialize(Serializer::Properties& props);
Alignment flags.
Definition widgetflags.h:379
Definition serialize.h:200
EGT_NODISCARD constexpr bool is_set(const T flag) const noexcept
Test if the specified flag is set.
Definition flagsbase.h:64
Utility class for managing a set of flags with the ability to observe changes to the flags.
Definition flags.h:40
bool clear(T flag) noexcept
Clear a single flag.
Definition flags.h:125
bool set(T flag) noexcept
Set a single flag.
Definition flags.h:107
Manages a font and properties of a font.
Definition font.h:35
A Frame is a Widget that has children widgets.
Definition frame.h:45
Definition imagegroup.h:25
Raster image resource used for drawing or displaying.
Definition image.h:39
Base object class with fundamental properties.
Definition object.h:32
Drawing interface for 2D graphics.
Definition painter.h:45
Color palette that contains a 2 dimensional array of colors.
Definition palette.h:40
GroupId
Used to define a category of patterns that usually relate to the state of a widget.
Definition palette.h:219
ColorId
The Pattern identifier in the Palette.
Definition palette.h:239
A Pattern which can store one or more colors at different offsets (steps) which can be used to create...
Definition pattern.h:55
EGT_NODISCARD constexpr const SizeType< Dim, DimCompat > & size() const noexcept
Get the SizeType of the rectangle.
Definition geometry.h:738
EGT_NODISCARD constexpr const PointType< Dim, DimCompat > & point() const noexcept
Get the PointType of the rectangle.
Definition geometry.h:722
Manages one of more buffers that make up a Screen.
Definition screen.h:34
std::vector< Rect > DamageArray
Type used for damage arrays.
Definition screen.h:40
Abstract base serializer class.
Definition serialize.h:34
std::list< std::tuple< std::string, std::string, Serializer::Attributes > > Properties
Definition serialize.h:47
Signal class used for defining a signal and dispatching events.
Definition signal.h:30
Customizable characteristics for drawing widgets.
Definition theme.h:146
Utility class to allow range loops from a subset of a container.
Definition range.h:26
void begin(typename T::iterator begin) noexcept
Definition range.h:30
void end(typename T::iterator end) noexcept
Definition range.h:50
EGT_API std::ostream & operator<<(std::ostream &os, const Color &color)
Overloaded std::ostream insertion operator.
int DefaultDim
Define the default dimension type used for geometry.
Definition geometry.h:34
EGT framework namespace.
Definition animation.h:24
A single event that has information about the event and state for the event.
Definition event.h:255
When using enum_to_string() and enum_from_string(), this type needs to be defined and specialized to ...
Definition enum.h:48