mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:17:44 +00:00
LibGUI: Fix flickering scrollbars in AbstractScrollableWidget
The new min_content_size value is to be set by the subclasses, it is then used to determine if the scrollbars should be shown after a resize, but before the content size will be calculated by the following layout pass.
This commit is contained in:
parent
6f9777d35b
commit
d0a418540e
2 changed files with 52 additions and 20 deletions
|
@ -21,6 +21,7 @@ public:
|
|||
Gfx::IntSize content_size() const { return m_content_size; }
|
||||
int content_width() const { return m_content_size.width(); }
|
||||
int content_height() const { return m_content_size.height(); }
|
||||
Gfx::IntSize min_content_size() const { return m_min_content_size; }
|
||||
|
||||
Gfx::IntRect visible_content_rect() const;
|
||||
|
||||
|
@ -60,7 +61,7 @@ public:
|
|||
|
||||
virtual Margins content_margins() const override;
|
||||
|
||||
void set_should_hide_unnecessary_scrollbars(bool b) { m_should_hide_unnecessary_scrollbars = b; }
|
||||
void set_should_hide_unnecessary_scrollbars(bool);
|
||||
bool should_hide_unnecessary_scrollbars() const { return m_should_hide_unnecessary_scrollbars; }
|
||||
|
||||
Gfx::IntPoint to_content_position(Gfx::IntPoint const& widget_position) const;
|
||||
|
@ -76,9 +77,12 @@ protected:
|
|||
virtual void mousewheel_event(MouseEvent&) override;
|
||||
virtual void did_scroll() { }
|
||||
void set_content_size(Gfx::IntSize const&);
|
||||
void set_min_content_size(Gfx::IntSize const&);
|
||||
void set_size_occupied_by_fixed_elements(Gfx::IntSize const&);
|
||||
virtual void on_automatic_scrolling_timer_fired() {};
|
||||
int autoscroll_threshold() const { return m_autoscroll_threshold; }
|
||||
void update_scrollbar_visibility();
|
||||
void update_scrollbar_ranges();
|
||||
|
||||
private:
|
||||
class AbstractScrollableWidgetScrollbar final : public Scrollbar {
|
||||
|
@ -100,13 +104,13 @@ private:
|
|||
};
|
||||
friend class ScrollableWidgetScrollbar;
|
||||
|
||||
void update_scrollbar_ranges();
|
||||
void handle_wheel_event(MouseEvent&, Widget&);
|
||||
|
||||
RefPtr<AbstractScrollableWidgetScrollbar> m_vertical_scrollbar;
|
||||
RefPtr<AbstractScrollableWidgetScrollbar> m_horizontal_scrollbar;
|
||||
RefPtr<Widget> m_corner_widget;
|
||||
Gfx::IntSize m_content_size;
|
||||
Gfx::IntSize m_min_content_size;
|
||||
Gfx::IntSize m_size_occupied_by_fixed_elements;
|
||||
bool m_scrollbars_enabled { true };
|
||||
bool m_should_hide_unnecessary_scrollbars { false };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue