21 #include "../../SDL_internal.h" 23 #if SDL_VIDEO_DRIVER_WINRT 27 #include "../../core/windows/SDL_windows.h" 32 #include <windows.ui.popups.h> 33 using namespace Platform;
35 using namespace Windows::UI::Popups;
38 WINRT_UTF8ToPlatformString(
const char * str)
41 String ^ rtstr =
ref new String(wstr);
49 #if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) && (NTDDI_VERSION == NTDDI_WIN8) 57 return SDL_SetError(
"SDL_messagebox support is not available for Windows Phone 8.0");
61 #if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP 62 const int maxbuttons = 2;
63 const char * platform =
"Windows Phone 8.1+";
65 const int maxbuttons = 3;
66 const char * platform =
"Windows 8.x";
70 return SDL_SetError(
"WinRT's MessageDialog only supports %d buttons, at most, on %s. %d were requested.",
71 maxbuttons, platform, messageboxdata->
numbuttons);
75 MessageDialog ^ dialog =
ref new MessageDialog(WINRT_UTF8ToPlatformString(messageboxdata->
message));
76 dialog->Title = WINRT_UTF8ToPlatformString(messageboxdata->
title);
79 button->Id = safe_cast<IntPtr>(
i);
80 dialog->Commands->Append(button);
82 dialog->CancelCommandIndex =
i;
85 dialog->DefaultCommandIndex =
i;
91 auto operation = dialog->ShowAsync();
92 while (operation->Status == Windows::Foundation::AsyncStatus::Started) {
97 if (operation->Status != Windows::Foundation::AsyncStatus::Completed) {
98 return SDL_SetError(
"An unknown error occurred in displaying the WinRT MessageDialog");
101 IntPtr results = safe_cast<IntPtr>(operation->GetResults()->Id);
102 int clicked_index = results.ToInt32();
#define WIN_UTF8ToString(S)
static SDL_VideoDevice * _this
void WINRT_PumpEvents(_THIS)
const SDL_MessageBoxButtonData * buttons
MessageBox structure containing title, text, window, etc.
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
SDL_VideoDevice * SDL_GetVideoDevice(void)