add gui.confirm(...)
This commit is contained in:
@@ -50,11 +50,13 @@ void guiutil::alert(
|
||||
}
|
||||
|
||||
void guiutil::confirm(
|
||||
const std::shared_ptr<gui::Menu>& menu,
|
||||
const std::wstring& text,
|
||||
const runnable& on_confirm,
|
||||
std::wstring yestext,
|
||||
std::wstring notext) {
|
||||
const std::shared_ptr<gui::Menu>& menu,
|
||||
const std::wstring& text,
|
||||
const runnable& on_confirm,
|
||||
const runnable& on_deny,
|
||||
std::wstring yestext,
|
||||
std::wstring notext
|
||||
) {
|
||||
if (yestext.empty()) yestext = langs::get(L"Yes");
|
||||
if (notext.empty()) notext = langs::get(L"No");
|
||||
|
||||
@@ -71,6 +73,8 @@ void guiutil::confirm(
|
||||
}));
|
||||
|
||||
subpanel->add(std::make_shared<Button>(notext, glm::vec4(8.f), [=](GUI*){
|
||||
if (on_deny)
|
||||
on_deny();
|
||||
menu->back();
|
||||
}));
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace guiutil {
|
||||
const std::shared_ptr<gui::Menu>& menu,
|
||||
const std::wstring& text,
|
||||
const runnable& on_confirm=nullptr,
|
||||
const runnable& on_deny=nullptr,
|
||||
std::wstring yestext=L"",
|
||||
std::wstring notext=L"");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user