wx

A port of wxWidgets.

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 wxErlang 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.

This erlang port of wxWidgets tries to be a one-to-one mapping with
the original wxWidgets library. Some things are different though,
as the optional arguments use property lists and can be in any
order. The main difference is the event handling which is different
from the original library. See wxEvtHandler.

The following classes are implemented directly as erlang types:
wxPoint={x,y},wxSize={w,h},wxRect={x,y,w,h},wxColour={r,g,b [,a]},
wxString=//stdlib/unicode:charlist(),
wxGBPosition={r,c},wxGBSpan={rs,cs},wxGridCellCoords={r,c}.

wxWidgets uses a process specific environment, which is created by
wx:new/0. To be able to use the environment from other
processes, call get_env/0 to retrieve the environment and
set_env/1 to assign the environment in the other process.

Global (classless) functions are located in the wx_misc module.

DATA TYPES

colour()

A 3 or 4 tuple: {R,G,B,A} or as argument {R,G,B} is also accepted
where each colour channel is a an integer between 0-255.

get_env() -> wx_env()

set_env(Wx_env::wx_env()) -> ok

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

null() -> wxObject()

Returns the null object

is_null(Wx_ref::wxObject()) -> boolean()

Returns true if object is null, false otherwise

getObjectType(Wx_ref::wxObject()) -> atom()

Returns the object type

typeCast(Old::wxObject(), NewType::atom()) -> wxObject()

Casts the object to class NewType.
It is needed when using functions like wxWindow:findWindow/2, which
returns a generic wxObject type.

batch(Fun::function()) -> term()

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.

foreach(Fun::function(), List::list()) -> ok

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

map(Fun::function(), List::list()) -> list()

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

foldl(Fun::function(), Acc::term(), List::list()) -> term()

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

foldr(Fun::function(), Acc::term(), List::list()) -> term()

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

create_memory(Size::integer()) -> wx_memory()

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.

This is far from erlang's intentional usage and can crash the erlang emulator.
Use it carefully.

get_memory_bin(Wx_mem::wx_memory()) -> binary()

Returns the memory area as a binary.

retain_memory(Wx_mem::wx_memory()) -> ok

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

release_memory(Wx_mem) -> term()

debug(Level::term()) -> ok

Level = none | verbose | trace | driver | [Level]

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.