.TH wx 3erl "wx 2.2.2.1" "" "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 wxEvtHandler\&. .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=unicode:chardata(), wxGBPosition={r,c},wxGBSpan={rs,cs},wxGridCellCoords={r,c}\&. .LP 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\&. .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()} | wx_colour4(): .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=unicode:chardata(), target=unicode:chardata()}: .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() -> wx_object() .br .RS .LP Starts a wx server\&. .RE .LP .B new(Options::[Option]) -> wx_object() .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() -> wx_env() .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\& set_env/1\&. .RE .LP .B set_env(Wx_env::wx_env()) -> ok .br .RS .LP Sets the process wx environment, allows this process to use another process wx environment\&. .RE .LP .B subscribe_events() -> ok .br .RS .LP Adds the calling process to the list of of processes that are listening to wx application events\&. .LP At the moment these are all MacOSX specific events corresponding to \fIMacNewFile()\fR\& and friends from wxWidgets wxApp: .RS 2 .TP 2 * \fI{new_file, ""}\fR\& .LP .TP 2 * \fI{open_file, Filename}\fR\& .LP .TP 2 * \fI{print_file, Filename}\fR\& .LP .TP 2 * \fI{open_url, Url}\fR\& .LP .TP 2 * \fI{reopen_app, ""}\fR\& .LP .RE .LP The call always returns ok but will have sent any already received events to the calling process\&. .RE .LP .B null() -> wx_object() .br .RS .LP Returns the null object .RE .LP .B is_null(Wx_ref::wx_object()) -> boolean() .br .RS .LP Returns true if object is null, false otherwise .RE .LP .B equal(Wx_ref::wx_object(), X2::wx_object()) -> boolean() .br .RS .LP Returns true if both arguments references the same object, false otherwise .RE .LP .B getObjectType(Wx_ref::wx_object()) -> atom() .br .RS .LP Returns the object type .RE .LP .B typeCast(Old::wx_object(), NewType::atom()) -> wx_object() .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\& foldl/3, foldr/3, foreach/2, map/2\&. .RE .LP .B foreach(Fun::function(), List::list()) -> ok .br .RS .LP Behaves like lists:foreach/2 but batches wx commands\&. See batch/1\&. .RE .LP .B map(Fun::function(), List::list()) -> list() .br .RS .LP Behaves like lists:map/2 but batches wx commands\&. See batch/1\&. .RE .LP .B foldl(Fun::function(), Acc::term(), List::list()) -> term() .br .RS .LP Behaves like lists:foldl/3 but batches wx commands\&. See batch/1\&. .RE .LP .B foldr(Fun::function(), Acc::term(), List::list()) -> term() .br .RS .LP Behaves like lists:foldr/3 but batches wx commands\&. See batch/1\&. .RE .LP .B create_memory(Size::integer()) -> wx_memory() .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::wx_memory()) -> binary() .br .RS .LP Returns the memory area as a binary\&. .RE .LP .B retain_memory(Wx_mem::wx_memory()) -> 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::wx_memory()) -> 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 <>