ladybird/LibGUI/GLayout.h
Andreas Kling 2def3d8d3f 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.
2019-02-10 11:07:13 +01:00

31 lines
565 B
C++

#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;
};