mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 08:45:09 +00:00
LibGUI: Add page_step setting to AbstractSlider and use it in Slider
This makes clicking on the track of a GUI::Slider actually move the knob more than 1 value unit (assuming page_step > 1)
This commit is contained in:
parent
fa836a4dda
commit
3b445bc66a
3 changed files with 12 additions and 2 deletions
|
@ -36,9 +36,11 @@ namespace GUI {
|
|||
AbstractSlider::AbstractSlider(Orientation orientation)
|
||||
: m_orientation(orientation)
|
||||
{
|
||||
REGISTER_INT_PROPERTY("value", value, set_value);
|
||||
REGISTER_INT_PROPERTY("min", min, set_min);
|
||||
REGISTER_INT_PROPERTY("max", max, set_max);
|
||||
REGISTER_INT_PROPERTY("step", step, set_step);
|
||||
REGISTER_INT_PROPERTY("page_step", page_step, set_page_step);
|
||||
REGISTER_ENUM_PROPERTY("orientation", this->orientation, set_orientation, Orientation,
|
||||
{ Orientation::Horizontal, "Horizontal" },
|
||||
{ Orientation::Vertical, "Vertical" });
|
||||
|
@ -56,6 +58,11 @@ void AbstractSlider::set_orientation(Orientation value)
|
|||
update();
|
||||
}
|
||||
|
||||
void AbstractSlider::set_page_step(int page_step)
|
||||
{
|
||||
m_page_step = AK::max(0, page_step);
|
||||
}
|
||||
|
||||
void AbstractSlider::set_range(int min, int max)
|
||||
{
|
||||
ASSERT(min <= max);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue