silk/wx

A port of wxWidgets.

This is the base api of wxWidgets. This module contains functions for starting and stopping the wx-server, as well as other utility functions.

wxWidgets is object oriented, and not functional. Thus, in Wx a module represents a class, and the object created by this class has an own type, wxCLASS(). This module represents the base class, and all other wxMODULE’s are sub-classes of this class.

Objects of a class are created with wxCLASS:new(…) and destroyed with wxCLASS:destroy(). Member functions are called with wxCLASS:member(Object, …) instead of as in C++ Object.member(…).

Sub class modules inherit (non static) functions from their parents. The inherited functions are not documented in the sub-classes.

Types

pub type DebugLevel {
  None
  Verbose
  Trace
  Driver
}

Constructors

  • None
  • Verbose
  • Trace
  • Driver
pub type WxColour =
  #(Int, Int, Int, Int)
pub type WxColour4 =
  #(Int, Int, Int, Int)

In Local Timezone

pub type WxDatetime =
  #(#(Int, Int, Int), #(Int, Int, Int))

Constant defined in wx.hrl

pub type WxEnum =
  Int

Opaque process environment

pub type WxEnv

Opaque memory reference

pub type WxMemory =
  BitArray

Opaque object reference

pub type WxObject(t) =
  types.WxObject(t)
pub type WxRef {
  WxRef(Int)
}

Constructors

  • WxRef(Int)
pub type WxWxHtmlLinkInfo
pub type WxWxMouseState

Functions

pub fn batch(fun: fn() -> Nil) -> Dynamic

Batches all wx commands used in the fun. Improves performance of the command processing by grabbing the wxWidgets thread so that no event processing will be done before the complete batch of commands is invoked.

pub fn coerce(input: a) -> b
pub fn create_memory(size: Int) -> BitArray

Creates a memory area (of Size in bytes) which can be used by an external library (i.e. opengl). It is up to the client to keep a reference to this object so it does not get garbage collected by erlang while still in use by the external library.

pub fn debug(level: DebugLevel) -> OkT

Sets debug level. If debug level is ‘verbose’ or ‘trace’ each call is printed on console. If Level is ‘driver’ each allocated object and deletion is printed on the console.

pub fn demo() -> Result(Nil, Atom)

Starts a Wx demo if examples directory exists and is compiled

pub fn destroy() -> OkT

Stops a wx server.

pub fn equal(ref1: WxObject(a), ref2: WxObject(b)) -> Bool

Returns true if both arguments references the same object, false otherwise

pub fn foldl(fun: fn(a, b) -> c, acc: b, list: List(a)) -> b

Behaves like lists:foldl/3 but batches wx commands. See batch.

pub fn foldr(fun: fn(a, b) -> c, acc: b, list: List(a)) -> b

Behaves like lists:foldr/3 but batches wx commands. See batch.

pub fn foreach(fun: fn(a) -> b, list: List(a)) -> Nil

Behaves like lists:foreach/2 but batches wx commands. See batch.

pub fn get_env() -> WxEnv

Gets this process’s current wx environment. Can be sent to other processes to allow them use this process wx environment.

pub fn get_memory_bin(wx_mem: BitArray) -> BitArray

Returns the memory area as a binary.

pub fn get_object_type(wx_ref: WxRef) -> Atom

Returns the object type

pub fn is_null(wx_ref: WxObject(a)) -> Bool

Returns true if object is null, false otherwise

pub fn map(fun: fn(a) -> b, list: List(a)) -> List(b)

Behaves like lists:map/2 but batches wx commands. See batch.

pub fn new() -> WxObject(a)

Starts a wx server.

pub fn null() -> WxObject(a)

Returns the null object

pub fn parent_class(wx_ref: WxObject(a)) -> Bool
pub fn release_memory(wx_mem: BitArray) -> OkT

Releases the memory retained by retain_memory

pub fn retain_memory(wx_mem: BitArray) -> OkT

Saves the memory from deletion until release_memory is called. If release_memory is not called the memory will not be garbage collected.

pub fn set_env(wx_env: WxEnv) -> OkT

Sets the process wx environment, allows this process to use another process wx environment.

Search Document