mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:18: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
|
@ -32,6 +32,7 @@
|
|||
#include <LibCore/Object.h>
|
||||
#include <LibGUI/Forward.h>
|
||||
#include <LibGUI/Margins.h>
|
||||
#include <LibGfx/Forward.h>
|
||||
|
||||
namespace GUI {
|
||||
|
||||
|
@ -49,6 +50,7 @@ public:
|
|||
void remove_widget(Widget&);
|
||||
|
||||
virtual void run(Widget&) = 0;
|
||||
virtual Gfx::IntSize preferred_size() const = 0;
|
||||
|
||||
void notify_adopted(Badge<Widget>, Widget&);
|
||||
void notify_disowned(Badge<Widget>, Widget&);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue