|
| Gauge (const Rect &rect={}, const Flags &flags={}) noexcept |
|
| Gauge (Frame &parent, const Rect &rect, const Flags &flags={}) noexcept |
|
| ~Gauge () noexcept override |
|
void | add (const std::shared_ptr< GaugeLayer > &layer) |
| Add a GaugeLayer to the Gauge. More...
|
|
template<class T > |
void | add (const std::shared_ptr< T > &widget) |
| Utility wrapper around add() More...
|
|
virtual void | add (const std::shared_ptr< Widget > &widget) |
| Add a child widget. More...
|
|
void | add (GaugeLayer &layer) |
| Add a GaugeLayer to the Gauge. More...
|
|
void | add (Widget &widget) |
| Add a child widget. More...
|
|
void | remove (GaugeLayer *layer) |
| Remove a layer from the gauge. More...
|
|
virtual void | remove (Widget *widget) |
| Remove a child widget. More...
|
|
| Frame (const Frame &)=delete |
|
| Frame (const Rect &rect={}, const Flags &flags={}) noexcept |
|
| Frame (Frame &&) noexcept=default |
|
| Frame (Frame &parent, const Rect &rect, const Flags &flags={}) noexcept |
|
| Frame (Serializer::Properties &props) noexcept |
|
| ~Frame () noexcept override |
|
template<class T > |
void | add (const std::shared_ptr< T > &widget) |
| Utility wrapper around add() More...
|
|
virtual void | add (const std::shared_ptr< Widget > &widget) |
| Add a child widget. More...
|
|
void | add (Widget &widget) |
| Add a child widget. More...
|
|
EGT_NODISCARD std::shared_ptr< Widget > | child_at (size_t index) const |
| Get a child widget at a specific index. More...
|
|
EGT_NODISCARD detail::Range< SubordinatesArray > & | children () |
| Return the array of child widgets. More...
|
|
EGT_NODISCARD const detail::Range< SubordinatesArray > | children () const |
| Return the array of child widgets. More...
|
|
EGT_NODISCARD size_t | count_children () const |
| Get the number of children widgets. More...
|
|
void | deserialize_children (const Deserializer &deserializer) override |
| Deserialize the children of this widget. More...
|
|
template<class T > |
std::shared_ptr< T > | find_child (const std::string &name) |
| Find a child Widget in the entire tree by name. More...
|
|
Widget * | hit_test (const DisplayPoint &point) |
| Get the widget under the given DisplayPoint. More...
|
|
bool | is_child (Widget *widget) const |
| Returns true if the child exists. More...
|
|
void | on_screen_resized () override |
| Overridden to be called recursively on all children. More...
|
|
Frame & | operator= (const Frame &)=delete |
|
Frame & | operator= (Frame &&) noexcept=default |
|
void | paint_children_to_file () |
| Paint individual children to file. More...
|
|
void | paint_to_file (const std::string &filename={}) override |
| Save the entire frame surface to a file. More...
|
|
virtual void | remove (Widget *widget) |
| Remove a child widget. More...
|
|
void | remove_all () |
| Remove all child widgets. More...
|
|
void | serialize (Serializer &serializer) const override |
| Serialize the widget to the specified serializer. More...
|
|
void | serialize_children (Serializer &serializer) const override |
| Serialize the widget's children to the specified serializer. More...
|
|
void | show () override |
| Show the Widget. More...
|
|
template<typename T , typename... Args> |
std::shared_ptr< T > | spawn (Args &&... args) |
| Create a child widget of the specified type. More...
|
|
EGT_NODISCARD ChildDrawCallback | special_child_draw_callback () const |
| Get the special child draw callback. More...
|
|
void | special_child_draw_callback (ChildDrawCallback func) |
| Set the special child draw callback. More...
|
|
EGT_NODISCARD ChildDrawCallback | special_child_draw_callback (Widget *parent) const |
| Get the child draw callback of the parent. More...
|
|
virtual EGT_NODISCARD Point | to_child (const Point &p) const |
|
EGT_NODISCARD Rect | to_child (Rect rect) const |
|
EGT_NODISCARD bool | top_level () const override |
| Return true if this is a top level frame, with no parent. More...
|
|
void | walk (const WalkCallback &callback, int level=0) override |
| Walk the Widget tree and call callback with each Widget. More...
|
|
virtual EGT_NODISCARD size_t | zorder () const |
| Get the zorder of the widget. More...
|
|
size_t | zorder (const Widget *widget) const |
| Get the zorder of the widget. More...
|
|
void | zorder (const Widget *widget, size_t rank) |
| Set the zorder of the widget. More...
|
|
virtual void | zorder (size_t rank) |
| Set the zorder of the widget. More...
|
|
virtual void | zorder_bottom () |
| Move the widget to the bottom. More...
|
|
void | zorder_bottom (const Widget *widget) |
| Move the specified widget zorder to the bottom of the current list of widgets with the same parent. More...
|
|
virtual void | zorder_down () |
| Move this widgets zorder down relative to other widgets with the same parent. More...
|
|
void | zorder_down (const Widget *widget) |
| Move the specified widget zorder down relative to other widgets with the same parent. More...
|
|
virtual void | zorder_top () |
| Move the widget to the top. More...
|
|
void | zorder_top (const Widget *widget) |
| Move the specified widget zorder to the top of the current list of widgets with the same parent. More...
|
|
virtual void | zorder_up () |
| Move this widgets zorder up relative to other widgets with the same parent. More...
|
|
void | zorder_up (const Widget *widget) |
| Move the specified widget zorder up relative to other widgets with the same parent. More...
|
|
| Widget (const Rect &rect={}, const Widget::Flags &flags={}) noexcept |
|
| Widget (const Widget &)=delete |
|
| Widget (Frame &parent, const Rect &rect={}, const Widget::Flags &flags={}) noexcept |
|
| Widget (Serializer::Properties &props) noexcept |
|
| Widget (Widget &&) noexcept=default |
|
| ~Widget () noexcept override |
|
EGT_NODISCARD bool | active () const |
| Get the active state. More...
|
|
void | active (bool value) |
| Set the active state. More...
|
|
AlignFlags & | align () |
| Get the alignment. More...
|
|
EGT_NODISCARD const AlignFlags & | align () const |
| Get the alignment. More...
|
|
void | align (const AlignFlags &a) |
| Align the widget. More...
|
|
EGT_NODISCARD float | alpha () const |
| Get the alpha property. More...
|
|
void | alpha (float alpha) |
| Set the alpha property. More...
|
|
EGT_NODISCARD bool | autoresize () const |
| Return the autoresize state of the widget. More...
|
|
void | autoresize (bool value) |
| Set the autoresize state. More...
|
|
EGT_NODISCARD DefaultDim | border () const |
| Get the border width. More...
|
|
void | border (DefaultDim border) |
| Set the border width. More...
|
|
EGT_NODISCARD Theme::BorderFlags | border_flags () const |
| Get the border flags. More...
|
|
void | border_flags (const Theme::BorderFlags &flags) |
| Set the border flags. More...
|
|
EGT_NODISCARD float | border_radius () const |
| Get the border radius. More...
|
|
void | border_radius (float radius) |
| Set the border radius. More...
|
|
EGT_NODISCARD const Rect & | box () const |
| Bounding box for the Widget. More...
|
|
void | box (const Rect &rect) |
| Change the bounding box of the widget. More...
|
|
bool | can_handle_event () const |
| Returns true if the widget is capable of handling an event. More...
|
|
EGT_NODISCARD Point | center () const |
| Get the center point of the widget's box(). More...
|
|
EGT_NODISCARD bool | checked () const |
| Get the boolean checked state of the a widget. More...
|
|
virtual void | checked (bool value) |
| Set the checked state of the widget. More...
|
|
EGT_NODISCARD bool | clip () const |
| Return the clip state of the widget. More...
|
|
EGT_NODISCARD const Pattern & | color (Palette::ColorId id) const |
| Get a Widget color. More...
|
|
void | color (Palette::ColorId id, const Pattern &color, Palette::GroupId group=Palette::GroupId::normal) |
| Add a color to the widget's instance palette. More...
|
|
EGT_NODISCARD const Pattern & | color (Palette::ColorId id, Palette::GroupId group) const |
| Get a Widget color. More...
|
|
virtual EGT_NODISCARD Rect | content_area () const |
| Return the area that content is allowed to be positioned into. More...
|
|
virtual void | damage () |
| Damage the box() of the widget and cause a redraw. More...
|
|
virtual void | damage (const Rect &rect) |
| Mark the specified rect as a damaged area of the widget. More...
|
|
void | detach () |
| Detach this widget from its parent. More...
|
|
void | disable () |
| Set the disabled state to true. More...
|
|
void | disable_toggle () |
| Toggle the disabled state. More...
|
|
EGT_NODISCARD bool | disabled () const |
| Return the disabled state of the widget. More...
|
|
void | disabled (bool value) |
| Set the disabled state. More...
|
|
DisplayPoint | display_origin () |
| Get the display origin of the Widget. More...
|
|
virtual Point | display_to_local (const DisplayPoint &p) |
| Convert a display point to a local point. More...
|
|
virtual void | draw (Painter &painter, const Rect &rect) |
| Draw the widget. More...
|
|
void | draw_box (Painter &painter, Palette::ColorId bg, Palette::ColorId border) const |
| Helper function to draw this widget's box using the appropriate theme. More...
|
|
void | draw_circle (Painter &painter, Palette::ColorId bg, Palette::ColorId border) const |
| Helper function to draw this widget's circle using the appropriate theme. More...
|
|
void | enable () |
| Set the disabled state to false. More...
|
|
Theme::FillFlags & | fill_flags () |
| Get a modifiable fill flags reference. More...
|
|
EGT_NODISCARD const Theme::FillFlags & | fill_flags () const |
| Get the fill flags. More...
|
|
void | fill_flags (const Theme::FillFlags &flags) |
| Set the fill flags. More...
|
|
EGT_NODISCARD bool | focus () const |
| Get the current focus state. More...
|
|
void | focus (bool value) |
| Set the focus state. More...
|
|
EGT_NODISCARD const Font & | font () const |
| Get the widget Font. More...
|
|
void | font (const Font &font) |
| Set the widget Font. More...
|
|
EGT_NODISCARD bool | frame () const |
| Return the frame state of the widget. More...
|
|
EGT_NODISCARD bool | grab_mouse () const |
| Return the grab_mouse state of the widget. More...
|
|
void | grab_mouse (bool value) |
| Set the grab_mouse state. More...
|
|
virtual void | handle (Event &event) |
| Handle an event. More...
|
|
bool | has_font () const |
| Check whether the widget has a custom Font. More...
|
|
EGT_NODISCARD bool | has_palette () const |
| Check whether the widget has a custom palette. More...
|
|
EGT_NODISCARD DefaultDim | height () const |
| Height of the widget's box(). More...
|
|
void | height (DefaultDim h) |
| Change the height. More...
|
|
virtual void | hide () |
| Hide the Widget. More...
|
|
EGT_NODISCARD DefaultDim | horizontal_ratio () const |
| Get the horizontal ratio relative to parent. More...
|
|
void | horizontal_ratio (DefaultDim horizontal) |
| Set the horizontal ratio relative to parent. More...
|
|
EGT_NODISCARD bool | in_layout () const |
| Indicate if the Widget is computing the layout or not. More...
|
|
virtual void | layout () |
| Perform layout of the Widget. More...
|
|
DisplayPoint | local_to_display (const Point &p) |
| Convert a local point to a display point. More...
|
|
EGT_NODISCARD DefaultDim | margin () const |
| Get the margin width. More...
|
|
void | margin (DefaultDim margin) |
| Set the margin width. More...
|
|
virtual EGT_NODISCARD Size | min_size_hint () const |
| Get a minimum size hint for the Widget. More...
|
|
void | min_size_hint (const Size &size) |
| Set the minimum size hint for the Widget. More...
|
|
EGT_NODISCARD size_t | moat () const |
| Get the sum of the margin(), padding(), and border() around the content of the widget. More...
|
|
virtual void | move (const Point &point) |
| Move the Widget to a new position. More...
|
|
void | move_to_center () |
| Move the widget to the center of its parent. More...
|
|
void | move_to_center (const Point &point) |
| Move the widget to the specified center point. More...
|
|
EGT_NODISCARD bool | no_layout () const |
| Return the no_layout state of the widget. More...
|
|
void | no_layout (bool value) |
| Set the no_layout state. More...
|
|
Widget & | operator= (const Widget &)=delete |
|
Widget & | operator= (Widget &&) noexcept=default |
|
EGT_NODISCARD DefaultDim | padding () const |
| Return the padding width. More...
|
|
void | padding (DefaultDim padding) |
| Set the padding width. More...
|
|
virtual void | paint (Painter &painter) |
| Paint the Widget using a Painter. More...
|
|
EGT_NODISCARD const Palette & | palette () const |
| Get the widget palette. More...
|
|
void | palette (const Palette &palette) |
| Set the widget instance Palette. More...
|
|
Widget * | parent () |
| Get a pointer to the parent Widget, or nullptr if none exists. More...
|
|
EGT_NODISCARD const Widget * | parent () const |
| Get a pointer to the parent Widget, or nullptr if none exists. More...
|
|
EGT_NODISCARD bool | plane_window () const |
| Return the plane_window state of the widget. More...
|
|
EGT_NODISCARD const Point & | point () const |
| Get the origin of the widget's box(). More...
|
|
virtual void | post_deserialize (Serializer::Properties &props) |
| Resume deserializing of the widget after its children have been deserialized. More...
|
|
void | ratio (DefaultDim horizontal, DefaultDim vertical) |
| Set the size ratio relative to parent. More...
|
|
void | ratio (DefaultDim ratio) |
| Set the size ratio relative to parent. More...
|
|
EGT_NODISCARD bool | readonly () const |
| Get the readonly state of the widget. More...
|
|
void | readonly (bool value) |
| Set the readonly state of the widget. More...
|
|
void | readonly_toggle () |
| Toggle the readonly state. More...
|
|
void | reset_font () |
| Reset the widget's Font. More...
|
|
void | reset_palette () |
| Clear the widget instance palette. More...
|
|
virtual void | resize (const Size &size) |
| Resize the widget. More...
|
|
void | resize_by_ratio (DefaultDim hratio, DefaultDim vratio) |
| Scale the current size of the Widget given the ratio. More...
|
|
void | resize_by_ratio (DefaultDim ratio) |
| Scale the current size of the Widget given the ratio. More...
|
|
virtual void | scale (float hscale, float vscale) |
| Set the scale of the widget. More...
|
|
void | scale (float scale) |
| Set the scale of the widget. More...
|
|
virtual EGT_NODISCARD Screen * | screen () const |
| Get a pointer to the Screen instance, using using a parent as necessary. More...
|
|
EGT_NODISCARD const Size & | size () const |
| Get the size of the widget's box(). More...
|
|
EGT_NODISCARD const Theme & | theme () const |
| Get the Widget Theme. More...
|
|
EGT_NODISCARD Point | to_parent (const Point &r) const |
| Convert a point with a local origin to a parent origin. More...
|
|
EGT_NODISCARD Rect | to_parent (const Rect &r) const |
| Convert a point in a rect a local origin to a parent origin. More...
|
|
virtual EGT_NODISCARD std::string | type () const |
| Returns a string representation of the type of this widget. More...
|
|
EGT_NODISCARD const Rect & | user_requested_box () const |
| Get the box corresponding to the user requested one, not the actual one. More...
|
|
EGT_NODISCARD DefaultDim | vertical_ratio () const |
| Get the vertical ratio relative to parent. More...
|
|
void | vertical_ratio (DefaultDim vertical) |
| Set the vertical ratio relative to parent. More...
|
|
EGT_NODISCARD bool | visible () const |
| Get the visible state of the widget. More...
|
|
void | visible (bool value) |
| Set the visible state. More...
|
|
void | visible_toggle () |
| Toggle the visibility state. More...
|
|
EGT_NODISCARD WidgetId | widgetid () const |
| Get the unique id of the widget. More...
|
|
EGT_NODISCARD DefaultDim | width () const |
| Width of the widget's box(). More...
|
|
void | width (DefaultDim w) |
| Change the width. More...
|
|
EGT_NODISCARD DefaultDim | x () const |
| X coordinate of the widget's box(). More...
|
|
void | x (DefaultDim x) |
| Set the X coordinate of the box. More...
|
|
EGT_NODISCARD DefaultDim | xratio () const |
| Get the X position ratio relative to parent. More...
|
|
void | xratio (DefaultDim xratio) |
| Set the X position ratio relative to parent. More...
|
|
EGT_NODISCARD DefaultDim | y () const |
| Y coordinate of the widget's box(). More...
|
|
void | y (DefaultDim y) |
| Set the Y coordinate of the box. More...
|
|
EGT_NODISCARD DefaultDim | yratio () const |
| Get the Y position ratio relative to parent. More...
|
|
void | yratio (DefaultDim yratio) |
| Set the Y position ratio relative to parent. More...
|
|
virtual EGT_NODISCARD size_t | zorder () const |
| Get the zorder of the widget. More...
|
|
virtual void | zorder (size_t rank) |
| Set the zorder of the widget. More...
|
|
| Object () noexcept=default |
|
| Object (const Object &)=delete |
|
| Object (Object &&)=default |
|
virtual | ~Object () noexcept=default |
|
void | clear_handlers () |
| Clear all registered event handlers. More...
|
|
void | invoke_handlers (Event &event) |
| Invoke all handlers with the specified event. More...
|
|
void | invoke_handlers (EventId event) |
| Invoke all handlers with the specified EventId. More...
|
|
EGT_NODISCARD const std::string & | name () const |
| Get the name of the Object. More...
|
|
void | name (const std::string &name) |
| Set the name of the Object. More...
|
|
RegisterHandle | on_event (const EventCallback &handler, const FilterFlags &mask={}) |
| Add an event handler to be called when the widget generates an event. More...
|
|
Object & | operator= (const Object &)=delete |
|
Object & | operator= (Object &&)=default |
|
void | remove_handler (RegisterHandle handle) |
| Remove an event handler. More...
|
|
A Gauge Widget that is composed of GaugeLayer layers.
In its simplest form, gauge layers are created using an Image. The images can come from SVG files or other image file types, or even individual elements of an SVG file using the SvgImage class.
Creating a simple gauge with a base layer and a needle layer, from a single SVG file is possible.
SvgImage custom1svg(
"gauge.svg",
SizeF(200, 0));
auto custom1_background = make_shared<GaugeLayer>(custom1svg.id("#base"));
custom1.add_layer(custom1_background);
auto custom1_needle = make_shared<NeedleLayer>(custom1svg.id("#needle"),
0, 100, 0, 180);
auto custom1_needle_point = custom1svg.id_box("#needlepoint").center();
custom1_needle->needle_point(custom1_needle_point);
custom1_needle->needle_center(custom1_needle_point);
custom1.add_layer(custom1_needle);
Gauge(const Rect &rect={}, const Flags &flags={}) noexcept
SizeType< float, detail::Compatible::normal > SizeF
Helper type alias.
Definition: geometry.h:575
A GaugeLayer is actually a special Widget. So, you can control its properties just like any other widget and handle events from it as well.
Some excellent tutorials can be found online for creating your own gauges using Inkscape. Of course, any tool that can create standard SVG files works just as well.