Permalink
Browse files

Merge pull request #10239 from unknownbrackets/ui-minor

UI: Send prompt results even on back/cancel
  • Loading branch information...
hrydgard committed Dec 3, 2017
2 parents a58ef7c + cde6b3d commit 1cb3564c11789fe3a187d70c0c5fc808a52ddf1c
Showing with 8 additions and 3 deletions.
  1. +6 −3 UI/MiscScreens.cpp
  2. +2 −0 UI/MiscScreens.h
@@ -275,22 +275,25 @@ void PromptScreen::CreateViews() {
Choice *yesButton = rightColumnItems->Add(new Choice(yesButtonText_));
yesButton->OnClick.Handle(this, &PromptScreen::OnYes);
root_->SetDefaultFocusView(yesButton);
if (noButtonText_ != "")
if (!noButtonText_.empty())
rightColumnItems->Add(new Choice(noButtonText_))->OnClick.Handle(this, &PromptScreen::OnNo);
}
UI::EventReturn PromptScreen::OnYes(UI::EventParams &e) {
callback_(true);
TriggerFinish(DR_OK);
return UI::EVENT_DONE;
}
UI::EventReturn PromptScreen::OnNo(UI::EventParams &e) {
callback_(false);
TriggerFinish(DR_CANCEL);
return UI::EVENT_DONE;
}
void PromptScreen::TriggerFinish(DialogResult result) {
callback_(result == DR_OK || result == DR_YES);
UIDialogScreenWithBackground::TriggerFinish(result);
}
PostProcScreen::PostProcScreen(const std::string &title) : ListPopupScreen(title) {
I18NCategory *ps = GetI18NCategory("PostShaders");
ReloadAllPostShaderInfo();
@@ -78,6 +78,8 @@ class PromptScreen : public UIDialogScreenWithBackground {
void CreateViews() override;
void TriggerFinish(DialogResult result) override;
private:
UI::EventReturn OnYes(UI::EventParams &e);
UI::EventReturn OnNo(UI::EventParams &e);

0 comments on commit 1cb3564

Please sign in to comment.