Skip to content

Commit

Permalink
Merge pull request #75 from s1-en/master
Browse files Browse the repository at this point in the history
Added support for minimum and maximum window size.
  • Loading branch information
ianharrigan authored Apr 19, 2021
2 parents 0959b46 + 63d7604 commit 5ffe9ce
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
48 changes: 48 additions & 0 deletions src/hx/widgets/Window.hx
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,30 @@ class Window extends EvtHandler {
windowRef.ptr.setSize(width, height);
}

public var minSize(get, set):Size;
private function get_minSize():Size {
var r = windowRef.ptr.getMinSize();
return Size.copy(r);
}
private function set_minSize(value:Size):Size {
var temp:Pointer<WxSize> = value.createPointer();
windowRef.ptr.setMinSize(temp.ref);
temp.destroy();
return value;
}

public var maxSize(get, set):Size;
private function get_maxSize():Size {
var r = windowRef.ptr.getMaxSize();
return Size.copy(r);
}
private function set_maxSize(value:Size):Size {
var temp:Pointer<WxSize> = value.createPointer();
windowRef.ptr.setMaxSize(temp.ref);
temp.destroy();
return value;
}

public var clientSize(get, set):Size;
private function get_clientSize():Size {
var r = windowRef.ptr.getClientSize();
Expand All @@ -247,6 +271,30 @@ class Window extends EvtHandler {
windowRef.ptr.setClientSize(width, height);
}

public var minClientSize(get, set):Size;
private function get_minClientSize():Size {
var r = windowRef.ptr.getMinClientSize();
return Size.copy(r);
}
private function set_minClientSize(value:Size):Size {
var temp:Pointer<WxSize> = value.createPointer();
windowRef.ptr.setMinClientSize(temp.ref);
temp.destroy();
return value;
}

public var maxClientSize(get, set):Size;
private function get_maxClientSize():Size {
var r = windowRef.ptr.getMaxClientSize();
return Size.copy(r);
}
private function set_maxClientSize(value:Size):Size {
var temp:Pointer<WxSize> = value.createPointer();
windowRef.ptr.setMaxClientSize(temp.ref);
temp.destroy();
return value;
}

public var bestSize(get, null):Size;
private function get_bestSize():Size {
var r = windowRef.ptr.getBestSize();
Expand Down
12 changes: 12 additions & 0 deletions src/wx/widgets/Window.hx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,18 @@ extern class Window extends EvtHandler {
@:native("GetClientSize") public function getClientSize():Size;
@:native("SetClientSize") @:overload(function(width:Int, height:Int):Void {})
@:native("SetClientSize") public function setClientSize(size:Size):Void;
@:native("GetMinSize") public function getMinSize():Size;
@:native("SetMinSize") @:overload(function(width:Int, height:Int):Void {})
@:native("SetMinSize") public function setMinSize(size:Size):Void;
@:native("GetMinClientSize") public function getMinClientSize():Size;
@:native("SetMinClientSize") @:overload(function(width:Int, height:Int):Void {})
@:native("SetMinClientSize") public function setMinClientSize(size:Size):Void;
@:native("GetMaxSize") public function getMaxSize():Size;
@:native("SetMaxSize") @:overload(function(width:Int, height:Int):Void {})
@:native("SetMaxSize") public function setMaxSize(size:Size):Void;
@:native("GetMaxClientSize") public function getMaxClientSize():Size;
@:native("SetMaxClientSize") @:overload(function(width:Int, height:Int):Void {})
@:native("SetMaxClientSize") public function setMaxClientSize(size:Size):Void;
@:native("GetBestSize") public function getBestSize():Size;
@:native("GetVirtualSize") public function getVirtualSize():Size;
@:native("SetVirtualSize") @:overload(function(width:Int, height:Int):Void {})
Expand Down

0 comments on commit 5ffe9ce

Please sign in to comment.