diff --git a/Applications/About/main.cpp b/Applications/About/main.cpp index ee153c97cad..336ccb6f002 100644 --- a/Applications/About/main.cpp +++ b/Applications/About/main.cpp @@ -117,7 +117,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 = [] { + quit_button.on_click = [](auto) { GUI::Application::the().quit(0); }; diff --git a/Applications/Browser/BookmarksBarWidget.cpp b/Applications/Browser/BookmarksBarWidget.cpp index bda2edfee45..18352045ad9 100644 --- a/Applications/Browser/BookmarksBarWidget.cpp +++ b/Applications/Browser/BookmarksBarWidget.cpp @@ -62,7 +62,7 @@ BookmarksBarWidget::BookmarksBarWidget(const String& bookmarks_file, bool enable m_additional->set_text(">"); m_additional->set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fixed); m_additional->set_preferred_size(14, 20); - m_additional->on_click = [&] { + m_additional->on_click = [this](auto) { if (m_additional_menu) { m_additional_menu->popup(m_additional->relative_position().translated(relative_position().translated(m_additional->window()->position()))); } @@ -123,7 +123,7 @@ void BookmarksBarWidget::did_update_model() button.set_preferred_size(font().width(title) + 32, 20); button.set_relative_rect(rect); - button.on_click = [title, url, this] { + button.on_click = [title, url, this](auto) { if (on_bookmark_click) on_bookmark_click(title, url); }; @@ -166,7 +166,7 @@ void BookmarksBarWidget::update_content_size() m_additional_menu->add_action(GUI::Action::create(bookmark.text(), Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-html.png"), [&](auto&) { - bookmark.on_click(); + bookmark.on_click(0); })); } } diff --git a/Applications/Browser/DownloadWidget.cpp b/Applications/Browser/DownloadWidget.cpp index a187c68d52e..2aabd5242fd 100644 --- a/Applications/Browser/DownloadWidget.cpp +++ b/Applications/Browser/DownloadWidget.cpp @@ -31,9 +31,9 @@ #include #include #include -#include #include #include +#include #include #include #include @@ -106,7 +106,7 @@ DownloadWidget::DownloadWidget(const URL& url) m_cancel_button = button_container.add("Cancel"); m_cancel_button->set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fixed); m_cancel_button->set_preferred_size(100, 22); - m_cancel_button->on_click = [this] { + m_cancel_button->on_click = [this](auto) { bool success = m_download->stop(); ASSERT(success); window()->close(); @@ -116,7 +116,7 @@ DownloadWidget::DownloadWidget(const URL& url) m_close_button->set_enabled(false); m_close_button->set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fixed); m_close_button->set_preferred_size(100, 22); - m_close_button->on_click = [this] { + m_close_button->on_click = [this](auto) { window()->close(); }; } diff --git a/Applications/Browser/Tab.cpp b/Applications/Browser/Tab.cpp index eba8cd31aac..7ca38f404a2 100644 --- a/Applications/Browser/Tab.cpp +++ b/Applications/Browser/Tab.cpp @@ -118,7 +118,7 @@ Tab::Tab() m_bookmark_button->set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fixed); m_bookmark_button->set_preferred_size(22, 22); - m_bookmark_button->on_click = [this] { + m_bookmark_button->on_click = [this](auto) { auto url = m_html_widget->main_frame().document()->url().to_string(); if (BookmarksBarWidget::the().contains_bookmark(url)) { BookmarksBarWidget::the().remove_bookmark(url); diff --git a/Applications/Calculator/CalculatorWidget.cpp b/Applications/Calculator/CalculatorWidget.cpp index ebed7602a9f..a51251dc48b 100644 --- a/Applications/Calculator/CalculatorWidget.cpp +++ b/Applications/Calculator/CalculatorWidget.cpp @@ -85,7 +85,7 @@ CalculatorWidget::CalculatorWidget() m_clear_button = add(); m_clear_button->set_foreground_color(Color::NamedColor::Red); m_clear_button->set_text("C"); - m_clear_button->on_click = [this] { + m_clear_button->on_click = [this](auto) { m_keypad.set_value(0.0); m_calculator.clear_operation(); update_display(); @@ -96,7 +96,7 @@ CalculatorWidget::CalculatorWidget() m_clear_error_button = add(); m_clear_error_button->set_foreground_color(Color::NamedColor::Red); m_clear_error_button->set_text("CE"); - m_clear_error_button->on_click = [this] { + m_clear_error_button->on_click = [this](auto) { m_calculator.clear_error(); update_display(); }; @@ -106,7 +106,7 @@ CalculatorWidget::CalculatorWidget() m_backspace_button = add(); m_backspace_button->set_foreground_color(Color::NamedColor::Red); m_backspace_button->set_text("Backspace"); - m_backspace_button->on_click = [this] { + m_backspace_button->on_click = [this](auto) { 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] { + m_decimal_point_button->on_click = [this](auto) { 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] { + m_equals_button->on_click = [this](auto) { 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] { + button.on_click = [this, operation](auto) { 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] { + button.on_click = [this, digit](auto) { m_keypad.type_digit(digit); update_display(); }; diff --git a/Applications/Calendar/AddEventDialog.cpp b/Applications/Calendar/AddEventDialog.cpp index 50f1080ed70..9d0eabe022b 100644 --- a/Applications/Calendar/AddEventDialog.cpp +++ b/Applications/Calendar/AddEventDialog.cpp @@ -107,7 +107,7 @@ AddEventDialog::AddEventDialog(RefPtr calendar, Core::DateTime date_ti auto& ok_button = button_container.add("OK"); ok_button.set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fixed); ok_button.set_preferred_size(80, 20); - ok_button.on_click = [this] { + ok_button.on_click = [this](auto) { dbg() << "TODO: Add event icon on specific tile"; done(Dialog::ExecOK); }; diff --git a/Applications/Calendar/CalendarWidget.cpp b/Applications/Calendar/CalendarWidget.cpp index 79486fa8c94..3f127e41404 100644 --- a/Applications/Calendar/CalendarWidget.cpp +++ b/Applications/Calendar/CalendarWidget.cpp @@ -64,7 +64,7 @@ CalendarWidget::CalendarWidget() m_prev_month_button->set_font(Gfx::Font::default_bold_font()); m_prev_month_button->set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fixed); m_prev_month_button->set_preferred_size(40, 40); - m_prev_month_button->on_click = [this] { + m_prev_month_button->on_click = [this](auto) { int m_target_month = m_calendar->selected_month() - 1; int m_target_year = m_calendar->selected_year(); @@ -79,7 +79,7 @@ CalendarWidget::CalendarWidget() m_next_month_button->set_font(Gfx::Font::default_bold_font()); m_next_month_button->set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fixed); m_next_month_button->set_preferred_size(40, 40); - m_next_month_button->on_click = [this] { + m_next_month_button->on_click = [this](auto) { int m_target_month = m_calendar->selected_month() + 1; int m_target_year = m_calendar->selected_year(); @@ -100,7 +100,7 @@ CalendarWidget::CalendarWidget() m_add_event_button = top_right_container.add("Add Event"); m_add_event_button->set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fixed); m_add_event_button->set_preferred_size(100, 25); - m_add_event_button->on_click = [this] { + m_add_event_button->on_click = [this](auto) { show_add_event_window(); }; diff --git a/Applications/DisplaySettings/DisplaySettings.cpp b/Applications/DisplaySettings/DisplaySettings.cpp index 57144f06ab8..aa38bbc2a82 100644 --- a/Applications/DisplaySettings/DisplaySettings.cpp +++ b/Applications/DisplaySettings/DisplaySettings.cpp @@ -146,7 +146,7 @@ void DisplaySettingsWidget::create_frame() button.set_button_style(Gfx::ButtonStyle::CoolBar); button.set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fixed); button.set_preferred_size(22, 22); - button.on_click = [this]() { + button.on_click = [this](auto) { Optional open_path = GUI::FilePicker::get_open_filepath("Select wallpaper from file system."); if (!open_path.has_value()) @@ -240,7 +240,7 @@ void DisplaySettingsWidget::create_frame() ok_button.set_text("OK"); ok_button.set_size_policy(Orientation::Horizontal, GUI::SizePolicy::Fixed); ok_button.set_preferred_size(60, 22); - ok_button.on_click = [this] { + ok_button.on_click = [this](auto) { send_settings_to_window_server(); GUI::Application::the().quit(); }; @@ -249,7 +249,7 @@ void DisplaySettingsWidget::create_frame() cancel_button.set_text("Cancel"); cancel_button.set_size_policy(Orientation::Horizontal, GUI::SizePolicy::Fixed); cancel_button.set_preferred_size(60, 22); - cancel_button.on_click = [] { + cancel_button.on_click = [](auto) { GUI::Application::the().quit(); }; @@ -257,7 +257,7 @@ void DisplaySettingsWidget::create_frame() apply_button.set_text("Apply"); apply_button.set_size_policy(Orientation::Horizontal, GUI::SizePolicy::Fixed); apply_button.set_preferred_size(60, 22); - apply_button.on_click = [this] { + apply_button.on_click = [this](auto) { send_settings_to_window_server(); }; } diff --git a/Applications/FileManager/PropertiesDialog.cpp b/Applications/FileManager/PropertiesDialog.cpp index 94597b2762f..0813e5fbd01 100644 --- a/Applications/FileManager/PropertiesDialog.cpp +++ b/Applications/FileManager/PropertiesDialog.cpp @@ -149,16 +149,16 @@ PropertiesDialog::PropertiesDialog(GUI::FileSystemModel& model, String path, boo button_widget.layout()->add_spacer(); - make_button("OK", button_widget).on_click = [this] { + make_button("OK", button_widget).on_click = [this](auto) { if (apply_changes()) close(); }; - make_button("Cancel", button_widget).on_click = [this] { + make_button("Cancel", button_widget).on_click = [this](auto) { close(); }; m_apply_button = make_button("Apply", button_widget); - m_apply_button->on_click = [this] { apply_changes(); }; + m_apply_button->on_click = [this](auto) { apply_changes(); }; m_apply_button->set_enabled(false); update(); diff --git a/Applications/FontEditor/FontEditor.cpp b/Applications/FontEditor/FontEditor.cpp index 0cb59fb7b9e..f043b14eb40 100644 --- a/Applications/FontEditor/FontEditor.cpp +++ b/Applications/FontEditor/FontEditor.cpp @@ -219,7 +219,7 @@ FontEditorWidget::FontEditorWidget(const String& path, RefPtr&& edite save_button.set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fill); save_button.set_preferred_size(80, 0); save_button.set_text("Save"); - save_button.on_click = [this] { + save_button.on_click = [this](auto) { auto ret_val = m_edited_font->write_to_file(m_path); if (!ret_val) { GUI::MessageBox::show("The font file could not be saved.", "Save failed", GUI::MessageBox::Type::Error, GUI::MessageBox::InputType::OK, window()); @@ -230,7 +230,7 @@ FontEditorWidget::FontEditorWidget(const String& path, RefPtr&& edite quit_button.set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fill); quit_button.set_preferred_size(80, 0); quit_button.set_text("Quit"); - quit_button.on_click = [this] { + quit_button.on_click = [](auto) { exit(0); }; diff --git a/Applications/Piano/SamplerWidget.cpp b/Applications/Piano/SamplerWidget.cpp index 61b92fd52bf..64817fc32a3 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] { + m_open_button->on_click = [this](auto) { Optional 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 9edf5a533b0..082e5738c37 100644 --- a/Applications/SoundPlayer/SoundPlayerWidget.cpp +++ b/Applications/SoundPlayer/SoundPlayerWidget.cpp @@ -81,14 +81,14 @@ SoundPlayerWidget::SoundPlayerWidget(GUI::Window& window, NonnullRefPtr(); m_play->set_icon(*m_pause_icon); m_play->set_enabled(false); - m_play->on_click = [this] { + m_play->on_click = [this](auto) { m_play->set_icon(m_manager.toggle_pause() ? *m_play_icon : *m_pause_icon); }; m_stop = control_widget.add(); m_stop->set_enabled(false); m_stop->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/stop.png")); - m_stop->on_click = [this] { m_manager.stop(); }; + m_stop->on_click = [this](auto) { m_manager.stop(); }; m_status = add(); m_status->set_frame_shape(Gfx::FrameShape::Box); diff --git a/Applications/Welcome/main.cpp b/Applications/Welcome/main.cpp index 11febbdee4f..1415b3227c9 100644 --- a/Applications/Welcome/main.cpp +++ b/Applications/Welcome/main.cpp @@ -248,7 +248,7 @@ int main(int argc, char** argv) if (first) menu_option.set_checked(true); - menu_option.on_click = [content = &content, &stack] { + menu_option.on_click = [content = &content, &stack](auto) { stack.set_active_widget(content); content->invalidate_layout(); }; diff --git a/Demos/HelloWorld/main.cpp b/Demos/HelloWorld/main.cpp index 7bbe69a1dc8..79e69349260 100644 --- a/Demos/HelloWorld/main.cpp +++ b/Demos/HelloWorld/main.cpp @@ -52,7 +52,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 = [&] { + button.on_click = [&](auto) { app.quit(); }; diff --git a/Demos/WidgetGallery/main.cpp b/Demos/WidgetGallery/main.cpp index 58f6ead306a..90f38f39f5a 100644 --- a/Demos/WidgetGallery/main.cpp +++ b/Demos/WidgetGallery/main.cpp @@ -220,7 +220,7 @@ int main(int argc, char** argv) auto& show_buton = tab_msgbox.add("Show"); show_buton.set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed); show_buton.set_preferred_size(0, 20); - show_buton.on_click = [&]() { + show_buton.on_click = [&](auto) { GUI::MessageBox::show(content_textbox.text(), title_textbox.text(), msg_box_type, msg_box_input_type, window); }; diff --git a/DevTools/HackStudio/FindInFilesWidget.cpp b/DevTools/HackStudio/FindInFilesWidget.cpp index d146b6fd210..95a556e3657 100644 --- a/DevTools/HackStudio/FindInFilesWidget.cpp +++ b/DevTools/HackStudio/FindInFilesWidget.cpp @@ -153,7 +153,7 @@ FindInFilesWidget::FindInFilesWidget() current_editor().set_focus(true); }; - m_button->on_click = [this] { + m_button->on_click = [this](auto) { 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 c008dda49b0..3f66df42ee0 100644 --- a/DevTools/VisualBuilder/main.cpp +++ b/DevTools/VisualBuilder/main.cpp @@ -112,7 +112,7 @@ RefPtr 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 = [] { + label_button.on_click = [](auto) { if (auto* form = VBForm::current()) form->insert_widget(VBWidgetType::GLabel); }; @@ -121,7 +121,7 @@ RefPtr 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 = [] { + button_button.on_click = [](auto) { if (auto* form = VBForm::current()) form->insert_widget(VBWidgetType::GButton); }; @@ -129,7 +129,7 @@ RefPtr 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 = [] { + spinbox_button.on_click = [](auto) { if (auto* form = VBForm::current()) form->insert_widget(VBWidgetType::GSpinBox); }; @@ -137,7 +137,7 @@ RefPtr 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 = [] { + editor_button.on_click = [](auto) { if (auto* form = VBForm::current()) form->insert_widget(VBWidgetType::GTextEditor); }; @@ -145,7 +145,7 @@ RefPtr 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 = [] { + progress_bar_button.on_click = [](auto) { if (auto* form = VBForm::current()) form->insert_widget(VBWidgetType::GProgressBar); }; @@ -153,7 +153,7 @@ RefPtr 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 = [] { + slider_button.on_click = [](auto) { if (auto* form = VBForm::current()) form->insert_widget(VBWidgetType::GSlider); }; @@ -161,7 +161,7 @@ RefPtr 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 = [] { + checkbox_button.on_click = [](auto) { if (auto* form = VBForm::current()) form->insert_widget(VBWidgetType::GCheckBox); }; @@ -169,7 +169,7 @@ RefPtr 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 = [] { + radiobutton_button.on_click = [](auto) { if (auto* form = VBForm::current()) form->insert_widget(VBWidgetType::GRadioButton); }; @@ -177,7 +177,7 @@ RefPtr 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 = [] { + scrollbar_button.on_click = [](auto) { if (auto* form = VBForm::current()) form->insert_widget(VBWidgetType::GScrollBar); }; @@ -185,7 +185,7 @@ RefPtr 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 = [] { + groupbox_button.on_click = [](auto) { if (auto* form = VBForm::current()) form->insert_widget(VBWidgetType::GGroupBox); }; diff --git a/Games/Minesweeper/Field.cpp b/Games/Minesweeper/Field.cpp index fde8517cbf3..c41fd59de92 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] { reset(); }; + m_face_button.on_click = [this](auto) { 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(); - square.button->on_click = [this, &square] { + square.button->on_click = [this, &square](auto) { on_square_clicked(square); }; square.button->on_right_click = [this, &square] { diff --git a/Libraries/LibGUI/AboutDialog.cpp b/Libraries/LibGUI/AboutDialog.cpp index f2a3ac4c4dd..c6cf1337ef6 100644 --- a/Libraries/LibGUI/AboutDialog.cpp +++ b/Libraries/LibGUI/AboutDialog.cpp @@ -85,7 +85,7 @@ AboutDialog::AboutDialog(const StringView& name, const Gfx::Bitmap* icon, Window auto& ok_button = button_container.add