1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 10:37:45 +00:00

LibCore: Make Core::Object::add<ChildType> return a ChildType&

Since the returned object is now owned by the callee object, we can
simply vend a ChildType&. This allows us to use "." instead of "->"
at the call site, which is quite nice. :^)
This commit is contained in:
Andreas Kling 2020-03-04 19:07:55 +01:00
parent fb09b6a8ce
commit 028c011760
46 changed files with 1035 additions and 1039 deletions

View file

@ -38,19 +38,19 @@ EditorWrapper::EditorWrapper()
{
set_layout<GUI::VerticalBoxLayout>();
auto label_wrapper = add<GUI::Widget>();
label_wrapper->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed);
label_wrapper->set_preferred_size(0, 14);
label_wrapper->set_fill_with_background_color(true);
label_wrapper->set_layout<GUI::HorizontalBoxLayout>();
label_wrapper->layout()->set_margins({ 2, 0, 2, 0 });
auto& label_wrapper = add<GUI::Widget>();
label_wrapper.set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed);
label_wrapper.set_preferred_size(0, 14);
label_wrapper.set_fill_with_background_color(true);
label_wrapper.set_layout<GUI::HorizontalBoxLayout>();
label_wrapper.layout()->set_margins({ 2, 0, 2, 0 });
m_filename_label = label_wrapper->add<GUI::Label>("(Untitled)");
m_filename_label = label_wrapper.add<GUI::Label>("(Untitled)");
m_filename_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
m_filename_label->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed);
m_filename_label->set_preferred_size(0, 14);
m_cursor_label = label_wrapper->add<GUI::Label>("(Cursor)");
m_cursor_label = label_wrapper.add<GUI::Label>("(Cursor)");
m_cursor_label->set_text_alignment(Gfx::TextAlignment::CenterRight);
m_cursor_label->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed);
m_cursor_label->set_preferred_size(0, 14);

View file

