Skip to content

Repository files navigation

Hex.pm Hexdocs.pm Build

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.

Installation

Add wx_ex to your list of dependencies in mix.exs:

def deps do
  [
    {:wx_ex, "~> 0.5.0"}
  ]
end

Usage

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().

Constants

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

Records

use WxEx

event = wx() #=> {:wx, :undefined, :undefined, :undefined, :undefined}
wx(event) #=> [id: :undefined, obj: :undefined, userData: :undefined, event: :undefined]

Example application

See wx_tutorial for a simple application built with wx_ex, based on this tutorial.

Development

This library depends on wx_ex_compiler, which generates source files and was extracted to avoid circular compiler dependencies.

About

Elixir wrappers for wx

Resources

Stars

8 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages