mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:57:45 +00:00
LibGUI: Implement new layout system for Scrollbar
This commit is contained in:
parent
19fac58e49
commit
3978960481
2 changed files with 20 additions and 5 deletions
|
@ -48,11 +48,7 @@ Scrollbar::Scrollbar(Orientation orientation)
|
|||
{
|
||||
m_automatic_scrolling_timer = add<Core::Timer>();
|
||||
|
||||
if (orientation == Orientation::Vertical) {
|
||||
set_fixed_width(16);
|
||||
} else {
|
||||
set_fixed_height(16);
|
||||
}
|
||||
set_preferred_size({ SpecialDimension::Fit });
|
||||
|
||||
m_automatic_scrolling_timer->set_interval(100);
|
||||
m_automatic_scrolling_timer->on_timeout = [this] {
|
||||
|
@ -421,4 +417,20 @@ void Scrollbar::update_animated_scroll()
|
|||
AbstractSlider::set_value(new_value);
|
||||
}
|
||||
|
||||
Optional<UISize> Scrollbar::calculated_min_size() const
|
||||
{
|
||||
if (orientation() == Gfx::Orientation::Vertical)
|
||||
return { { default_button_size(), 2 * default_button_size() } };
|
||||
else
|
||||
return { { 2 * default_button_size(), default_button_size() } };
|
||||
}
|
||||
|
||||
Optional<UISize> Scrollbar::calculated_preferred_size() const
|
||||
{
|
||||
if (orientation() == Gfx::Orientation::Vertical)
|
||||
return { { SpecialDimension::Shrink, SpecialDimension::Grow } };
|
||||
else
|
||||
return { { SpecialDimension::Grow, SpecialDimension::Shrink } };
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue