1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 18:05:07 +00:00

LibGUI: Use Core::Object::add() a whole bunch

This commit is contained in:
Andreas Kling 2020-02-23 10:31:26 +01:00
parent 8efafdfc12
commit 45c25ffecd
11 changed files with 52 additions and 52 deletions

View file

@ -26,14 +26,14 @@
#include <LibGUI/Button.h>
#include <LibGUI/SpinBox.h>
#include <LibGUI/TextEditor.h>
#include <LibGUI/TextBox.h>
namespace GUI {
SpinBox::SpinBox(Widget* parent)
: Widget(parent)
{
m_editor = TextEditor::construct(TextEditor::Type::SingleLine, this);
m_editor = add<TextBox>();
m_editor->set_text("0");
m_editor->on_change = [this] {
bool ok;
@ -43,12 +43,12 @@ SpinBox::SpinBox(Widget* parent)
else
m_editor->set_text(String::number(m_value));
};
m_increment_button = Button::construct(this);
m_increment_button = add<Button>();
m_increment_button->set_focusable(false);
m_increment_button->set_text("\xc3\xb6");
m_increment_button->on_click = [this](auto&) { set_value(m_value + 1); };
m_increment_button->set_auto_repeat_interval(150);
m_decrement_button = Button::construct(this);
m_decrement_button = add<Button>();
m_decrement_button->set_focusable(false);
m_decrement_button->set_text("\xc3\xb7");
m_decrement_button->on_click = [this](auto&) { set_value(m_value - 1); };