summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-03-03 17:02:38 +0100
committerAndreas Kling <kling@serenityos.org>2020-03-03 17:02:38 +0100
commita26b63a9585631d39c97db5b5808aca351894da8 (patch)
tree28f4f48f4f7c8487fb2326e23d6b070ee6e785e6
parentb1d35248e45a6c4e4e9b9a55aa5d8fa60e60c276 (diff)
downloadserenity-a26b63a9585631d39c97db5b5808aca351894da8.zip
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.
-rw-r--r--Applications/About/main.cpp2
-rw-r--r--Applications/Calculator/CalculatorWidget.cpp14
-rw-r--r--Applications/DisplayProperties/DisplayProperties.cpp6
-rw-r--r--Applications/FileManager/PropertiesDialog.cpp11
-rw-r--r--Applications/FontEditor/FontEditor.cpp4
-rw-r--r--Applications/Piano/SamplerWidget.cpp2
-rw-r--r--Applications/SoundPlayer/SoundPlayerWidget.cpp6
-rw-r--r--Applications/SystemMenu/PowerDialog.cpp4
-rw-r--r--Applications/Taskbar/TaskbarWindow.cpp2
-rw-r--r--Applications/Taskbar/WindowList.cpp2
-rw-r--r--Applications/Welcome/main.cpp4
-rw-r--r--Demos/HelloWorld/main.cpp2
-rw-r--r--DevTools/HackStudio/FindInFilesWidget.cpp2
-rw-r--r--DevTools/VisualBuilder/main.cpp20
-rw-r--r--Games/Minesweeper/Field.cpp4
-rw-r--r--Libraries/LibGUI/AboutDialog.cpp2
-rw-r--r--Libraries/LibGUI/Button.cpp2
-rw-r--r--Libraries/LibGUI/Button.h2
-rw-r--r--Libraries/LibGUI/ColorPicker.cpp4
-rw-r--r--Libraries/LibGUI/ComboBox.cpp2
-rw-r--r--Libraries/LibGUI/FilePicker.cpp4
-rw-r--r--Libraries/LibGUI/InputBox.cpp4
-rw-r--r--Libraries/LibGUI/MessageBox.cpp2
-rw-r--r--Libraries/LibGUI/SpinBox.cpp4
-rw-r--r--Libraries/LibHTML/DOM/HTMLInputElement.cpp2
-rw-r--r--Servers/NotificationServer/NotificationWindow.cpp2
26 files changed, 60 insertions, 55 deletions
diff --git a/Applications/About/main.cpp b/Applications/About/main.cpp
index f0ff7afea4..c1467cf39b 100644
--- a/Applications/About/main.cpp
+++ b/Applications/About/main.cpp
@@ -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);
};
diff --git a/Applications/Calculator/CalculatorWidget.cpp b/Applications/Calculator/CalculatorWidget.cpp
index 1adf7b9518..ebed7602a9 100644
--- a/Applications/Calculator/CalculatorWidget.cpp
+++ b/Applications/Calculator/CalculatorWidget.cpp
@@ -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();
};
diff --git a/Applications/DisplayProperties/DisplayProperties.cpp b/Applications/DisplayProperties/DisplayProperties.cpp
index 225457c83a..e84e18135a 100644
--- a/Applications/DisplayProperties/DisplayProperties.cpp
+++ b/Applications/DisplayProperties/DisplayProperties.cpp
@@ -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();
};
}
diff --git a/Applications/FileManager/PropertiesDialog.cpp b/Applications/FileManager/PropertiesDialog.cpp
index c8fb51aca9..4c43f069ca 100644
--- a/Applications/FileManager/PropertiesDialog.cpp
+++ b/Applications/FileManager/PropertiesDialog.cpp
@@ -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();
diff --git a/Applications/FontEditor/FontEditor.cpp b/Applications/FontEditor/FontEditor.cpp
index 06775daabe..4540151deb 100644
--- a/Applications/FontEditor/FontEditor.cpp
+++ b/Applications/FontEditor/FontEditor.cpp
@@ -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);
};
diff --git a/Applications/Piano/SamplerWidget.cpp b/Applications/Piano/SamplerWidget.cpp
index 543cee8ebb..d4903878ca 100644
--- a/Applications/Piano/SamplerWidget.cpp
+++ b/Applications/Piano/SamplerWidget.cpp
@@ -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;
diff --git a/Applications/SoundPlayer/SoundPlayerWidget.cpp b/Applications/SoundPlayer/SoundPlayerWidget.cpp
index b3625e2e23..296c641b77 100644
--- a/Applications/SoundPlayer/SoundPlayerWidget.cpp
+++ b/Applications/SoundPlayer/SoundPlayerWidget.cpp
@@ -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);
diff --git a/Applications/SystemMenu/PowerDialog.cpp b/Applications/SystemMenu/PowerDialog.cpp
index b81f911353..0ce7fa87f8 100644
--- a/Applications/SystemMenu/PowerDialog.cpp
+++ b/Applications/SystemMenu/PowerDialog.cpp
@@ -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");
diff --git a/Applications/Taskbar/TaskbarWindow.cpp b/Applications/Taskbar/TaskbarWindow.cpp
index 0e06c8e0c8..2a20d4148f 100644
--- a/Applications/Taskbar/TaskbarWindow.cpp
+++ b/Applications/Taskbar/TaskbarWindow.cpp
@@ -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");
diff --git a/Applications/Taskbar/WindowList.cpp b/Applications/Taskbar/WindowList.cpp
index e1547a3dd8..948dcb0452 100644
--- a/Applications/Taskbar/WindowList.cpp
+++ b/Applications/Taskbar/WindowList.cpp
@@ -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 {
diff --git a/Applications/Welcome/main.cpp b/Applications/Welcome/main.cpp
index ea25ab057d..17d6369273 100644
--- a/Applications/Welcome/main.cpp
+++ b/Applications/Welcome/main.cpp
@@ -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();
};
diff --git a/Demos/HelloWorld/main.cpp b/Demos/HelloWorld/main.cpp
index 1abcd55738..73ce17a3a0 100644
--- a/Demos/HelloWorld/main.cpp
+++ b/Demos/HelloWorld/main.cpp
@@ -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();
};
diff --git a/DevTools/HackStudio/FindInFilesWidget.cpp b/DevTools/HackStudio/FindInFilesWidget.cpp
index ad6a0209dc..80711db3b2 100644
--- a/DevTools/HackStudio/FindInFilesWidget.cpp
+++ b/DevTools/HackStudio/FindInFilesWidget.cpp
@@ -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);
};
diff --git a/DevTools/VisualBuilder/main.cpp b/DevTools/VisualBuilder/main.cpp
index b06ca890ad..6b38a5fa46 100644
--- a/DevTools/VisualBuilder/main.cpp
+++ b/DevTools/VisualBuilder/main.cpp
@@ -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);
};
diff --git a/Games/Minesweeper/Field.cpp b/Games/Minesweeper/Field.cpp
index 13b86757c0..fde8517cbf 100644
--- a/Games/Minesweeper/Field.cpp
+++ b/Games/Minesweeper/Field.cpp
@@ -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] {
diff --git a/Libraries/LibGUI/AboutDialog.cpp b/Libraries/LibGUI/AboutDialog.cpp
index 4a0087307f..615d30ae20 100644
--- a/Libraries/LibGUI/AboutDialog.cpp
+++ b/Libraries/LibGUI/AboutDialog.cpp
@@ -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);
};
}
diff --git a/Libraries/LibGUI/Button.cpp b/Libraries/LibGUI/Button.cpp
index 59c2ecc664..d127fb3cc6 100644
--- a/Libraries/LibGUI/Button.cpp
+++ b/Libraries/LibGUI/Button.cpp
@@ -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);
}
diff --git a/Libraries/LibGUI/Button.h b/Libraries/LibGUI/Button.h
index 4ad0f2190e..7ab0d8a9d7 100644
--- a/Libraries/LibGUI/Button.h
+++ b/Libraries/LibGUI/Button.h
@@ -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; }
diff --git a/Libraries/LibGUI/ColorPicker.cpp b/Libraries/LibGUI/ColorPicker.cpp
index cc6b0700b5..d1e8009054 100644
--- a/Libraries/LibGUI/ColorPicker.cpp
+++ b/Libraries/LibGUI/ColorPicker.cpp
@@ -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);
};
diff --git a/Libraries/LibGUI/ComboBox.cpp b/Libraries/LibGUI/ComboBox.cpp
index 617a67dd4d..f6132a70fb 100644
--- a/Libraries/LibGUI/ComboBox.cpp
+++ b/Libraries/LibGUI/ComboBox.cpp
@@ -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
diff --git a/Libraries/LibGUI/FilePicker.cpp b/Libraries/LibGUI/FilePicker.cpp
index 5ee3a59751..96a6005c1d 100644
--- a/Libraries/LibGUI/FilePicker.cpp
+++ b/Libraries/LibGUI/FilePicker.cpp
@@ -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();
};
diff --git a/Libraries/LibGUI/InputBox.cpp b/Libraries/LibGUI/InputBox.cpp
index e592ad90f4..4d4baf6b45 100644
--- a/Libraries/LibGUI/InputBox.cpp
+++ b/Libraries/LibGUI/InputBox.cpp
@@ -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);
diff --git a/Libraries/LibGUI/MessageBox.cpp b/Libraries/LibGUI/MessageBox.cpp
index 644d770e93..e0b00f4fbd 100644
--- a/Libraries/LibGUI/MessageBox.cpp
+++ b/Libraries/LibGUI/MessageBox.cpp
@@ -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);
};
diff --git a/Libraries/LibGUI/SpinBox.cpp b/Libraries/LibGUI/SpinBox.cpp
index 17bc84e9f2..46bf956cb7 100644
--- a/Libraries/LibGUI/SpinBox.cpp
+++ b/Libraries/LibGUI/SpinBox.cpp
@@ -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);
}
diff --git a/Libraries/LibHTML/DOM/HTMLInputElement.cpp b/Libraries/LibHTML/DOM/HTMLInputElement.cpp
index 7c72fb1993..c22c694fde 100644
--- a/Libraries/LibHTML/DOM/HTMLInputElement.cpp
+++ b/Libraries/LibHTML/DOM/HTMLInputElement.cpp
@@ -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();
diff --git a/Servers/NotificationServer/NotificationWindow.cpp b/Servers/NotificationServer/NotificationWindow.cpp
index c112569c04..8ec50c3812 100644
--- a/Servers/NotificationServer/NotificationWindow.cpp
+++ b/Servers/NotificationServer/NotificationWindow.cpp
@@ -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();
};