libwtk-sdl2  0.0.1
Public Member Functions | List of all members
slider Struct Reference
Inheritance diagram for slider:
Inheritance graph
[legend]
Collaboration diagram for slider:
Collaboration graph
[legend]

Public Member Functions

 slider (int start, int end, int num_steps, std::function< void(int)> value_callback)
 
 slider (int start, int end, std::function< void(int)> value_callback)
 
void on_draw (draw_context &dc, selection_context const &sc) const override
 
void on_mouse_up_event (mouse_up_event const &e) override
 
void on_mouse_down_event (mouse_down_event const &e) override
 
void on_mouse_move_event (mouse_move_event const &e) override
 
void on_key_event (key_event const &e) override
 
void on_box_allocated () override
 
size_hint get_size_hint (int width, int height) const override
 
Slider Interface
void set_step_interval (int n)
 
int get_step_interval () const
 
int get_value () const
 
- Public Member Functions inherited from selectable
widgetfind_selectable (navigation_type nt, point center) override
 
widgetnavigate_selectable (navigation_type nt, point center) override
 
void on_select () override
 
void on_unselect () override
 
- Public Member Functions inherited from widget
 widget (widget const &)=delete
 
widgetoperator= (widget const &)=delete
 
SDL_Rect const & get_box () const
 
context_info const & get_context_info () const
 
void set_context_info (context_info const &ci)
 
void set_parent (widget *parent)
 
virtual std::vector< widget * > get_children ()
 
virtual std::vector< widget const * > get_children () const
 
virtual void on_child_dirty (widget *child)
 
virtual std::vector< widget * > get_visible_children ()
 
virtual std::vector< widget const * > get_visible_children () const
 
void clear_dirty ()
 
void mark_dirty ()
 
void mark_child_dirty (widget *child)
 
void draw (draw_context &dc, selection_context const &sc) const
 
void draw_dirty (draw_context &dc, selection_context const &sc) const
 
virtual void on_activate ()
 
void apply_layout (SDL_Rect box)
 
virtual bool can_use_intermediate_size () const
 
virtual widgetnavigate_selectable_from_children (navigation_type nt, widget *w, point center)
 

Additional Inherited Members

- Protected Member Functions inherited from widget
std::optional< swipe_infoget_swipe_info_with_context_info (mouse_up_event const &e)
 
widgetnavigate_selectable_parent (navigation_type nt, point center)
 
- Protected Attributes inherited from widget
widget_parent
 

Constructor & Destructor Documentation

◆ slider() [1/2]

slider::slider ( int  start,
int  end,
int  num_steps,
std::function< void(int)>  value_callback 
)

Create a slider that selects an integer interval with num_step steps starting with intervals from start up or down to end.

Be careful when specifying num_steps, as it uses integer division, so the result might not work properly. E.g., when choosing start as 0 and end as 10 the correct number of steps is 11.

◆ slider() [2/2]

slider::slider ( int  start,
int  end,
std::function< void(int)>  value_callback 
)

Create a slider that selects an integer interval with num_step steps starting with intervals from start up or down to end. This constructor will always construct intervals with length 1.

Member Function Documentation

◆ get_size_hint()

size_hint slider::get_size_hint ( int  width,
int  height 
) const
overridevirtual

Computes the widgets preferred minimal and natural size. When given a specific width or height the widget might use that to give a more accurate size.

Implements widget.

◆ get_value()

int slider::get_value ( ) const

Returns the starting value of the currently selected interval.

◆ on_box_allocated()

void slider::on_box_allocated ( )
overridevirtual

Refresh layout with existing box. This should not be called if the widget does not have a box already. Otherwise no space is allocated.

Reimplemented from widget.

◆ on_draw()

void slider::on_draw ( draw_context dc,
selection_context const &  sc 
) const
overridevirtual

Draw the widget. No children should be drawn here.

Implements widget.

◆ set_step_interval()

void slider::set_step_interval ( int  n)

Set the slider to the interval with index n.


The documentation for this struct was generated from the following file: