diff --git a/UI/ControlMappingScreen.cpp b/UI/ControlMappingScreen.cpp index 6fa0676f9e..2ca18633f0 100644 --- a/UI/ControlMappingScreen.cpp +++ b/UI/ControlMappingScreen.cpp @@ -243,16 +243,24 @@ void ControlMappingScreen::CreateViews() { root_ = new LinearLayout(ORIENT_HORIZONTAL); LinearLayout *leftColumn = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(200, FILL_PARENT, Margins(10, 0, 0, 10))); - leftColumn->Add(new Choice(km->T("Clear All")))->OnClick.Handle(this, &ControlMappingScreen::OnClearMapping); - leftColumn->Add(new Choice(km->T("Default All")))->OnClick.Handle(this, &ControlMappingScreen::OnDefaultMapping); - + leftColumn->Add(new Choice(km->T("Clear All")))->OnClick.Add([](UI::EventParams &) { + KeyMap::ClearAllMappings(); + return UI::EVENT_DONE; + }); + leftColumn->Add(new Choice(km->T("Default All")))->OnClick.Add([](UI::EventParams &) { + KeyMap::RestoreDefault(); + return UI::EVENT_DONE; + }); std::string sysName = System_GetProperty(SYSPROP_NAME); // If there's a builtin controller, restore to default should suffice. No need to conf the controller on top. if (!KeyMap::HasBuiltinController(sysName) && KeyMap::GetSeenPads().size()) { leftColumn->Add(new Choice(km->T("Autoconfigure")))->OnClick.Handle(this, &ControlMappingScreen::OnAutoConfigure); } - leftColumn->Add(new Choice(km->T("Show PSP")))->OnClick.Handle(this, &ControlMappingScreen::OnVisualizeMapping); + leftColumn->Add(new Choice(km->T("Show PSP")))->OnClick.Add([=](UI::EventParams &) { + screenManager()->push(new VisualMappingScreen(gamePath_)); + return UI::EVENT_DONE; + }); leftColumn->Add(new CheckBox(&g_Config.bAllowMappingCombos, km->T("Allow combo mappings"))); leftColumn->Add(new Spacer(new LinearLayoutParams(1.0f))); @@ -287,16 +295,6 @@ void ControlMappingScreen::update() { SetVRAppMode(VRAppMode::VR_MENU_MODE); } -UI::EventReturn ControlMappingScreen::OnClearMapping(UI::EventParams ¶ms) { - KeyMap::ClearAllMappings(); - return UI::EVENT_DONE; -} - -UI::EventReturn ControlMappingScreen::OnDefaultMapping(UI::EventParams ¶ms) { - KeyMap::RestoreDefault(); - return UI::EVENT_DONE; -} - UI::EventReturn ControlMappingScreen::OnAutoConfigure(UI::EventParams ¶ms) { std::vector items; const auto seenPads = KeyMap::GetSeenPads(); @@ -311,12 +309,6 @@ UI::EventReturn ControlMappingScreen::OnAutoConfigure(UI::EventParams ¶ms) { return UI::EVENT_DONE; } -UI::EventReturn ControlMappingScreen::OnVisualizeMapping(UI::EventParams ¶ms) { - VisualMappingScreen *visualMapping = new VisualMappingScreen(gamePath_); - screenManager()->push(visualMapping); - return UI::EVENT_DONE; -} - void ControlMappingScreen::dialogFinished(const Screen *dialog, DialogResult result) { if (result == DR_OK && std::string(dialog->tag()) == "listpopup") { UI::ListPopupScreen *popup = (UI::ListPopupScreen *)dialog; diff --git a/UI/ControlMappingScreen.h b/UI/ControlMappingScreen.h index 1dab466ae3..cffdac5f6b 100644 --- a/UI/ControlMappingScreen.h +++ b/UI/ControlMappingScreen.h @@ -44,10 +44,7 @@ protected: void update() override; private: - UI::EventReturn OnDefaultMapping(UI::EventParams ¶ms); - UI::EventReturn OnClearMapping(UI::EventParams ¶ms); UI::EventReturn OnAutoConfigure(UI::EventParams ¶ms); - UI::EventReturn OnVisualizeMapping(UI::EventParams ¶ms); void dialogFinished(const Screen *dialog, DialogResult result) override;