mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-12 12:32:21 +00:00
LibGUI: Add movement methods to AbstractSlider
These methods give us a simple way to move up and down the slider, without needing to repeat the 'set_value(value() + some_value)' pattern that multiple applications and libraries use.
This commit is contained in:
parent
4427386d5f
commit
8b8f404146
Notes:
sideshowbarker
2024-07-17 21:55:34 +09:00
Author: https://github.com/elyse0
Commit: 8b8f404146
Pull-request: https://github.com/SerenityOS/serenity/pull/11163
Reviewed-by: https://github.com/kleinesfilmroellchen ✅
Reviewed-by: https://github.com/metmo ✅
1 changed files with 7 additions and 0 deletions
|
@ -38,6 +38,13 @@ public:
|
||||||
void set_page_step(int page_step);
|
void set_page_step(int page_step);
|
||||||
void set_jump_to_cursor(bool b) { m_jump_to_cursor = b; }
|
void set_jump_to_cursor(bool b) { m_jump_to_cursor = b; }
|
||||||
|
|
||||||
|
void increase_slider_by(int delta) { set_value(value() + delta); }
|
||||||
|
void decrease_slider_by(int delta) { set_value(value() - delta); }
|
||||||
|
void increase_slider_by_page_steps(int page_steps) { set_value(value() + page_step() * page_steps); }
|
||||||
|
void decrease_slider_by_page_steps(int page_steps) { set_value(value() - page_step() * page_steps); }
|
||||||
|
void increase_slider_by_steps(int steps) { set_value(value() + step() * steps); }
|
||||||
|
void decrease_slider_by_steps(int steps) { set_value(value() - step() * steps); }
|
||||||
|
|
||||||
Function<void(int)> on_change;
|
Function<void(int)> on_change;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue