Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some Menu & StandardPath additions #102

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
13 changes: 13 additions & 0 deletions src/hx/widgets/Menu.hx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,19 @@ class Menu extends EvtHandler {
return menuItem;
}

public function destroyItem(menuItem: MenuItem): Bool {
var menuItemPtr: Pointer<WxMenuItem> = menuItem._ref.reinterpret();
return menuRef.ptr.destroy(menuItemPtr.get_raw());
}

public function insertSubMenu(position:Int, id:Int, menu:Menu, text:String):MenuItem {
var str = WxString.fromUTF8(text);
var menuItemRef:Pointer<WxMenuItem> = Pointer.fromRaw(menuRef.ptr.insert(position, id, str, menu.menuRef.get_raw()));
var menuItem:MenuItem = new MenuItem();
menuItem._ref = menuItemRef.reinterpret();
return menuItem;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////
// Helpers
//////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
3 changes: 3 additions & 0 deletions src/hx/widgets/StandardPaths.hx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ class StandardPaths {
private var _ref:Pointer<WxStandardPaths>;

public function new() {
if (_ref == null) {
_ref = Pointer.addressOf(WxStandardPaths.get());
}
}

public var appDocumentsDir(get, null):String;
Expand Down
4 changes: 4 additions & 0 deletions src/wx/widgets/Menu.hx
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,8 @@ extern class Menu extends EvtHandler {
@:native("AppendSeparator") public function appendSeparator():RawPointer<MenuItem>;
@:native("AppendSubMenu") public function appendSubMenu(menu:RawPointer<Menu>, text:WxString):RawPointer<MenuItem>;

@:native("Insert") public function insert(position:Int, id:Int, text:WxString, menu:RawPointer<Menu>):RawPointer<MenuItem>;

@:native("Destroy") public function destroy(menuItem:RawPointer<MenuItem>):Bool;

}
1 change: 1 addition & 0 deletions src/wx/widgets/StandardPaths.hx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package wx.widgets;
@:native("wxStandardPaths")
@:structAccess
extern class StandardPaths {
@:native("wxStandardPaths::Get") public static function get():StandardPaths;
@:native("GetAppDocumentsDir") public function getAppDocumentsDir():WxString;
@:native("GetConfigDir") public function getConfigDir():WxString;
@:native("GetDataDir") public function getDataDir():WxString;
Expand Down