106 virtual void set_active(
const bool active)
override;
112 virtual unsigned get_state()
const override;
Base class for a scroll bar.
int item_position_
The item the positioner is at, starts at 0.
point drag_initial_mouse_
The position the mouse was when draggin the slider was started.
unsigned slider_get_item_count() const
virtual int positioner_length() const =0
Updates the positioner.
void set_state(const state_t state)
bool at_end() const
Is the positioner at the and of the slider?
virtual unsigned offset_after() const =0
The number of pixels we can't use since they're used for borders.
unsigned slider_get_item_last() const
void signal_handler_mouse_enter(const event::ui_event event, bool &handled, bool &halt)
state_t
Possible states of the widget.
void recalculate_positioner()
virtual int get_length_difference(const point &original, const point ¤t) const =0
Gets the relevant difference in between the two positions.
bool at_begin() const
Is the positioner at the beginning of the slider?
int drag_initial_offset_
The offset in pixels the slider was when dragging the positioner was started.
virtual void update_canvas() override
See styled_widget::update_canvas.
void signal_handler_left_button_up(const event::ui_event event, bool &handled)
virtual void set_active(const bool active) override
See styled_widget::set_active.
int positioner_offset_
The start offset of the positioner.
void recalculate()
Updates the slider.
virtual bool on_positioner(const point &coordinate) const =0
Is the coordinate on the positioner?
bool snap_
Whether the slider should 'snap' into its supported values or not.
void signal_handler_mouse_motion(const event::ui_event event, bool &handled, bool &halt, const point &coordinate)
scroll_mode
scroll 'step size'.
@ ITEM_FORWARD
Go one item towards the end.
@ HALF_JUMP_BACKWARDS
Go half the visible items towards the begin.
@ ITEM_BACKWARDS
Go one item towards the begin.
@ JUMP_BACKWARDS
Go the visible items towards the begin.
@ JUMP_FORWARD
Go the visible items towards the end.
@ BEGIN
Go to begin position.
@ HALF_JUMP_FORWARD
Go half the visible items towards the end.
@ END
Go to the end position.
virtual unsigned get_state() const override
See styled_widget::get_state.
slider_base(const implementation::builder_styled_widget &builder, const std::string &control_type)
int item_last_
one less than the number items the slider 'holds'.
unsigned get_positioner_offset() const
void move_positioner(int offset)
Moves the positioner.
virtual bool get_active() const override
See styled_widget::get_active.
void signal_handler_mouse_leave(const event::ui_event event, bool &handled)
state_t state_
Current state of the widget.
unsigned get_slider_position() const
virtual unsigned offset_before() const =0
The number of pixels we can't use since they're used for borders.
void signal_handler_left_button_down(const event::ui_event event, bool &handled)
int positioner_length_
The current length of the positioner.
void slider_set_item_last(const unsigned item_last)
virtual void child_callback_positioner_moved()
Callback for subclasses to get notified about positioner movement.
void update_slider_position(slider_position_t &pos)
void set_slider_position(int item_position)
Note the position isn't guaranteed to be the wanted position the step size is honored.
void scroll(const scroll_mode scroll)
Sets the item position.
int available_length() const
virtual unsigned get_length() const =0
Get the length of the slider.
virtual int on_bar(const point &coordinate) const =0
Is the coordinate on the bar?
unsigned get_positioner_length() const
virtual int jump_size() const
virtual void place(const point &origin, const point &size) override
See widget::place.
ui_event
The event sent to the dispatcher.
map_location coordinate
Contains an x and y coordinate used for starting positions in maps.
std::size_t size(std::string_view str)
Length in characters of a UTF-8 string.
Helper container for the slider's current position.