Haxe externs (and wrappers) for wxWidgets
You need the hxcpp library and at least Haxe 3.4.0, we recommend Haxe 3.4.2.
- Download and install wxWidgets source from https://www.wxwidgets.org/downloads/
- Create
WXWINenvironment var if setup didnt (eg:C:\wxWidgets-3.0.2) - Open a Visual Studio Developer prompt, or run
vcvarsall.batfrom Visual Studio dir in your current prompt (eg:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat") - Build shared and static releases of wxWidgets:
cd %WXWIN%\build\msw\nmake.exe -f makefile.vc BUILD=releasenmake.exe -f makefile.vc BUILD=release SHARED=1nmake.exe -f makefile.vc BUILD=release TARGET_CPU=X64nmake.exe -f makefile.vc BUILD=release SHARED=1 TARGET_CPU=X64
Warning
If you are trying to build x64 versions of wxWidgets you need to use a "64-bit hosted developer command prompt" shortcut: https://learn.microsoft.com/en-us/cpp/build/how-to-enable-a-64-bit-visual-cpp-toolset-on-the-command-line?view=msvc-170
Important
You may need to add -D HXCPP_M64 to your .hxml file if you are using a x64 version of wxWidgets
You need wxWidgets 3.x and wx-config available in your path.
You can install wxWidgets with:
- debian/ubuntu 20.04 (or later):
apt-get install libwxgtk3.0-gtk3-dev libwxbase3.0-dev libwxgtk-webview3.0-gtk3-dev
- debian/ubuntu (older versions):
apt-get install libwxgtk3.0-dev libwxbase3.0-dev libwxgtk-webview3.0-dev
You need at least OSX 10.7 and you can install wxWidgets with:
brew update
brew install wxwidgetshxWidgets is actually independent of haxeui-core (and haxeui-hxwidgets as well), and can be used on its own if you so desired (the showcase in this repo is an example of that). hxWidgets consists of two layers:
-
wx.widgets.*(e.g.,wx.widgets.Button) : these are externs for Haxe (hxcpp) for wxWidgets, and could be used as-is — though, working with externs, esp. C++ externs, can be... difficult. -
hx.widgets.*(e.g.,hx.widgets.Button) : these are nice Haxe wrappers for the externs so you can just donew Button(...)and be done with it (it manages all the pointers, etc.). They also make things a little more "haxey" in the sense that you havemyButton.bitmap = ...rather than the traditional wx waymyButton.setBitmap(...).
Sometimes is useful to have the most up-to-date version of wxWidgets running on a linux or OSX system, to do this follow these steps:
- download source archive from: https://www.wxwidgets.org/downloads/
- alternatively you can get the very latest version from here: https://github.com/wxWidgets/wxWidgets
- unzip to, for example:
/home/users/username/wxwidgets3.1.3/ - create a folder there:
mkdir wx_build - enter folder:
cd wx_build - configure:
../configure --with-opengl --disable-shared- if you get errors during configure you likely need to run one (or all) of the following (on linux):
sudo apt install build-essentialsudo apt install libgtk2.0-devsudo apt install libgtk-3-devsudo apt install freeglut3-dev
- if you get errors during configure you likely need to run one (or all) of the following (on linux):
- make:
make(adding-j3will allow your system to use 3 cores and thus speed up the initial compile) - once built, install:
make install(may needsudoif not default/usr/locallocation) wx-config --versionshould now show the version you just built- you may need to add the unzip folder to your $PATH var if it doesnt show the right version