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:
parent
2cf1dd5b6f
commit
2def3d8d3f
Notes:
sideshowbarker
2024-07-19 15:48:23 +09:00
Author: https://github.com/awesomekling
Commit: 2def3d8d3f
22 changed files with 411 additions and 29 deletions
31
LibGUI/GLayout.h
Normal file
31
LibGUI/GLayout.h
Normal 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;
|
||||
};
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue