1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-10 18:10:56 +09:00

LibGUI: Start adding an automatic widget layout system.

My needs are really quite simple, so I'm just going to add what I need
as I go along. The first thing I needed was a simple box layout with
widgets being able to say whether they prefer fixed or fill for both
their vertical and horizontal sizes.

I also made a simple GStatusBar so FileManager can show how many bytes
worth of files are in the current directory.
This commit is contained in:
Andreas Kling 2019-02-10 11:07:13 +01:00
parent 2cf1dd5b6f
commit 2def3d8d3f
Notes: sideshowbarker 2024-07-19 15:48:23 +09:00
22 changed files with 411 additions and 29 deletions

31
LibGUI/GLayout.h Normal file
View file

@ -0,0 +1,31 @@
#pragma once
#include <AK/Badge.h>
#include <AK/OwnPtr.h>
#include <AK/Vector.h>
#include <AK/WeakPtr.h>
class GWidget;
class GLayout {
public:
GLayout();
virtual ~GLayout();
void add_widget(GWidget&);
void add_layout(OwnPtr<GLayout>&&);
virtual void run(GWidget&) = 0;
void notify_adopted(Badge<GWidget>, GWidget&);
void notify_disowned(Badge<GWidget>, GWidget&);
protected:
struct Entry {
WeakPtr<GWidget> widget;
OwnPtr<GLayout> layout;
};
WeakPtr<GWidget> m_owner;
Vector<Entry> m_entries;
};