mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 18:02:05 -05:00
LibGUI: Remove Button& parameter from Button::on_click hook
There was but a single user of this parameter and it's a bit tedious to write it out every time, so let's get rid of it.
This commit is contained in:
parent
b1d35248e4
commit
a26b63a958
26 changed files with 60 additions and 55 deletions
|
@ -118,7 +118,7 @@ int main(int argc, char** argv)
|
|||
quit_button->set_text("Okay");
|
||||
quit_button->set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fixed);
|
||||
quit_button->set_preferred_size(100, 20);
|
||||
quit_button->on_click = [](GUI::Button&) {
|
||||
quit_button->on_click = [] {
|
||||
GUI::Application::the().quit(0);
|
||||
};
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ CalculatorWidget::CalculatorWidget()
|
|||
m_clear_button = add<GUI::Button>();
|
||||
m_clear_button->set_foreground_color(Color::NamedColor::Red);
|
||||
m_clear_button->set_text("C");
|
||||
m_clear_button->on_click = [this](GUI::Button&) {
|
||||
m_clear_button->on_click = [this] {
|
||||
m_keypad.set_value(0.0);
|
||||
m_calculator.clear_operation();
|
||||
update_display();
|
||||
|
@ -96,7 +96,7 @@ CalculatorWidget::CalculatorWidget()
|
|||
m_clear_error_button = add<GUI::Button>();
|
||||
m_clear_error_button->set_foreground_color(Color::NamedColor::Red);
|
||||
m_clear_error_button->set_text("CE");
|
||||
m_clear_error_button->on_click = [this](GUI::Button&) {
|
||||
m_clear_error_button->on_click = [this] {
|
||||
m_calculator.clear_error();
|
||||
update_display();
|
||||
};
|
||||
|
@ -106,7 +106,7 @@ CalculatorWidget::CalculatorWidget()
|
|||
m_backspace_button = add<GUI::Button>();
|
||||
m_backspace_button->set_foreground_color(Color::NamedColor::Red);
|
||||
m_backspace_button->set_text("Backspace");
|
||||
m_backspace_button->on_click = [this](GUI::Button&) {
|
||||
m_backspace_button->on_click = [this] {
|
||||
m_keypad.type_backspace();
|
||||
update_display();
|
||||
};
|
||||
|
@ -117,7 +117,7 @@ CalculatorWidget::CalculatorWidget()
|
|||
m_decimal_point_button->move_to(133, 177);
|
||||
m_decimal_point_button->set_foreground_color(Color::NamedColor::Blue);
|
||||
m_decimal_point_button->set_text(".");
|
||||
m_decimal_point_button->on_click = [this](GUI::Button&) {
|
||||
m_decimal_point_button->on_click = [this] {
|
||||
m_keypad.type_decimal_point();
|
||||
update_display();
|
||||
};
|
||||
|
@ -175,7 +175,7 @@ CalculatorWidget::CalculatorWidget()
|
|||
m_equals_button->move_to(211, 177);
|
||||
m_equals_button->set_foreground_color(Color::NamedColor::Red);
|
||||
m_equals_button->set_text("=");
|
||||
m_equals_button->on_click = [this](GUI::Button&) {
|
||||
m_equals_button->on_click = [this] {
|
||||
double argument = m_keypad.value();
|
||||
double res = m_calculator.finish_operation(argument);
|
||||
m_keypad.set_value(res);
|
||||
|
@ -191,7 +191,7 @@ CalculatorWidget::~CalculatorWidget()
|
|||
void CalculatorWidget::add_button(GUI::Button& button, Calculator::Operation operation)
|
||||
{
|
||||
add_button(button);
|
||||
button.on_click = [this, operation](GUI::Button&) {
|
||||
button.on_click = [this, operation] {
|
||||
double argument = m_keypad.value();
|
||||
double res = m_calculator.begin_operation(operation, argument);
|
||||
m_keypad.set_value(res);
|
||||
|
@ -203,7 +203,7 @@ void CalculatorWidget::add_button(GUI::Button& button, int digit)
|
|||
{
|
||||
add_button(button);
|
||||
button.set_text(String::number(digit));
|
||||
button.on_click = [this, digit](GUI::Button&) {
|
||||
button.on_click = [this, digit] {
|
||||
m_keypad.type_digit(digit);
|
||||
update_display();
|
||||
};
|
||||
|
|
|
@ -193,7 +193,7 @@ void DisplayPropertiesWidget::create_frame()
|
|||
apply_button->set_size_policy(Orientation::Vertical, GUI::SizePolicy::Fixed);
|
||||
apply_button->set_size_policy(Orientation::Horizontal, GUI::SizePolicy::Fixed);
|
||||
apply_button->set_preferred_size(60, 22);
|
||||
apply_button->on_click = [this, tab_widget](GUI::Button&) {
|
||||
apply_button->on_click = [this, tab_widget] {
|
||||
send_settings_to_window_server(tab_widget->active_tab_index());
|
||||
};
|
||||
|
||||
|
@ -202,7 +202,7 @@ void DisplayPropertiesWidget::create_frame()
|
|||
ok_button->set_size_policy(Orientation::Vertical, GUI::SizePolicy::Fixed);
|
||||
ok_button->set_size_policy(Orientation::Horizontal, GUI::SizePolicy::Fixed);
|
||||
ok_button->set_preferred_size(60, 22);
|
||||
ok_button->on_click = [this, tab_widget](GUI::Button&) {
|
||||
ok_button->on_click = [this, tab_widget] {
|
||||
send_settings_to_window_server(tab_widget->active_tab_index());
|
||||
GUI::Application::the().quit();
|
||||
};
|
||||
|
@ -212,7 +212,7 @@ void DisplayPropertiesWidget::create_frame()
|
|||
cancel_button->set_size_policy(Orientation::Vertical, GUI::SizePolicy::Fixed);
|
||||
cancel_button->set_size_policy(Orientation::Horizontal, GUI::SizePolicy::Fixed);
|
||||
cancel_button->set_preferred_size(60, 22);
|
||||
cancel_button->on_click = [](auto&) {
|
||||
cancel_button->on_click = [] {
|
||||
GUI::Application::the().quit();
|
||||
};
|
||||
}
|
||||
|
|
|
@ -139,11 +139,16 @@ PropertiesDialog::PropertiesDialog(GUI::FileSystemModel& model, String path, boo
|
|||
|
||||
button_widget->layout()->add_spacer();
|
||||
|
||||
make_button("OK", button_widget)->on_click = [&](auto&) {if(apply_changes()) close(); };
|
||||
make_button("Cancel", button_widget)->on_click = [&](auto&) { close(); };
|
||||
make_button("OK", button_widget)->on_click = [this] {
|
||||
if (apply_changes())
|
||||
close();
|
||||
};
|
||||
make_button("Cancel", button_widget)->on_click = [this] {
|
||||
close();
|
||||
};
|
||||
|
||||
m_apply_button = make_button("Apply", button_widget);
|
||||
m_apply_button->on_click = [&](auto&) { apply_changes(); };
|
||||
m_apply_button->on_click = [this] { apply_changes(); };
|
||||
m_apply_button->set_enabled(false);
|
||||
|
||||
update();
|
||||
|
|
|
@ -75,13 +75,13 @@ FontEditorWidget::FontEditorWidget(const String& path, RefPtr<Gfx::Font>&& edite
|
|||
};
|
||||
|
||||
m_ui->save_button->set_text("Save");
|
||||
m_ui->save_button->on_click = [this](GUI::Button&) {
|
||||
m_ui->save_button->on_click = [this] {
|
||||
dbgprintf("write to file: '%s'\n", m_path.characters());
|
||||
m_edited_font->write_to_file(m_path);
|
||||
};
|
||||
|
||||
m_ui->quit_button->set_text("Quit");
|
||||
m_ui->quit_button->on_click = [](auto&) {
|
||||
m_ui->quit_button->on_click = [] {
|
||||
exit(0);
|
||||
};
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ SamplerWidget::SamplerWidget(AudioEngine& audio_engine)
|
|||
m_open_button->set_preferred_size(24, 24);
|
||||
m_open_button->set_focusable(false);
|
||||
m_open_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/open.png"));
|
||||
m_open_button->on_click = [this](const auto&) {
|
||||
m_open_button->on_click = [this] {
|
||||
Optional<String> open_path = GUI::FilePicker::get_open_filepath();
|
||||
if (!open_path.has_value())
|
||||
return;
|
||||
|
|
|
@ -81,14 +81,14 @@ SoundPlayerWidget::SoundPlayerWidget(GUI::Window& window, NonnullRefPtr<Audio::C
|
|||
m_play = control_widget->add<GUI::Button>();
|
||||
m_play->set_icon(*m_pause_icon);
|
||||
m_play->set_enabled(false);
|
||||
m_play->on_click = [this](GUI::Button& button) {
|
||||
button.set_icon(m_manager.toggle_pause() ? *m_play_icon : *m_pause_icon);
|
||||
m_play->on_click = [this] {
|
||||
m_play->set_icon(m_manager.toggle_pause() ? *m_play_icon : *m_pause_icon);
|
||||
};
|
||||
|
||||
m_stop = control_widget->add<GUI::Button>();
|
||||
m_stop->set_enabled(false);
|
||||
m_stop->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/stop.png"));
|
||||
m_stop->on_click = [&](GUI::Button&) { m_manager.stop(); };
|
||||
m_stop->on_click = [this] { m_manager.stop(); };
|
||||
|
||||
m_status = add<GUI::Label>();
|
||||
m_status->set_frame_shape(Gfx::FrameShape::Box);
|
||||
|
|
|
@ -103,13 +103,13 @@ PowerDialog::PowerDialog()
|
|||
button_box->layout()->set_spacing(8);
|
||||
|
||||
auto ok_button = button_box->add<GUI::Button>();
|
||||
ok_button->on_click = [this](auto&) {
|
||||
ok_button->on_click = [this] {
|
||||
done(m_selected_option);
|
||||
};
|
||||
ok_button->set_text("OK");
|
||||
|
||||
auto cancel_button = button_box->add<GUI::Button>();
|
||||
cancel_button->on_click = [this](auto&) {
|
||||
cancel_button->on_click = [this] {
|
||||
done(-1);
|
||||
};
|
||||
cancel_button->set_text("Cancel");
|
||||
|
|
|
@ -101,7 +101,7 @@ void TaskbarWindow::create_quick_launch_bar()
|
|||
button->set_icon(Gfx::Bitmap::load_from_file(app_icon_path));
|
||||
// FIXME: the tooltip ends up outside the screen rect.
|
||||
button->set_tooltip(name);
|
||||
button->on_click = [app_executable](auto&) {
|
||||
button->on_click = [app_executable] {
|
||||
pid_t pid = fork();
|
||||
if (pid < 0) {
|
||||
perror("fork");
|
||||
|
|
|
@ -50,7 +50,7 @@ Window& WindowList::ensure_window(const WindowIdentifier& identifier)
|
|||
return *it->value;
|
||||
auto window = make<Window>(identifier);
|
||||
window->set_button(aid_create_button(identifier));
|
||||
window->button()->on_click = [window = window.ptr(), identifier](auto&) {
|
||||
window->button()->on_click = [window = window.ptr(), identifier] {
|
||||
if (window->is_minimized() || !window->is_active()) {
|
||||
GUI::WindowServerConnection::the().post_message(Messages::WindowServer::WM_SetActiveWindow(identifier.client_id(), identifier.window_id()));
|
||||
} else {
|
||||
|
|
|
@ -37,8 +37,8 @@
|
|||
#include <LibGUI/MessageBox.h>
|
||||
#include <LibGUI/StackWidget.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <LibGfx/Font.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/Font.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
@ -249,7 +249,7 @@ int main(int argc, char** argv)
|
|||
if (first)
|
||||
menu_option->set_checked(true);
|
||||
|
||||
menu_option->on_click = [content = content.ptr(), &stack](auto&) {
|
||||
menu_option->on_click = [content = content.ptr(), &stack] {
|
||||
stack->set_active_widget(content);
|
||||
content->invalidate_layout();
|
||||
};
|
||||
|
|
|
@ -53,7 +53,7 @@ int main(int argc, char** argv)
|
|||
button->set_text("Good-bye");
|
||||
button->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed);
|
||||
button->set_preferred_size(0, 20);
|
||||
button->on_click = [&](GUI::Button&) {
|
||||
button->on_click = [&] {
|
||||
app.quit();
|
||||
};
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ FindInFilesWidget::FindInFilesWidget()
|
|||
current_editor().set_focus(true);
|
||||
};
|
||||
|
||||
m_button->on_click = [this](auto&) {
|
||||
m_button->on_click = [this] {
|
||||
auto results_model = find_in_files(m_textbox->text());
|
||||
m_result_view->set_model(results_model);
|
||||
};
|
||||
|
|
|
@ -116,7 +116,7 @@ RefPtr<GUI::Window> make_toolbox_window()
|
|||
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 = [](GUI::Button&) {
|
||||
label_button->on_click = [] {
|
||||
if (auto* form = VBForm::current())
|
||||
form->insert_widget(VBWidgetType::GLabel);
|
||||
};
|
||||
|
@ -125,7 +125,7 @@ RefPtr<GUI::Window> make_toolbox_window()
|
|||
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 = [](GUI::Button&) {
|
||||
button_button->on_click = [] {
|
||||
if (auto* form = VBForm::current())
|
||||
form->insert_widget(VBWidgetType::GButton);
|
||||
};
|
||||
|
@ -133,7 +133,7 @@ RefPtr<GUI::Window> make_toolbox_window()
|
|||
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 = [](GUI::Button&) {
|
||||
spinbox_button->on_click = [] {
|
||||
if (auto* form = VBForm::current())
|
||||
form->insert_widget(VBWidgetType::GSpinBox);
|
||||
};
|
||||
|
@ -141,7 +141,7 @@ RefPtr<GUI::Window> make_toolbox_window()
|
|||
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 = [](GUI::Button&) {
|
||||
editor_button->on_click = [] {
|
||||
if (auto* form = VBForm::current())
|
||||
form->insert_widget(VBWidgetType::GTextEditor);
|
||||
};
|
||||
|
@ -149,7 +149,7 @@ RefPtr<GUI::Window> make_toolbox_window()
|
|||
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 = [](GUI::Button&) {
|
||||
progress_bar_button->on_click = [] {
|
||||
if (auto* form = VBForm::current())
|
||||
form->insert_widget(VBWidgetType::GProgressBar);
|
||||
};
|
||||
|
@ -157,7 +157,7 @@ RefPtr<GUI::Window> make_toolbox_window()
|
|||
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 = [](GUI::Button&) {
|
||||
slider_button->on_click = [] {
|
||||
if (auto* form = VBForm::current())
|
||||
form->insert_widget(VBWidgetType::GSlider);
|
||||
};
|
||||
|
@ -165,7 +165,7 @@ RefPtr<GUI::Window> make_toolbox_window()
|
|||
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 = [](GUI::Button&) {
|
||||
checkbox_button->on_click = [] {
|
||||
if (auto* form = VBForm::current())
|
||||
form->insert_widget(VBWidgetType::GCheckBox);
|
||||
};
|
||||
|
@ -173,7 +173,7 @@ RefPtr<GUI::Window> make_toolbox_window()
|
|||
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 = [](GUI::Button&) {
|
||||
radiobutton_button->on_click = [] {
|
||||
if (auto* form = VBForm::current())
|
||||
form->insert_widget(VBWidgetType::GRadioButton);
|
||||
};
|
||||
|
@ -181,7 +181,7 @@ RefPtr<GUI::Window> make_toolbox_window()
|
|||
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 = [](GUI::Button&) {
|
||||
scrollbar_button->on_click = [] {
|
||||
if (auto* form = VBForm::current())
|
||||
form->insert_widget(VBWidgetType::GScrollBar);
|
||||
};
|
||||
|
@ -189,7 +189,7 @@ RefPtr<GUI::Window> make_toolbox_window()
|
|||
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 = [](GUI::Button&) {
|
||||
groupbox_button->on_click = [] {
|
||||
if (auto* form = VBForm::current())
|
||||
form->insert_widget(VBWidgetType::GGroupBox);
|
||||
};
|
||||
|
|
|
@ -147,7 +147,7 @@ Field::Field(GUI::Label& flag_label, GUI::Label& time_label, GUI::Button& face_b
|
|||
set_fill_with_background_color(true);
|
||||
reset();
|
||||
|
||||
m_face_button.on_click = [this](auto&) { reset(); };
|
||||
m_face_button.on_click = [this] { reset(); };
|
||||
set_face(Face::Default);
|
||||
|
||||
{
|
||||
|
@ -260,7 +260,7 @@ void Field::reset()
|
|||
square.label->set_icon(square.has_mine ? m_mine_bitmap : nullptr);
|
||||
if (!square.button) {
|
||||
square.button = add<SquareButton>();
|
||||
square.button->on_click = [this, &square](GUI::Button&) {
|
||||
square.button->on_click = [this, &square] {
|
||||
on_square_clicked(square);
|
||||
};
|
||||
square.button->on_right_click = [this, &square] {
|
||||
|
|
|
@ -83,7 +83,7 @@ AboutDialog::AboutDialog(const StringView& name, const Gfx::Bitmap* icon, Core::
|
|||
auto ok_button = button_container->add<Button>("OK");
|
||||
ok_button->set_size_policy(SizePolicy::Fixed, SizePolicy::Fixed);
|
||||
ok_button->set_preferred_size(80, 20);
|
||||
ok_button->on_click = [this](auto&) {
|
||||
ok_button->on_click = [this] {
|
||||
done(Dialog::ExecOK);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ void Button::click()
|
|||
set_checked(!is_checked());
|
||||
}
|
||||
if (on_click)
|
||||
on_click(*this);
|
||||
on_click();
|
||||
if (m_action)
|
||||
m_action->activate(this);
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
void set_text_alignment(Gfx::TextAlignment text_alignment) { m_text_alignment = text_alignment; }
|
||||
Gfx::TextAlignment text_alignment() const { return m_text_alignment; }
|
||||
|
||||
Function<void(Button&)> on_click;
|
||||
Function<void()> on_click;
|
||||
|
||||
void set_button_style(Gfx::ButtonStyle style) { m_button_style = style; }
|
||||
Gfx::ButtonStyle button_style() const { return m_button_style; }
|
||||
|
|
|
@ -75,13 +75,13 @@ void ColorPicker::build()
|
|||
auto cancel_button = right_vertical_container->add<Button>("Cancel");
|
||||
cancel_button->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
||||
cancel_button->set_preferred_size(0, 20);
|
||||
cancel_button->on_click = [&](auto&) {
|
||||
cancel_button->on_click = [&] {
|
||||
done(Dialog::ExecCancel);
|
||||
};
|
||||
auto ok_button = right_vertical_container->add<Button>("Okay");
|
||||
ok_button->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
||||
ok_button->set_preferred_size(0, 20);
|
||||
ok_button->on_click = [&](auto&) {
|
||||
ok_button->on_click = [&] {
|
||||
done(Dialog::ExecOK);
|
||||
};
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ ComboBox::ComboBox()
|
|||
m_open_button = add<Button>();
|
||||
m_open_button->set_focusable(false);
|
||||
m_open_button->set_text("\xc3\xb7");
|
||||
m_open_button->on_click = [this](auto&) {
|
||||
m_open_button->on_click = [this] {
|
||||
if (m_list_window->is_visible())
|
||||
close();
|
||||
else
|
||||
|
|
|
@ -210,7 +210,7 @@ FilePicker::FilePicker(Mode mode, const StringView& file_name, const StringView&
|
|||
cancel_button->set_size_policy(SizePolicy::Fixed, SizePolicy::Fill);
|
||||
cancel_button->set_preferred_size(80, 0);
|
||||
cancel_button->set_text("Cancel");
|
||||
cancel_button->on_click = [this](auto&) {
|
||||
cancel_button->on_click = [this] {
|
||||
done(ExecCancel);
|
||||
};
|
||||
|
||||
|
@ -218,7 +218,7 @@ FilePicker::FilePicker(Mode mode, const StringView& file_name, const StringView&
|
|||
ok_button->set_size_policy(SizePolicy::Fixed, SizePolicy::Fill);
|
||||
ok_button->set_preferred_size(80, 0);
|
||||
ok_button->set_text(ok_button_name(m_mode));
|
||||
ok_button->on_click = [this](auto&) {
|
||||
ok_button->on_click = [this] {
|
||||
on_file_return();
|
||||
};
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ void InputBox::build()
|
|||
m_cancel_button->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
||||
m_cancel_button->set_preferred_size(0, 20);
|
||||
m_cancel_button->set_text("Cancel");
|
||||
m_cancel_button->on_click = [this](auto&) {
|
||||
m_cancel_button->on_click = [this] {
|
||||
dbgprintf("GInputBox: Cancel button clicked\n");
|
||||
done(ExecCancel);
|
||||
};
|
||||
|
@ -93,7 +93,7 @@ void InputBox::build()
|
|||
m_ok_button->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
||||
m_ok_button->set_preferred_size(0, 20);
|
||||
m_ok_button->set_text("OK");
|
||||
m_ok_button->on_click = [this](auto&) {
|
||||
m_ok_button->on_click = [this] {
|
||||
dbgprintf("GInputBox: OK button clicked\n");
|
||||
m_text_value = m_text_editor->text();
|
||||
done(ExecOK);
|
||||
|
|
|
@ -131,7 +131,7 @@ void MessageBox::build()
|
|||
button->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
||||
button->set_preferred_size(0, 20);
|
||||
button->set_text(label);
|
||||
button->on_click = [this, label, result](auto&) {
|
||||
button->on_click = [this, label, result] {
|
||||
dbg() << "GUI::MessageBox: '" << label << "' button clicked";
|
||||
done(result);
|
||||
};
|
||||
|
|
|
@ -45,12 +45,12 @@ SpinBox::SpinBox()
|
|||
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->on_click = [this] { set_value(m_value + 1); };
|
||||
m_increment_button->set_auto_repeat_interval(150);
|
||||
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); };
|
||||
m_decrement_button->on_click = [this] { set_value(m_value - 1); };
|
||||
m_decrement_button->set_auto_repeat_interval(150);
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ RefPtr<LayoutNode> HTMLInputElement::create_layout_node(const StyleProperties*)
|
|||
auto button = html_view.add<GUI::Button>(value());
|
||||
int text_width = Gfx::Font::default_font().width(value());
|
||||
button->set_relative_rect(0, 0, text_width + 20, 20);
|
||||
button->on_click = [this](auto&) {
|
||||
button->on_click = [this] {
|
||||
if (auto* form = first_ancestor_of_type<HTMLFormElement>()) {
|
||||
// FIXME: Remove this const_cast once we have a non-const first_ancestor_of_type.
|
||||
const_cast<HTMLFormElement*>(form)->submit();
|
||||
|
|
|
@ -83,7 +83,7 @@ NotificationWindow::NotificationWindow(const String& text, const String& title)
|
|||
right_container->set_layout(make<GUI::HorizontalBoxLayout>());
|
||||
|
||||
auto button = right_container->add<GUI::Button>("Okay");
|
||||
button->on_click = [this](auto&) {
|
||||
button->on_click = [this] {
|
||||
s_windows.remove(this);
|
||||
close();
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue