37 lines
932 B
C++
37 lines
932 B
C++
/**
|
|
* @file core/system_win.cpp
|
|
* @brief Windows implementations of rex/system.h platform helpers.
|
|
*
|
|
* @copyright Copyright (c) 2026 Tom Clay
|
|
* @license BSD 3-Clause License
|
|
*/
|
|
|
|
#ifndef NOMINMAX
|
|
#define NOMINMAX
|
|
#endif
|
|
#include <windows.h>
|
|
|
|
#include <rex/string.h>
|
|
#include <rex/system.h>
|
|
|
|
namespace rex {
|
|
|
|
void ShowSimpleMessageBox(SimpleMessageBoxType type, std::string_view message) {
|
|
UINT flags = MB_OK | MB_TOPMOST | MB_SETFOREGROUND;
|
|
const wchar_t* title = L"ReXGlue";
|
|
switch (type) {
|
|
case SimpleMessageBoxType::Help:
|
|
flags |= MB_ICONINFORMATION;
|
|
break;
|
|
case SimpleMessageBoxType::Warning:
|
|
flags |= MB_ICONWARNING;
|
|
break;
|
|
case SimpleMessageBoxType::Error:
|
|
flags |= MB_ICONERROR;
|
|
break;
|
|
}
|
|
auto wide = rex::string::to_utf16(message);
|
|
::MessageBoxW(nullptr, reinterpret_cast<const wchar_t*>(wide.c_str()), title, flags);
|
|
}
|
|
|
|
} // namespace rex
|