Name window.notify back to window.alert and unify with simple message box support
This commit is contained in:
@@ -1075,6 +1075,14 @@ namespace lime {
|
||||
}
|
||||
|
||||
|
||||
void lime_window_alert (double window, int type, HxString title, HxString message) {
|
||||
|
||||
Window* targetWindow = (Window*)(intptr_t)window;
|
||||
targetWindow->Alert (type, title.__s, message.__s);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void lime_window_close (double window) {
|
||||
|
||||
Window* targetWindow = (Window*)(intptr_t)window;
|
||||
@@ -1163,14 +1171,6 @@ namespace lime {
|
||||
}
|
||||
|
||||
|
||||
void lime_window_notify (double window) {
|
||||
|
||||
Window* targetWindow = (Window*)(intptr_t)window;
|
||||
targetWindow->Notify ();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void lime_window_resize (double window, int width, int height) {
|
||||
|
||||
Window* targetWindow = (Window*)(intptr_t)window;
|
||||
@@ -1304,6 +1304,7 @@ namespace lime {
|
||||
DEFINE_PRIME2v (lime_text_layout_set_language);
|
||||
DEFINE_PRIME2v (lime_text_layout_set_script);
|
||||
DEFINE_PRIME2v (lime_touch_event_manager_register);
|
||||
DEFINE_PRIME4v (lime_window_alert);
|
||||
DEFINE_PRIME1v (lime_window_close);
|
||||
DEFINE_PRIME5 (lime_window_create);
|
||||
DEFINE_PRIME2v (lime_window_event_manager_register);
|
||||
@@ -1315,7 +1316,6 @@ namespace lime {
|
||||
DEFINE_PRIME1 (lime_window_get_x);
|
||||
DEFINE_PRIME1 (lime_window_get_y);
|
||||
DEFINE_PRIME3v (lime_window_move);
|
||||
DEFINE_PRIME1v (lime_window_notify);
|
||||
DEFINE_PRIME3v (lime_window_resize);
|
||||
DEFINE_PRIME2v (lime_window_set_enable_text_events);
|
||||
DEFINE_PRIME2 (lime_window_set_fullscreen);
|
||||
|
||||
@@ -105,6 +105,58 @@ namespace lime {
|
||||
}
|
||||
|
||||
|
||||
void SDLWindow::Alert (int type, const char* title, const char* message) {
|
||||
|
||||
#ifdef HX_WINDOWS
|
||||
|
||||
int count = 0;
|
||||
int speed = 0;
|
||||
bool stopOnForeground = true;
|
||||
|
||||
SDL_SysWMinfo info;
|
||||
SDL_VERSION (&info.version);
|
||||
SDL_GetWindowWMInfo (sdlWindow, &info);
|
||||
|
||||
FLASHWINFO fi;
|
||||
fi.cbSize = sizeof (FLASHWINFO);
|
||||
fi.hwnd = info.info.win.window;
|
||||
fi.dwFlags = stopOnForeground ? FLASHW_ALL | FLASHW_TIMERNOFG : FLASHW_ALL | FLASHW_TIMER;
|
||||
fi.uCount = count;
|
||||
fi.dwTimeout = speed;
|
||||
FlashWindowEx (&fi);
|
||||
|
||||
#endif
|
||||
|
||||
if (title && message) {
|
||||
|
||||
int flags = 0;
|
||||
|
||||
switch (type) {
|
||||
|
||||
case 1:
|
||||
|
||||
flags = SDL_MESSAGEBOX_WARNING;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
||||
flags = SDL_MESSAGEBOX_ERROR;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
flags = SDL_MESSAGEBOX_INFORMATION;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
SDL_ShowSimpleMessageBox (flags, title, message, sdlWindow);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void SDLWindow::Close () {
|
||||
|
||||
if (sdlWindow) {
|
||||
@@ -192,31 +244,6 @@ namespace lime {
|
||||
}
|
||||
|
||||
|
||||
void SDLWindow::Notify () {
|
||||
|
||||
#ifdef HX_WINDOWS
|
||||
|
||||
int count = 0;
|
||||
int speed = 0;
|
||||
bool stopOnForeground = true;
|
||||
|
||||
SDL_SysWMinfo info;
|
||||
SDL_VERSION (&info.version);
|
||||
SDL_GetWindowWMInfo (sdlWindow, &info);
|
||||
|
||||
FLASHWINFO fi;
|
||||
fi.cbSize = sizeof(FLASHWINFO);
|
||||
fi.hwnd = info.info.win.window;
|
||||
fi.dwFlags = stopOnForeground ? FLASHW_ALL | FLASHW_TIMERNOFG : FLASHW_ALL | FLASHW_TIMER;
|
||||
fi.uCount = count;
|
||||
fi.dwTimeout = speed;
|
||||
FlashWindowEx (&fi);
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
void SDLWindow::Resize (int width, int height) {
|
||||
|
||||
SDL_SetWindowSize (sdlWindow, width, height);
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace lime {
|
||||
SDLWindow (Application* application, int width, int height, int flags, const char* title);
|
||||
~SDLWindow ();
|
||||
|
||||
virtual void Alert (int type, const char* title, const char* message);
|
||||
virtual void Close ();
|
||||
virtual void Focus ();
|
||||
virtual bool GetEnableTextEvents ();
|
||||
@@ -26,7 +27,6 @@ namespace lime {
|
||||
virtual int GetX ();
|
||||
virtual int GetY ();
|
||||
virtual void Move (int x, int y);
|
||||
virtual void Notify ();
|
||||
virtual void Resize (int width, int height);
|
||||
virtual void SetEnableTextEvents (bool enabled);
|
||||
virtual bool SetFullscreen (bool fullscreen);
|
||||
|
||||
Reference in New Issue
Block a user