From e75e26da92424528e190a2111acfcc49c657e894 Mon Sep 17 00:00:00 2001 From: rtk0c Date: Mon, 29 Mar 2021 19:14:07 -0700 Subject: Replace Dialog.hpp with portable-file-dialogs, more work on projects --- core/src/Utils/Dialog/Dialog_win32.cpp | 64 ---------------------------------- 1 file changed, 64 deletions(-) delete mode 100644 core/src/Utils/Dialog/Dialog_win32.cpp (limited to 'core/src/Utils/Dialog/Dialog_win32.cpp') diff --git a/core/src/Utils/Dialog/Dialog_win32.cpp b/core/src/Utils/Dialog/Dialog_win32.cpp deleted file mode 100644 index b82f382..0000000 --- a/core/src/Utils/Dialog/Dialog_win32.cpp +++ /dev/null @@ -1,64 +0,0 @@ -// Adapted from https://github.com/aaronmjacobs/Boxer/blob/master/src/boxer_win.cpp -#include "Dialog.hpp" - -#define WIN32_LEAN_AND_MEAN -#include - -namespace Dialog { -namespace { - - UINT GetIcon(Style style) { - switch (style) { - case Style::Info: - return MB_ICONINFORMATION; - case Style::Warning: - return MB_ICONWARNING; - case Style::Error: - return MB_ICONERROR; - case Style::Question: - return MB_ICONQUESTION; - default: - return MB_ICONINFORMATION; - } - } - - UINT GetButtons(Buttons buttons) { - switch (buttons) { - case Buttons::OK: - case Buttons::Quit: // There is no 'Quit' button on Windows :( - return MB_OK; - case Buttons::OKCancel: - return MB_OKCANCEL; - case Buttons::YesNo: - return MB_YESNO; - default: - return MB_OK; - } - } - - Selection GetSelection(int response, Buttons buttons) { - switch (response) { - case IDOK: - return buttons == Buttons::Quit ? Selection::Quit : Selection::OK; - case IDCANCEL: - return Selection::Cancel; - case IDYES: - return Selection::Yes; - case IDNO: - return Selection::No; - default: - return Selection::None; - } - } - -} // namespace - -Selection Show(const char* message, const char* title, Style style, Buttons buttons) { - UINT flags = MB_TASKMODAL; - - flags |= GetIcon(style); - flags |= GetButtons(buttons); - - return GetSelection(MessageBox(nullptr, message, title, flags), buttons); -} -} // namespace Dialog -- cgit v1.2.3-70-g09d2