Drag&Drop support; SDL_CaptureMode support; Maximize window support;

This commit is contained in:
Yanrishatum
2015-10-18 00:15:05 +03:00
committed by Joshua Granick
parent 3a7d8b80e5
commit 85ec75fd59
18 changed files with 256 additions and 10 deletions

View File

@@ -45,6 +45,7 @@ class NativeApplication {
private var gamepadEventInfo = new GamepadEventInfo ();
private var joystickEventInfo = new JoystickEventInfo ();
private var keyEventInfo = new KeyEventInfo ();
private var dropEventInfo = new DropEventInfo();
private var mouseEventInfo = new MouseEventInfo ();
private var renderEventInfo = new RenderEventInfo (RENDER);
private var sensorEventInfo = new SensorEventInfo ();
@@ -90,6 +91,7 @@ class NativeApplication {
lime_gamepad_event_manager_register (handleGamepadEvent, gamepadEventInfo);
lime_joystick_event_manager_register (handleJoystickEvent, joystickEventInfo);
lime_key_event_manager_register (handleKeyEvent, keyEventInfo);
lime_drop_event_manager_register(handleDropEvent, dropEventInfo);
lime_mouse_event_manager_register (handleMouseEvent, mouseEventInfo);
lime_render_event_manager_register (handleRenderEvent, renderEventInfo);
lime_text_event_manager_register (handleTextEvent, textEventInfo);
@@ -248,6 +250,10 @@ class NativeApplication {
}
private function handleDropEvent():Void
{
parent.onDropFile.dispatch(dropEventInfo.file);
}
private function handleKeyEvent ():Void {
@@ -621,6 +627,7 @@ class NativeApplication {
@:cffi private static function lime_gamepad_event_manager_register (callback:Dynamic, eventObject:Dynamic):Void;
@:cffi private static function lime_joystick_event_manager_register (callback:Dynamic, eventObject:Dynamic):Void;
@:cffi private static function lime_key_event_manager_register (callback:Dynamic, eventObject:Dynamic):Void;
@:cffi private static function lime_drop_event_manager_register (callback:Dynamic, eventObject:Dynamic):Void;
@:cffi private static function lime_mouse_event_manager_register (callback:Dynamic, eventObject:Dynamic):Void;
@:cffi private static function lime_render_event_manager_register (callback:Dynamic, eventObject:Dynamic):Void;
@:cffi private static function lime_sensor_event_manager_register (callback:Dynamic, eventObject:Dynamic):Void;
@@ -632,6 +639,27 @@ class NativeApplication {
}
@:enum private abstract DropEventType(Int)
{
var DROP_FILE = 0;
}
private class DropEventInfo
{
public var type:DropEventType;
public var file:String;
public function new (type:DropEventType = null, file:String = null)
{
this.file = file;
this.type = type;
}
public function clone():DropEventInfo
{
return new DropEventInfo(type, file);
}
}
private class ApplicationEventInfo {

View File

@@ -17,6 +17,7 @@ class NativeMouse {
private static var __cursor:MouseCursor;
private static var __hidden:Bool;
private static var __lock:Bool;
private static var __captureMode:Bool;
public static function hide ():Void {
@@ -63,7 +64,22 @@ class NativeMouse {
// Get & Set Methods
public static function get_captureMode():Bool
{
return __captureMode;
}
public static function set_captureMode(v:Bool):Bool
{
if (v != __captureMode)
{
#if !macro
lime_mouse_set_capture_mode(v);
#end
__captureMode = v;
}
return v;
}
public static function get_cursor ():MouseCursor {
@@ -149,6 +165,7 @@ class NativeMouse {
@:cffi private static function lime_mouse_set_lock (lock:Bool):Void;
@:cffi private static function lime_mouse_show ():Void;
@:cffi private static function lime_mouse_warp (x:Int, y:Int, window:Dynamic):Void;
@:cffi private static function lime_mouse_set_capture_mode (capture:Bool):Void;
#end

View File

@@ -249,6 +249,17 @@ class NativeWindow {
}
public function setMaximized (value:Bool):Bool
{
if (handle != null)
{
#if !macro
return lime_window_set_maximized(handle, value);
#end
}
return value;
}
public function setMinimized (value:Bool):Bool {
if (handle != null) {
@@ -318,6 +329,7 @@ class NativeWindow {
@:cffi private static function lime_window_set_icon (handle:Dynamic, buffer:Dynamic):Void;
@:cffi private static function lime_window_set_minimized (handle:Dynamic, minimized:Bool):Bool;
@:cffi private static function lime_window_set_resizable (handle:Dynamic, resizable:Bool):Bool;
@:cffi private static function lime_window_set_maximized (handle:Dynamic, maximized:Bool):Bool;
@:cffi private static function lime_window_set_title (handle:Dynamic, title:String):Dynamic;
#end