Window: visible property to show and hide window

This commit is contained in:
Josh Tynjala
2023-03-16 08:34:58 -07:00
parent 4105b97fc8
commit 0160c12311
9 changed files with 83 additions and 0 deletions

View File

@@ -640,5 +640,10 @@ class FlashWindow
return value;
}
public function setVisible(value:Bool):Bool
{
return value;
}
public function warpMouse(x:Int, y:Int):Void {}
}

View File

@@ -1231,6 +1231,11 @@ class HTML5Window
return value;
}
public function setVisible(value:Bool):Bool
{
return value;
}
private function updateSize():Void
{
if (!parent.__resizable) return;

View File

@@ -349,6 +349,8 @@ class NativeCFFI
@:cffi private static function lime_window_set_title(handle:Dynamic, title:String):Dynamic;
@:cffi private static function lime_window_set_visible(handle:Dynamic, visible:Bool):Bool;
@:cffi private static function lime_window_warp_mouse(handle:Dynamic, x:Int, y:Int):Void;
@:cffi private static function lime_window_event_manager_register(callback:Dynamic, eventObject:Dynamic):Void;
@@ -606,6 +608,8 @@ class NativeCFFI
"lime_window_set_text_input_rect", "oov", false));
private static var lime_window_set_title = new cpp.Callable<cpp.Object->String->cpp.Object>(cpp.Prime._loadPrime("lime", "lime_window_set_title", "oso",
false));
private static var lime_window_set_visible = new cpp.Callable<cpp.Object->Bool->Bool>(cpp.Prime._loadPrime("lime", "lime_window_set_visible", "obb",
false));
private static var lime_window_warp_mouse = new cpp.Callable<cpp.Object->Int->Int->cpp.Object>(cpp.Prime._loadPrime("lime", "lime_window_warp_mouse",
"oiiv", false));
private static var lime_window_event_manager_register = new cpp.Callable<cpp.Object->cpp.Object->cpp.Void>(cpp.Prime._loadPrime("lime",
@@ -762,6 +766,7 @@ class NativeCFFI
private static var lime_window_set_text_input_enabled = CFFI.load("lime", "lime_window_set_text_input_enabled", 2);
private static var lime_window_set_text_input_rect = CFFI.load("lime", "lime_window_set_text_input_rect", 2);
private static var lime_window_set_title = CFFI.load("lime", "lime_window_set_title", 2);
private static var lime_window_set_visible = CFFI.load("lime", "lime_window_set_visible", 2);
private static var lime_window_warp_mouse = CFFI.load("lime", "lime_window_warp_mouse", 3);
private static var lime_window_event_manager_register = CFFI.load("lime", "lime_window_event_manager_register", 2);
private static var lime_zlib_compress = CFFI.load("lime", "lime_zlib_compress", 2);
@@ -1364,6 +1369,11 @@ class NativeCFFI
return null;
}
@:hlNative("lime", "hl_window_set_visible") private static function lime_window_set_visible(handle:CFFIPointer, visible:Bool):Bool
{
return false;
}
@:hlNative("lime", "hl_window_warp_mouse") private static function lime_window_warp_mouse(handle:CFFIPointer, x:Int, y:Int):Void {}
@:hlNative("lime", "hl_window_get_opacity") private static function lime_window_get_opacity(handle:CFFIPointer):Float { return 0.0; }

View File

@@ -679,6 +679,18 @@ class NativeWindow
return value;
}
public function setVisible(value:Bool):Bool
{
if (handle != null)
{
#if (!macro && lime_cffi)
NativeCFFI.lime_window_set_visible(handle, value);
#end
}
return value;
}
public function warpMouse(x:Int, y:Int):Void
{
#if (!macro && lime_cffi)

View File

@@ -89,6 +89,7 @@ class Window
#end
public var textInputEnabled(get, set):Bool;
public var title(get, set):String;
public var visible(get, set):Bool;
public var width(get, set):Int;
public var x(get, set):Int;
public var y(get, set):Int;
@@ -109,6 +110,7 @@ class Window
@:noCompletion private var __resizable:Bool;
@:noCompletion private var __scale:Float;
@:noCompletion private var __title:String;
@:noCompletion private var __visible:Bool;
@:noCompletion private var __width:Int;
@:noCompletion private var __x:Int;
@:noCompletion private var __y:Int;
@@ -133,6 +135,7 @@ class Window
"scale": {get: p.get_scale},
"textInputEnabled": {get: p.get_textInputEnabled, set: p.set_textInputEnabled},
"title": {get: p.get_title, set: p.set_title},
"visible": {get: p.get_visible, set: p.set_visible},
"width": {get: p.get_width, set: p.set_width},
"x": {get: p.get_x, set: p.set_y},
"y": {get: p.get_x, set: p.set_y}
@@ -576,6 +579,17 @@ class Window
return __title = __backend.setTitle(value);
}
@:noCompletion private inline function get_visible():Bool
{
return __visible;
}
@:noCompletion private function set_visible(value:Bool):Bool
{
__visible = __backend.setVisible(value);
return __visible;
}
@:noCompletion private inline function get_width():Int
{
return __width;