mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-04 10:18:51 +00:00
VisualBuilder: Make it possible to add a layout to a widget
This patch adds horizontal and vertical layout options to the widget context menu. This is going to need a lot of work, but it's a cool start. :^)
This commit is contained in:
parent
9acdf9bb0a
commit
b37fc9f655
Notes:
sideshowbarker
2024-07-19 12:03:48 +09:00
Author: https://github.com/awesomekling
Commit: b37fc9f655
1 changed files with 14 additions and 0 deletions
|
@ -36,6 +36,20 @@ VBForm::VBForm(const String& name, GWidget* parent)
|
|||
if (auto* widget = single_selected_widget())
|
||||
widget->gwidget()->move_to_back();
|
||||
}));
|
||||
m_context_menu->add_separator();
|
||||
m_context_menu->add_action(GAction::create("Lay out horizontally", [this](auto&) {
|
||||
if (auto* widget = single_selected_widget()) {
|
||||
dbg() << "Giving " << *widget->gwidget() << " a horizontal box layout";
|
||||
widget->gwidget()->set_layout(make<GBoxLayout>(Orientation::Horizontal));
|
||||
}
|
||||
}));
|
||||
m_context_menu->add_action(GAction::create("Lay out vertically", [this](auto&) {
|
||||
if (auto* widget = single_selected_widget()) {
|
||||
dbg() << "Giving " << *widget->gwidget() << " a vertical box layout";
|
||||
widget->gwidget()->set_layout(make<GBoxLayout>(Orientation::Vertical));
|
||||
}
|
||||
}));
|
||||
m_context_menu->add_separator();
|
||||
m_context_menu->add_action(GCommonActions::make_delete_action([this](auto&) {
|
||||
delete_selected_widgets();
|
||||
}));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue