Elixir wrappers for the Erlang macros and records in the wx
package.
This library doesn’t wrap any of wx
’s functions, but exposes the macros for
constants like ?wxAll
and ?GL_POINT
as normal Elixir functions (it’s not
possible to call Erlang macros from Elixir code). It also provides Elixir
Record
types for the Erlang records in the :wx
package.
Add wx_ex
to your list of dependencies in mix.exs
:
def deps do
[
{:wx_ex, "~> 0.5.0"}
]
end
The simplest way to import all the definitions is to simply use WxEx
.
If you don’t want to pull everything into your global namespace, you can import
the invidual module(s) you need, or simply call the functions directly, eg
WxEx.Constants.WxWidgets.wxALIGN_RIGHT()
.
use WxEx
import Bitwise # to allow ORing of flags with |||
panel = :wxPanel.new(frame)
label = :wxStaticText.new(panel, wxID_ANY(), "A label", style: wxALIGN_RIGHT())
sizer = :wxBoxSizer.new(wxHORIZONTAL())
:wxSizer.add(sizer, label, flag: wxALL() ||| wxALIGN_CENTRE(), border: 5)
# etc
use WxEx
event = wx() #=> {:wx, :undefined, :undefined, :undefined, :undefined}
wx(event) #=> [id: :undefined, obj: :undefined, userData: :undefined, event: :undefined]
This library depends on wx_ex_compiler
, which generates source files and was
extracted to avoid circular compiler dependencies.