@ -40,21 +40,21 @@ ProcessStateWidget::ProcessStateWidget()
set_layout<GUI::HorizontalBoxLayout>();
auto pid_label_label = add<GUI::Label>("Process:");
pid_label_label->set_font(Gfx::Font::default_bold_font());
auto& pid_label_label = add<GUI::Label>("Process:");
pid_label_label.set_font(Gfx::Font::default_bold_font());
m_pid_label = add<GUI::Label>("");
auto state_label_label = add<GUI::Label>("State:");
state_label_label->set_font(Gfx::Font::default_bold_font());
auto& state_label_label = add<GUI::Label>("State:");
state_label_label.set_font(Gfx::Font::default_bold_font());
m_state_label = add<GUI::Label>("");
// FIXME: This should show CPU% instead.
auto cpu_label_label = add<GUI::Label>("Times scheduled:");
cpu_label_label->set_font(Gfx::Font::default_bold_font());
auto& cpu_label_label = add<GUI::Label>("Times scheduled:");
cpu_label_label.set_font(Gfx::Font::default_bold_font());
m_cpu_label = add<GUI::Label>("");
auto memory_label_label = add<GUI::Label>("Memory (resident):");
memory_label_label->set_font(Gfx::Font::default_bold_font());
auto& memory_label_label = add<GUI::Label>("Memory (resident):");
memory_label_label.set_font(Gfx::Font::default_bold_font());
m_memory_label = add<GUI::Label>("");
m_timer = add<Core::Timer>(500, [this] {

View file

@ -164,7 +164,7 @@ int main(int argc, char** argv)
g_project = Project::load_from_file("little.files");
ASSERT(g_project);
auto toolbar = widget.add<GUI::ToolBar>();
auto& toolbar = widget.add<GUI::ToolBar>();
auto selected_file_names = [&] {
Vector<String> files;
@ -175,10 +175,10 @@ int main(int argc, char** argv)
};
auto new_action = GUI::Action::create("Add new file to project...", { Mod_Ctrl, Key_N }, Gfx::Bitmap::load_from_file("/res/icons/16x16/new.png"), [&](const GUI::Action&) {
auto input_box = g_window->add<GUI::InputBox>("Enter name of new file:", "Add new file to project");
if (input_box->exec() == GUI::InputBox::ExecCancel)
auto& input_box = g_window->add<GUI::InputBox>("Enter name of new file:", "Add new file to project");
if (input_box.exec() == GUI::InputBox::ExecCancel)
return;
auto filename = input_box->text_value();
auto filename = input_box.text_value();
auto file = Core::File::construct(filename);
if (!file->open((Core::IODevice::OpenMode)(Core::IODevice::WriteOnly | Core::IODevice::MustBeNew))) {
GUI::MessageBox::show(String::format("Failed to create '%s'", filename.characters()), "Error", GUI::MessageBox::Type::Error, GUI::MessageBox::InputType::OK, g_window);
@ -246,8 +246,8 @@ int main(int argc, char** argv)
project_tree_view_context_menu->add_action(add_existing_file_action);
project_tree_view_context_menu->add_action(delete_action);
auto outer_splitter = widget.add<GUI::HorizontalSplitter>();
g_project_tree_view = outer_splitter->add<GUI::TreeView>();
auto& outer_splitter = widget.add<GUI::HorizontalSplitter>();
g_project_tree_view = outer_splitter.add<GUI::TreeView>();
g_project_tree_view->set_model(g_project->model());
g_project_tree_view->set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fill);
g_project_tree_view->set_preferred_size(140, 0);
@ -262,12 +262,12 @@ int main(int argc, char** argv)
delete_action->set_enabled(!g_project_tree_view->selection().is_empty());
};
g_right_hand_stack = outer_splitter->add<GUI::StackWidget>();
g_right_hand_stack = outer_splitter.add<GUI::StackWidget>();
g_form_inner_container = g_right_hand_stack->add<GUI::Widget>();
g_form_inner_container->set_layout<GUI::HorizontalBoxLayout>();
auto form_widgets_toolbar = g_form_inner_container->add<GUI::ToolBar>(Orientation::Vertical, 26);
form_widgets_toolbar->set_preferred_size(38, 0);
auto& form_widgets_toolbar = g_form_inner_container->add<GUI::ToolBar>(Orientation::Vertical, 26);
form_widgets_toolbar.set_preferred_size(38, 0);
GUI::ActionGroup tool_actions;
tool_actions.set_exclusive(true);
@ -279,7 +279,7 @@ int main(int argc, char** argv)
cursor_tool_action->set_checked(true);
tool_actions.add_action(cursor_tool_action);
form_widgets_toolbar->add_action(cursor_tool_action);
form_widgets_toolbar.add_action(cursor_tool_action);
GUI::WidgetClassRegistration::for_each([&](const GUI::WidgetClassRegistration& reg) {
auto icon_path = String::format("/res/icons/widgets/G%s.png", reg.class_name().characters());
@ -293,28 +293,28 @@ int main(int argc, char** argv)
action->set_checkable(true);
action->set_checked(false);
tool_actions.add_action(action);
form_widgets_toolbar->add_action(move(action));
form_widgets_toolbar.add_action(move(action));
});
auto form_editor_inner_splitter = g_form_inner_container->add<GUI::HorizontalSplitter>();
auto& form_editor_inner_splitter = g_form_inner_container->add<GUI::HorizontalSplitter>();
g_form_editor_widget = form_editor_inner_splitter->add<FormEditorWidget>();
g_form_editor_widget = form_editor_inner_splitter.add<FormEditorWidget>();
auto form_editing_pane_container = form_editor_inner_splitter->add<GUI::VerticalSplitter>();
form_editing_pane_container->set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fill);
form_editing_pane_container->set_preferred_size(190, 0);
form_editing_pane_container->set_layout<GUI::VerticalBoxLayout>();
auto& form_editing_pane_container = form_editor_inner_splitter.add<GUI::VerticalSplitter>();
form_editing_pane_container.set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fill);
form_editing_pane_container.set_preferred_size(190, 0);
form_editing_pane_container.set_layout<GUI::VerticalBoxLayout>();
auto add_properties_pane = [&](auto& text, auto pane_widget) {
auto wrapper = form_editing_pane_container->add<GUI::Widget>();
wrapper->set_layout<GUI::VerticalBoxLayout>();
auto label = wrapper->add<GUI::Label>(text);
label->set_fill_with_background_color(true);
label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
label->set_font(Gfx::Font::default_bold_font());
label->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed);
label->set_preferred_size(0, 16);
wrapper->add_child(pane_widget);
auto& wrapper = form_editing_pane_container.add<GUI::Widget>();
wrapper.set_layout<GUI::VerticalBoxLayout>();
auto& label = wrapper.add<GUI::Label>(text);
label.set_fill_with_background_color(true);
label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
label.set_font(Gfx::Font::default_bold_font());
label.set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed);
label.set_preferred_size(0, 16);
wrapper.add_child(pane_widget);
};
auto form_widget_tree_view = GUI::TreeView::construct();
@ -401,19 +401,19 @@ int main(int argc, char** argv)
current_editor().write_to_file(g_currently_open_file);
});
toolbar->add_action(new_action);
toolbar->add_action(add_existing_file_action);
toolbar->add_action(save_action);
toolbar->add_action(delete_action);
toolbar->add_separator();
toolbar.add_action(new_action);
toolbar.add_action(add_existing_file_action);
toolbar.add_action(save_action);
toolbar.add_action(delete_action);
toolbar.add_separator();
toolbar->add_action(GUI::CommonActions::make_cut_action([&](auto&) { current_editor().cut_action().activate(); }));
toolbar->add_action(GUI::CommonActions::make_copy_action([&](auto&) { current_editor().copy_action().activate(); }));
toolbar->add_action(GUI::CommonActions::make_paste_action([&](auto&) { current_editor().paste_action().activate(); }));
toolbar->add_separator();
toolbar->add_action(GUI::CommonActions::make_undo_action([&](auto&) { current_editor().undo_action().activate(); }));
toolbar->add_action(GUI::CommonActions::make_redo_action([&](auto&) { current_editor().redo_action().activate(); }));
toolbar->add_separator();
toolbar.add_action(GUI::CommonActions::make_cut_action([&](auto&) { current_editor().cut_action().activate(); }));
toolbar.add_action(GUI::CommonActions::make_copy_action([&](auto&) { current_editor().copy_action().activate(); }));
toolbar.add_action(GUI::CommonActions::make_paste_action([&](auto&) { current_editor().paste_action().activate(); }));
toolbar.add_separator();
toolbar.add_action(GUI::CommonActions::make_undo_action([&](auto&) { current_editor().undo_action().activate(); }));
toolbar.add_action(GUI::CommonActions::make_redo_action([&](auto&) { current_editor().redo_action().activate(); }));
toolbar.add_separator();
g_project_tree_view->on_activation = [&](auto& index) {
auto filename = g_project_tree_view->model()->data(index, GUI::Model::Role::Custom).to_string();
@ -447,10 +447,10 @@ int main(int argc, char** argv)
auto find_in_files_widget = s_action_tab_widget->add_tab<FindInFilesWidget>("Find in files");
auto terminal_wrapper = s_action_tab_widget->add_tab<TerminalWrapper>("Console");
auto locator = widget.add<Locator>();
auto& locator = widget.add<Locator>();
auto open_locator_action = GUI::Action::create("Open Locator...", { Mod_Ctrl, Key_K }, [&](auto&) {
locator->open();
locator.open();
});
auto menubar = make<GUI::MenuBar>();
@ -487,15 +487,15 @@ int main(int argc, char** argv)
build(terminal_wrapper);
stop_action->set_enabled(true);
});
toolbar->add_action(build_action);
toolbar.add_action(build_action);
auto run_action = GUI::Action::create("Run", { Mod_Ctrl, Key_R }, Gfx::Bitmap::load_from_file("/res/icons/16x16/play.png"), [&](auto&) {
reveal_action_tab(terminal_wrapper);
run(terminal_wrapper);
stop_action->set_enabled(true);
});
toolbar->add_action(run_action);
toolbar->add_action(stop_action);
toolbar.add_action(run_action);
toolbar.add_action(stop_action);
auto build_menu = GUI::Menu::construct("Build");
build_menu->add_action(build_action);

