mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:57:35 +00:00
LibGUI: Add a way for GWidgets to do custom layout on child hide/show
This solves an issue in GScrollableWidget where hiding one of the two scrollbars needs to trigger a relayout since the other one should grow into the "shared space" in the bottom right corner. A GWidget can now override custom_layout() which will be called at any time we would normally delegate work to the GLayout, e.g on resize or child visibility changes, size policy changes, etc.
This commit is contained in:
parent
77a58119e7
commit
b615a5c780
4 changed files with 13 additions and 7 deletions
|
@ -40,13 +40,13 @@ public:
|
|||
|
||||
protected:
|
||||
explicit GScrollableWidget(GWidget* parent);
|
||||
virtual void custom_layout() override;
|
||||
virtual void resize_event(GResizeEvent&) override;
|
||||
virtual void mousewheel_event(GMouseEvent&) override;
|
||||
virtual void did_scroll() {}
|
||||
void set_content_size(const Size&);
|
||||
void set_size_occupied_by_fixed_elements(const Size&);
|
||||
|
||||
|
||||
private:
|
||||
void update_scrollbar_ranges();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue