mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:58:11 +00:00
LibGUI: Add Widget shrink-to-fit layout flag
If this flag is enabled for a widget, it will be automatically sized based on its children. This only works for widgets using a layout. This allows you to put widgets inside each other without having to manually calculate how large the container should be. It's not the perfect API but it's a decent progression in ergonomics. :^)
This commit is contained in:
parent
ce7b09a3c5
commit
b03e1b08b5
5 changed files with 90 additions and 0 deletions
|
@ -297,6 +297,9 @@ public:
|
|||
|
||||
bool load_from_gml(const StringView&);
|
||||
|
||||
void set_shrink_to_fit(bool);
|
||||
bool is_shrink_to_fit() const { return m_shrink_to_fit; }
|
||||
|
||||
protected:
|
||||
Widget();
|
||||
|
||||
|
@ -367,6 +370,7 @@ private:
|
|||
bool m_enabled { true };
|
||||
bool m_updates_enabled { true };
|
||||
bool m_accepts_emoji_input { false };
|
||||
bool m_shrink_to_fit { false };
|
||||
|
||||
NonnullRefPtr<Gfx::PaletteImpl> m_palette;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue