.TH wx 3erl "wx 1.8" "" "Erlang Module Definition" .SH NAME wx \- A port of wxWidgets. .SH DESCRIPTION .LP A port of wxWidgets\&. .LP This is the base api of wxWidgets\&. This module contains functions for starting and stopping the wx-server, as well as other utility functions\&. .LP 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\&. .LP 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(\&.\&.\&.)\&. .LP Sub class modules inherit (non static) functions from their parents\&. The inherited functions are not documented in the sub-classes\&. .LP 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 \fBwxEvtHandler\fR\&\&. .LP The following classes are implemented directly as erlang types: .br wxPoint={x,y},wxSize={w,h},wxRect={x,y,w,h},wxColour={r,g,b [,a]}, wxString=\fBunicode:chardata()\fR\&, wxGBPosition={r,c},wxGBSpan={rs,cs},wxGridCellCoords={r,c}\&. .LP wxWidgets uses a process specific environment, which is created by \fBwx:new/0\fR\&\&. To be able to use the environment from other processes, call \fBget_env/0\fR\& to retrieve the environment and \fBset_env/1\fR\& to assign the environment in the other process\&. .LP Global (classless) functions are located in the wx_misc module\&. .SH "DATA TYPES" .RS 2 .TP 2 .B wx_colour() = {R::byte(), G::byte(), B::byte()} | \fBwx_colour4()\fR\&: .TP 2 .B wx_colour4() = {R::byte(), G::byte(), B::byte(), A::byte()}: .TP 2 .B wx_datetime() = {{Year::integer(), Month::integer(), Day::integer()}, {Hour::integer(), Minute::integer(), Second::integer()}}: .RS 2 .LP In Local Timezone .RE .TP 2 .B wx_enum() = integer(): .RS 2 .LP Constant defined in wx\&.hrl .RE .TP 2 .B wx_env() = #wx_env{}: .RS 2 .LP Opaque process environment .RE .TP 2 .B wx_memory() = binary() | #wx_mem{}: .RS 2 .LP Opaque memory reference .RE .TP 2 .B wx_object() = #wx_ref{}: .RS 2 .LP Opaque object reference .RE .TP 2 .B wx_wxHtmlLinkInfo() = #wxHtmlLinkInfo{href=\fBunicode:chardata()\fR\&, target=\fBunicode:chardata()\fR\&}: .TP 2 .B wx_wxMouseState() = #wxMouseState{x=integer(), y=integer(), leftDown=boolean(), middleDown=boolean(), rightDown=boolean(), controlDown=boolean(), shiftDown=boolean(), altDown=boolean(), metaDown=boolean(), cmdDown=boolean()}: .RS 2 .LP See #wxMouseState{} defined in wx\&.hrl .RE .RE .SH EXPORTS .LP .B parent_class(X1) -> term() .br .RS .RE .LP .B new() -> \fBwx_object()\fR\& .br .RS .LP Starts a wx server\&. .RE .LP .B new(Options::[Option]) -> \fBwx_object()\fR\& .br .RS .LP Types: .RS 3 Option = {debug, list() | atom()} | {silent_start, boolean()} .br .RE .RE .RS .LP Starts a wx server\&. Option may be {debug, Level}, see debug/1\&. Or {silent_start, Bool}, which causes error messages at startup to be suppressed\&. The latter can be used as a silent test of whether wx is properly installed or not\&. .RE .LP .B destroy() -> ok .br .RS .LP Stops a wx server\&. .RE .LP .B get_env() -> \fBwx_env()\fR\& .br .RS .LP Gets this process\&'s current wx environment\&. Can be sent to other processes to allow them use this process wx environment\&. .LP \fISee also:\fR\& \fBset_env/1\fR\&\&. .RE .LP .B set_env(Wx_env::\fBwx_env()\fR\&) -> ok .br .RS .LP Sets the process wx environment, allows this process to use another process wx environment\&. .RE .LP .B null() -> \fBwx_object()\fR\& .br .RS .LP Returns the null object .RE .LP .B is_null(Wx_ref::\fBwx_object()\fR\&) -> boolean() .br .RS .LP Returns true if object is null, false otherwise .RE .LP .B equal(Wx_ref::\fBwx_object()\fR\&, X2::\fBwx_object()\fR\&) -> boolean() .br .RS .LP Returns true if both arguments references the same object, false otherwise .RE .LP .B getObjectType(Wx_ref::\fBwx_object()\fR\&) -> atom() .br .RS .LP Returns the object type .RE .LP .B typeCast(Old::\fBwx_object()\fR\&, NewType::atom()) -> \fBwx_object()\fR\& .br .RS .LP Casts the object to class NewType\&. It is needed when using functions like wxWindow:findWindow/2, which returns a generic wxObject type\&. .RE .LP .B batch(Fun::function()) -> term() .br .RS .LP Batches all \fIwx\fR\& 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\&. .LP \fISee also:\fR\& \fBfoldl/3\fR\&, \fBfoldr/3\fR\&, \fBforeach/2\fR\&, \fBmap/2\fR\&\&. .RE .LP .B foreach(Fun::function(), List::list()) -> ok .br .RS .LP Behaves like \fBlists:foreach/2\fR\& but batches wx commands\&. See \fBbatch/1\fR\&\&. .RE .LP .B map(Fun::function(), List::list()) -> list() .br .RS .LP Behaves like \fBlists:map/2\fR\& but batches wx commands\&. See \fBbatch/1\fR\&\&. .RE .LP .B foldl(Fun::function(), Acc::term(), List::list()) -> term() .br .RS .LP Behaves like \fBlists:foldl/3\fR\& but batches wx commands\&. See \fBbatch/1\fR\&\&. .RE .LP .B foldr(Fun::function(), Acc::term(), List::list()) -> term() .br .RS .LP Behaves like \fBlists:foldr/3\fR\& but batches wx commands\&. See \fBbatch/1\fR\&\&. .RE .LP .B create_memory(Size::integer()) -> \fBwx_memory()\fR\& .br .RS .LP 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\&. .LP This is far from erlang\&'s intentional usage and can crash the erlang emulator\&. Use it carefully\&. .RE .LP .B get_memory_bin(Wx_mem::\fBwx_memory()\fR\&) -> binary() .br .RS .LP Returns the memory area as a binary\&. .RE .LP .B retain_memory(Wx_mem::\fBwx_memory()\fR\&) -> ok .br .RS .LP 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\&. .RE .LP .B release_memory(Wx_mem::\fBwx_memory()\fR\&) -> ok .br .RS .RE .LP .B debug(Debug::Level | [Level]) -> ok .br .RS .LP Types: .RS 3 Level = none | verbose | trace | driver | integer() .br .RE .RE .RS .LP 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\&. .RE .LP .B demo() -> ok | {error, atom()} .br .RS .LP Starts a wxErlang demo if examples directory exists and is compiled .RE .SH AUTHORS .LP .I <>