1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-22 16:55:09 +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

@ -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);
};