Merge pull request #557 from TommyX12/master
Added window flashing alert function under window class
This commit is contained in:
@@ -1,4 +1,8 @@
|
|||||||
#include <hx/CFFI.h>
|
#include <hx/CFFI.h>
|
||||||
|
#ifdef HX_WINDOWS
|
||||||
|
#include <SDL_syswm.h>
|
||||||
|
#include <Windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Custom DEFINE_PRIM macro when calls are the same as NME
|
// Custom DEFINE_PRIM macro when calls are the same as NME
|
||||||
@@ -562,6 +566,29 @@ namespace nme {
|
|||||||
DEFINE_LIME_LEGACY_PRIM_1(gl_s3d_set_focal_length);
|
DEFINE_LIME_LEGACY_PRIM_1(gl_s3d_set_focal_length);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
value lime_window_alert (value count, value speed, value stop_on_forground) {
|
||||||
|
|
||||||
|
#ifdef HX_WINDOWS
|
||||||
|
SDL_SysWMinfo info;
|
||||||
|
SDL_VERSION (&info.version);
|
||||||
|
SDL_GetWindowWMInfo(SDL_GL_GetCurrentWindow(), &info);
|
||||||
|
|
||||||
|
FLASHWINFO fi;
|
||||||
|
fi.cbSize = sizeof(FLASHWINFO);
|
||||||
|
fi.hwnd = info.info.win.window;
|
||||||
|
fi.dwFlags = val_bool (stop_on_forground) ? FLASHW_ALL | FLASHW_TIMERNOFG : FLASHW_ALL | FLASHW_TIMER;
|
||||||
|
fi.uCount = val_int (count);
|
||||||
|
fi.dwTimeout = val_int (speed);
|
||||||
|
FlashWindowEx(&fi);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return alloc_null ();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DEFINE_PRIM (lime_window_alert, 3);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -114,5 +114,9 @@ class FlashWindow {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function alert (count:Int, speed:Int, stopOnForeground:Bool):Void {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -626,5 +626,9 @@ class HTML5Window {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function alert (count:Int, speed:Int, stopOnForeground:Bool):Void {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -233,6 +233,16 @@ class NativeWindow {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function alert (count:Int, speed:Int, stopOnForeground:Bool):Void {
|
||||||
|
|
||||||
|
if (handle != null) {
|
||||||
|
|
||||||
|
lime_window_alert (handle, count, speed, stopOnForeground);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@:cffi private static function lime_window_close (handle:Float):Void;
|
@:cffi private static function lime_window_close (handle:Float):Void;
|
||||||
@:cffi private static function lime_window_create (application:Float, width:Int, height:Int, flags:Int, title:String):Float;
|
@:cffi private static function lime_window_create (application:Float, width:Int, height:Int, flags:Int, title:String):Float;
|
||||||
@@ -250,6 +260,7 @@ class NativeWindow {
|
|||||||
@:cffi private static function lime_window_set_icon (handle:Float, buffer:Dynamic):Void;
|
@:cffi private static function lime_window_set_icon (handle:Float, buffer:Dynamic):Void;
|
||||||
@:cffi private static function lime_window_set_minimized (handle:Float, minimized:Bool):Bool;
|
@:cffi private static function lime_window_set_minimized (handle:Float, minimized:Bool):Bool;
|
||||||
@:cffi private static function lime_window_set_title (handle:Float, title:String):String;
|
@:cffi private static function lime_window_set_title (handle:Float, title:String):String;
|
||||||
|
@:cffi private static function lime_window_alert (handle:Float, count:Int, speed:Int, stopOnForeground:Bool):Void;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -269,6 +269,12 @@ class Window {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function alert (count:Int, speed:Int, stopOnForeground:Bool):Void {
|
||||||
|
|
||||||
|
backend.alert (count, speed, stopOnForeground);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function toString ():String {
|
public function toString ():String {
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ namespace lime {
|
|||||||
virtual void SetIcon (ImageBuffer *imageBuffer) = 0;
|
virtual void SetIcon (ImageBuffer *imageBuffer) = 0;
|
||||||
virtual bool SetMinimized (bool minimized) = 0;
|
virtual bool SetMinimized (bool minimized) = 0;
|
||||||
virtual const char* SetTitle (const char* title) = 0;
|
virtual const char* SetTitle (const char* title) = 0;
|
||||||
|
virtual void Alert (int count, int speed, bool stop_on_foreground) = 0;
|
||||||
|
|
||||||
Application* currentApplication;
|
Application* currentApplication;
|
||||||
int flags;
|
int flags;
|
||||||
|
|||||||
@@ -1211,6 +1211,13 @@ namespace lime {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void lime_window_alert (double window, int count, int speed, bool stop_on_forground) {
|
||||||
|
|
||||||
|
Window* targetWindow = (Window*)(intptr_t)window;
|
||||||
|
targetWindow->Alert (count, speed, stop_on_forground);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
DEFINE_PRIME1 (lime_application_create);
|
DEFINE_PRIME1 (lime_application_create);
|
||||||
DEFINE_PRIME2v (lime_application_event_manager_register);
|
DEFINE_PRIME2v (lime_application_event_manager_register);
|
||||||
@@ -1313,6 +1320,7 @@ namespace lime {
|
|||||||
DEFINE_PRIME2v (lime_window_set_icon);
|
DEFINE_PRIME2v (lime_window_set_icon);
|
||||||
DEFINE_PRIME2 (lime_window_set_minimized);
|
DEFINE_PRIME2 (lime_window_set_minimized);
|
||||||
DEFINE_PRIME2 (lime_window_set_title);
|
DEFINE_PRIME2 (lime_window_set_title);
|
||||||
|
DEFINE_PRIME4 (lime_window_alert);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -270,6 +270,22 @@ namespace lime {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SDLWindow::Alert (int count, int speed, bool stop_on_foreground) {
|
||||||
|
|
||||||
|
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 = stop_on_foreground ? FLASHW_ALL | FLASHW_TIMERNOFG : FLASHW_ALL | FLASHW_TIMER;
|
||||||
|
fi.uCount = count;
|
||||||
|
fi.dwTimeout = speed;
|
||||||
|
FlashWindowEx(&fi);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Window* CreateWindow (Application* application, int width, int height, int flags, const char* title) {
|
Window* CreateWindow (Application* application, int width, int height, int flags, const char* title) {
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ namespace lime {
|
|||||||
virtual void SetIcon (ImageBuffer *imageBuffer);
|
virtual void SetIcon (ImageBuffer *imageBuffer);
|
||||||
virtual bool SetMinimized (bool minimized);
|
virtual bool SetMinimized (bool minimized);
|
||||||
virtual const char* SetTitle (const char* title);
|
virtual const char* SetTitle (const char* title);
|
||||||
|
virtual void Alert (int count, int speed, bool stop_on_foreground);
|
||||||
|
|
||||||
SDL_Window* sdlWindow;
|
SDL_Window* sdlWindow;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user