mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 19:38:12 +00:00
Libraries: Create top level directory for libraries.
Things were getting a little crowded in the project root, so this patch moves the Lib*/ directories into Libraries/.
This commit is contained in:
parent
63814ffebf
commit
04b9dc2d30
328 changed files with 36 additions and 36 deletions
80
Libraries/LibGUI/GLayout.cpp
Normal file
80
Libraries/LibGUI/GLayout.cpp
Normal file
|
@ -0,0 +1,80 @@
|
|||
#include <LibGUI/GLayout.h>
|
||||
#include <LibGUI/GWidget.h>
|
||||
|
||||
GLayout::GLayout()
|
||||
{
|
||||
}
|
||||
|
||||
GLayout::~GLayout()
|
||||
{
|
||||
}
|
||||
|
||||
void GLayout::notify_adopted(Badge<GWidget>, GWidget& widget)
|
||||
{
|
||||
if (m_owner == &widget)
|
||||
return;
|
||||
m_owner = widget.make_weak_ptr();
|
||||
}
|
||||
|
||||
void GLayout::notify_disowned(Badge<GWidget>, GWidget& widget)
|
||||
{
|
||||
ASSERT(m_owner == &widget);
|
||||
m_owner.clear();
|
||||
}
|
||||
|
||||
void GLayout::add_entry(Entry&& entry)
|
||||
{
|
||||
m_entries.append(move(entry));
|
||||
if (m_owner)
|
||||
m_owner->notify_layout_changed({});
|
||||
}
|
||||
|
||||
void GLayout::add_spacer()
|
||||
{
|
||||
Entry entry;
|
||||
entry.type = Entry::Type::Spacer;
|
||||
add_entry(move(entry));
|
||||
}
|
||||
|
||||
void GLayout::add_layout(OwnPtr<GLayout>&& layout)
|
||||
{
|
||||
Entry entry;
|
||||
entry.type = Entry::Type::Layout;
|
||||
entry.layout = move(layout);
|
||||
add_entry(move(entry));
|
||||
}
|
||||
|
||||
void GLayout::add_widget(GWidget& widget)
|
||||
{
|
||||
Entry entry;
|
||||
entry.type = Entry::Type::Widget;
|
||||
entry.widget = widget.make_weak_ptr();
|
||||
add_entry(move(entry));
|
||||
}
|
||||
|
||||
void GLayout::remove_widget(GWidget& widget)
|
||||
{
|
||||
m_entries.remove_first_matching([&](auto& entry) {
|
||||
return entry.widget == &widget;
|
||||
});
|
||||
if (m_owner)
|
||||
m_owner->notify_layout_changed({});
|
||||
}
|
||||
|
||||
void GLayout::set_spacing(int spacing)
|
||||
{
|
||||
if (m_spacing == spacing)
|
||||
return;
|
||||
m_spacing = spacing;
|
||||
if (m_owner)
|
||||
m_owner->notify_layout_changed({});
|
||||
}
|
||||
|
||||
void GLayout::set_margins(const GMargins& margins)
|
||||
{
|
||||
if (m_margins == margins)
|
||||
return;
|
||||
m_margins = margins;
|
||||
if (m_owner)
|
||||
m_owner->notify_layout_changed({});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue