|
| | Slider () |
| | Default constructor.
|
| |
| bool | adjusts_left_right () const |
| | Whether left and right change the value right now, without editing.
|
| |
| bool | is_editing () const |
| | Whether the slider is in edit mode.
|
| |
| const SliderStyle & | get_style (const Context &ctx) const |
| | Get the style this slider draws with.
|
| |
| void | set_value (float v) |
| | Set the value without calling on_change.
|
| |
| void | activate (Context &ctx) override |
| | Enter or leave edit mode when left and right move focus.
|
| |
| void | on_focus_changed (Context &ctx, bool focused) override |
| | Leave edit mode when focus moves away.
|
| |
| bool | on_event (Context &ctx, const UIEvent &e) override |
| | Handle dragging and left and right while focused.
|
| |
| void | draw (Context &ctx) override |
| | Draw the slider.
|
| |
| | Widget () |
| | Default constructor for Widget.
|
| |
| virtual | ~Widget ()=default |
| | Default virtual destructor.
|
| |
| | Widget (Widget &&other) noexcept |
| | Move constructor. The children move over and point to the new widget as their parent. The new widget gets its own id and no parent, since it is not in the old parent's children. Removed children stay with the old widget, which is where Root finds and frees them.
|
| |
| Widget & | operator= (Widget &&other) noexcept |
| | Move assignment operator. The children move over and point to this widget as their parent. This widget keeps its place in the tree: its parent, id and state. Its old children are removed as by clear_children. Removed children of the other widget stay with it.
|
| |
| | Widget (const Widget &)=delete |
| |
| Widget & | operator= (const Widget &)=delete |
| |
| WidgetId | id () const |
| | Get the unique identifier for this widget.
|
| |
| const std::vector< std::unique_ptr< Widget > > & | children () const |
| | Get the child widgets. Change them with add_child, remove_child and clear_children, which keep removed widgets alive until Root is done with them.
|
| |
| virtual void | measure (Context &ctx) |
| | Set this widget's own size, before its parent places it. Does nothing by default.
|
| |
| virtual void | layout (Context &ctx) |
| | Lay out this widget and its children.
|
| |
| template<class T , class... Args> |
| T & | add_child (Args &&... args) |
| | Add a child widget.
|
| |
| bool | remove_child (const Widget &child) |
| | Remove a child widget. It leaves the tree now and is destroyed at the next Root::update, so a callback can remove any widget, even the one it runs in.
|
| |
| void | clear_children () |
| | Remove every child widget, destroyed as for remove_child.
|
| |
| bool | is_hovered () const |
| | Whether the pointer is currently over this widget.
|
| |
| bool | is_pressed () const |
| | Whether this widget is currently being pressed.
|
| |
| bool | is_focused () const |
| | Whether this widget currently holds focus.
|
| |
| bool | is_captured () const |
| | Whether this widget was pressed and the pointer is still held, even if it has moved off the widget.
|
| |
| bool | is_highlighted (const Context &ctx) const |
| | Whether to draw the hover look: hovered, pressed, or focused while focus is shown.
|
| |
|
| float | value = 0.0F |
| | Current value.
|
| |
| float | min = 0.0F |
| | Smallest value.
|
| |
| float | max = 1.0F |
| | Largest value.
|
| |
| float | step = 0.1F |
| | Change per left or right press. Dragging snaps to it when snap is set.
|
| |
| bool | snap = false |
| | Snap dragged values to step.
|
| |
| std::function< void(float)> | on_change |
| | Callback invoked with the new value when the user changes it.
|
| |
| std::optional< bool > | adjust_on_left_right |
| | Whether left and right change the value without editing first. Empty to decide from the layout: off in a row with other focusable widgets, on otherwise.
|
| |
| std::optional< SliderStyle > | style |
| | Style for this slider only. Uses the theme slider style when empty.
|
| |
| bool | visible = true |
| | Whether the widget is visible.
|
| |
| bool | enabled = true |
| | Whether the widget is enabled.
|
| |
| bool | focusable = false |
| | Whether the widget can receive focus. Focusable widgets are also the ones the pointer can press.
|
| |
| Widget * | nav_up = nullptr |
| | Widget to focus on up, instead of the nearest one. Optional.
|
| |
| Widget * | nav_down = nullptr |
| | Widget to focus on down, instead of the nearest one. Optional.
|
| |
| Widget * | nav_left = nullptr |
| | Widget to focus on left, instead of the nearest one. Optional.
|
| |
| Widget * | nav_right = nullptr |
| | Widget to focus on right, instead of the nearest one. Optional.
|
| |
| bool | focus_ring = true |
| | Draw the theme focus ring around this widget while it has visible focus. Turn off for widgets that show focus themselves.
|
| |
| Widget * | parent = nullptr |
| | Pointer to the parent widget.
|
| |
| asw::Quad< float > | transform |
| | The transform (position and size) of the widget.
|
| |
| Anchor | anchor = Anchor::None |
| | Pin this widget to a point of its parent, e.g. BottomRight for a corner button. The parent places it on every layout, so it stays in place when the screen or its own size changes. Stack and Grid place their children themselves and ignore it.
|
| |
| asw::Vec2< float > | anchor_margin { 0.0F, 0.0F } |
| | Space between an anchored widget and the parent's edges.
|
| |
A horizontal slider for a value between min and max, e.g. volume.
Drag or click the track to set the value. While focused, left and right move it by step and up and down move focus. In a row with other focusable widgets left and right move focus instead: activate the slider to edit it with left and right, then activate or go back to finish.
Definition at line 27 of file slider.h.