diff options
author | Andreas Kling <kling@serenityos.org> | 2020-03-04 19:07:55 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-03-04 21:04:06 +0100 |
commit | 028c011760b5b665fc2a72bb3c11fd3a6ca60d2c (patch) | |
tree | a961293992de78ebac5c3ffec864179d661dcc09 /DevTools/VisualBuilder/main.cpp | |
parent | fb09b6a8cec02cc473b3fed326d99055d80a60ba (diff) | |
download | serenity-028c011760b5b665fc2a72bb3c11fd3a6ca60d2c.zip |
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. :^)
Diffstat (limited to 'DevTools/VisualBuilder/main.cpp')
-rw-r--r-- | DevTools/VisualBuilder/main.cpp | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/DevTools/VisualBuilder/main.cpp b/DevTools/VisualBuilder/main.cpp index 60bd53ad09..411682d245 100644 --- a/DevTools/VisualBuilder/main.cpp +++ b/DevTools/VisualBuilder/main.cpp @@ -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); }; |