View file

@ -62,7 +62,7 @@ int main(int argc, char** argv)
widget.set_fill_with_background_color(true);
widget.set_layout<GUI::VerticalBoxLayout>();
auto splitter = widget.add<GUI::HorizontalSplitter>();
auto& splitter = widget.add<GUI::HorizontalSplitter>();
RemoteProcess remote_process(pid);
@ -71,16 +71,16 @@ int main(int argc, char** argv)
window->set_title(String::format("Inspector: %s (%d)", remote_process.process_name().characters(), remote_process.pid()));
};
auto tree_view = splitter->add<GUI::TreeView>();
tree_view->set_model(remote_process.object_graph_model());
tree_view->set_activates_on_selection(true);
auto& tree_view = splitter.add<GUI::TreeView>();
tree_view.set_model(remote_process.object_graph_model());
tree_view.set_activates_on_selection(true);
auto properties_table_view = splitter->add<GUI::TableView>();
properties_table_view->set_size_columns_to_fit_content(true);
auto& properties_table_view = splitter.add<GUI::TableView>();
properties_table_view.set_size_columns_to_fit_content(true);
tree_view->on_activation = [&](auto& index) {
tree_view.on_activation = [&](auto& index) {
auto* remote_object = static_cast<RemoteObject*>(index.internal_data());
properties_table_view->set_model(remote_object->property_model());
properties_table_view.set_model(remote_object->property_model());
};
window->show();

View file

@ -61,12 +61,12 @@ int main(int argc, char** argv)
main_widget.set_fill_with_background_color(true);
main_widget.set_layout<GUI::VerticalBoxLayout>();
auto timeline_widget = main_widget.add<ProfileTimelineWidget>(*profile);
main_widget.add<ProfileTimelineWidget>(*profile);
auto tree_view = main_widget.add<GUI::TreeView>();
tree_view->set_headers_visible(true);
tree_view->set_size_columns_to_fit_content(true);
tree_view->set_model(profile->model());
auto& tree_view = main_widget.add<GUI::TreeView>();
tree_view.set_headers_visible(true);
tree_view.set_size_columns_to_fit_content(true);
tree_view.set_model(profile->model());
auto menubar = make<GUI::MenuBar>();
auto app_menu = GUI::Menu::construct("ProfileViewer");
@ -86,7 +86,7 @@ int main(int argc, char** argv)
auto percent_action = GUI::Action::create("Show percentages", { Mod_Ctrl, Key_P }, [&](auto& action) {
action.set_checked(!action.is_checked());
profile->set_show_percentages(action.is_checked());
tree_view->update();
tree_view.update();
});
percent_action->set_checkable(true);
percent_action->set_checked(false);

View file

@ -104,43 +104,43 @@ static RefPtr<GUI::Widget> build_gwidget(VBWidgetType type, GUI::Widget* parent)
case VBWidgetType::GGroupBox:
return parent->add<GUI::GroupBox>("groupbox_1");
case VBWidgetType::GLabel: {
auto label = parent->add<GUI::Label>();
label->set_fill_with_background_color(true);
label->set_text("label_1");
auto& label = parent->add<GUI::Label>();
label.set_fill_with_background_color(true);
label.set_text("label_1");
return label;
}
case VBWidgetType::GButton: {
auto button = parent->add<GUI::Button>();
button->set_text("button_1");
auto& button = parent->add<GUI::Button>();
button.set_text("button_1");
return button;
}
case VBWidgetType::GSpinBox: {
auto box = parent->add<GUI::SpinBox>();
box->set_range(0, 100);
box->set_value(0);
auto& box = parent->add<GUI::SpinBox>();
box.set_range(0, 100);
box.set_value(0);
return box;
}
case VBWidgetType::GTextEditor: {
auto editor = parent->add<GUI::TextEditor>();
editor->set_ruler_visible(false);
auto& editor = parent->add<GUI::TextEditor>();
editor.set_ruler_visible(false);
return editor;
}
case VBWidgetType::GProgressBar: {
auto bar = parent->add<GUI::ProgressBar>();
bar->set_format(GUI::ProgressBar::Format::NoText);
bar->set_range(0, 100);
bar->set_value(50);
auto& bar = parent->add<GUI::ProgressBar>();
bar.set_format(GUI::ProgressBar::Format::NoText);
bar.set_range(0, 100);
bar.set_value(50);
return bar;
}
case VBWidgetType::GSlider: {
auto slider = parent->add<GUI::HorizontalSlider>();
slider->set_range(0, 100);
slider->set_value(50);
auto& slider = parent->add<GUI::HorizontalSlider>();
slider.set_range(0, 100);
slider.set_value(50);
return slider;
}
case VBWidgetType::GCheckBox: {
auto box = parent->add<GUI::CheckBox>();
box->set_text("checkbox_1");
auto& box = parent->add<GUI::CheckBox>();
box.set_text("checkbox_1");
return box;
}
case VBWidgetType::GRadioButton:

View file

@ -111,84 +111,84 @@ RefPtr<GUI::Window> make_toolbox_window()
widget.set_layout<GUI::VerticalBoxLayout>();
widget.layout()->set_spacing(0);
auto label_button = widget.add<GUI::Button>();
label_button->set_button_style(Gfx::ButtonStyle::CoolBar);
label_button->set_tooltip("GLabel");
label_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/label.png"));
label_button->on_click = [] {
auto& label_button = widget.add<GUI::Button>();
label_button.set_button_style(Gfx::ButtonStyle::CoolBar);
label_button.set_tooltip("GLabel");
label_button.set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/label.png"));
label_button.on_click = [] {
if (auto* form = VBForm::current())
form->insert_widget(VBWidgetType::GLabel);
};
auto button_button = widget.add<GUI::Button>();
button_button->set_button_style(Gfx::ButtonStyle::CoolBar);
button_button->set_tooltip("GButton");
button_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/button.png"));
button_button->on_click = [] {
auto& button_button = widget.add<GUI::Button>();
button_button.set_button_style(Gfx::ButtonStyle::CoolBar);
button_button.set_tooltip("GButton");
button_button.set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/button.png"));
button_button.on_click = [] {
if (auto* form = VBForm::current())
form->insert_widget(VBWidgetType::GButton);
};
auto spinbox_button = widget.add<GUI::Button>();
spinbox_button->set_button_style(Gfx::ButtonStyle::CoolBar);
spinbox_button->set_tooltip("GSpinBox");
spinbox_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/spinbox.png"));
spinbox_button->on_click = [] {
auto& spinbox_button = widget.add<GUI::Button>();
spinbox_button.set_button_style(Gfx::ButtonStyle::CoolBar);
spinbox_button.set_tooltip("GSpinBox");
spinbox_button.set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/spinbox.png"));
spinbox_button.on_click = [] {
if (auto* form = VBForm::current())
form->insert_widget(VBWidgetType::GSpinBox);
};
auto editor_button = widget.add<GUI::Button>();
editor_button->set_button_style(Gfx::ButtonStyle::CoolBar);
editor_button->set_tooltip("GTextEditor");
editor_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/textbox.png"));
editor_button->on_click = [] {
auto& editor_button = widget.add<GUI::Button>();
editor_button.set_button_style(Gfx::ButtonStyle::CoolBar);
editor_button.set_tooltip("GTextEditor");
editor_button.set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/textbox.png"));
editor_button.on_click = [] {
if (auto* form = VBForm::current())
form->insert_widget(VBWidgetType::GTextEditor);
};
auto progress_bar_button = widget.add<GUI::Button>();
progress_bar_button->set_button_style(Gfx::ButtonStyle::CoolBar);
progress_bar_button->set_tooltip("GProgressBar");
progress_bar_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/progressbar.png"));
progress_bar_button->on_click = [] {
auto& progress_bar_button = widget.add<GUI::Button>();
progress_bar_button.set_button_style(Gfx::ButtonStyle::CoolBar);
progress_bar_button.set_tooltip("GProgressBar");
progress_bar_button.set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/progressbar.png"));
progress_bar_button.on_click = [] {
if (auto* form = VBForm::current())
form->insert_widget(VBWidgetType::GProgressBar);
};
auto slider_button = widget.add<GUI::Button>();
slider_button->set_button_style(Gfx::ButtonStyle::CoolBar);
slider_button->set_tooltip("GSlider");
slider_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/slider.png"));
slider_button->on_click = [] {
auto& slider_button = widget.add<GUI::Button>();
slider_button.set_button_style(Gfx::ButtonStyle::CoolBar);
slider_button.set_tooltip("GSlider");
slider_button.set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/slider.png"));
slider_button.on_click = [] {
if (auto* form = VBForm::current())
form->insert_widget(VBWidgetType::GSlider);
};
auto checkbox_button = widget.add<GUI::Button>();
checkbox_button->set_button_style(Gfx::ButtonStyle::CoolBar);
checkbox_button->set_tooltip("GCheckBox");
checkbox_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/checkbox.png"));
checkbox_button->on_click = [] {
auto& checkbox_button = widget.add<GUI::Button>();
checkbox_button.set_button_style(Gfx::ButtonStyle::CoolBar);
checkbox_button.set_tooltip("GCheckBox");
checkbox_button.set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/checkbox.png"));
checkbox_button.on_click = [] {
if (auto* form = VBForm::current())
form->insert_widget(VBWidgetType::GCheckBox);
};
auto radiobutton_button = widget.add<GUI::Button>();
radiobutton_button->set_button_style(Gfx::ButtonStyle::CoolBar);
radiobutton_button->set_tooltip("GRadioButton");
radiobutton_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/filled-radio-circle.png"));
radiobutton_button->on_click = [] {
auto& radiobutton_button = widget.add<GUI::Button>();
radiobutton_button.set_button_style(Gfx::ButtonStyle::CoolBar);
radiobutton_button.set_tooltip("GRadioButton");
radiobutton_button.set_icon(Gfx::Bitmap::load_from_file("/res/icons/filled-radio-circle.png"));
radiobutton_button.on_click = [] {
if (auto* form = VBForm::current())
form->insert_widget(VBWidgetType::GRadioButton);
};
auto scrollbar_button = widget.add<GUI::Button>();
scrollbar_button->set_button_style(Gfx::ButtonStyle::CoolBar);
scrollbar_button->set_tooltip("GScrollBar");
scrollbar_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/scrollbar.png"));
scrollbar_button->on_click = [] {
auto& scrollbar_button = widget.add<GUI::Button>();
scrollbar_button.set_button_style(Gfx::ButtonStyle::CoolBar);
scrollbar_button.set_tooltip("GScrollBar");
scrollbar_button.set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/scrollbar.png"));
scrollbar_button.on_click = [] {
if (auto* form = VBForm::current())
form->insert_widget(VBWidgetType::GScrollBar);
};
auto groupbox_button = widget.add<GUI::Button>();
groupbox_button->set_button_style(Gfx::ButtonStyle::CoolBar);
groupbox_button->set_tooltip("GGroupBox");
groupbox_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/groupbox.png"));
groupbox_button->on_click = [] {
auto& groupbox_button = widget.add<GUI::Button>();
groupbox_button.set_button_style(Gfx::ButtonStyle::CoolBar);
groupbox_button.set_tooltip("GGroupBox");
groupbox_button.set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/groupbox.png"));
groupbox_button.on_click = [] {
if (auto* form = VBForm::current())
form->insert_widget(VBWidgetType::GGroupBox);
};