wx
Description
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=unicode:chardata(),
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
- wx_colour() = {R::byte(), G::byte(), B::byte()} | wx_colour4()
- wx_colour4() = {R::byte(), G::byte(), B::byte(), A::byte()}
- wx_datetime() = {{Year::integer(), Month::integer(), Day::integer()}, {Hour::integer(), Minute::integer(), Second::integer()}}
-
In Local Timezone
- wx_enum() = integer()
-
Constant defined in wx.hrl
- wx_env() = #wx_env{}
-
Opaque process environment
- wx_memory() = binary() | #wx_mem{}
-
Opaque memory reference
- wx_object() = #wx_ref{}
-
Opaque object reference
- wx_wxHtmlLinkInfo() = #wxHtmlLinkInfo{href=unicode:chardata(), target=unicode:chardata()}
- wx_wxMouseState() = #wxMouseState{x=integer(), y=integer(), leftDown=boolean(), middleDown=boolean(), rightDown=boolean(), controlDown=boolean(), shiftDown=boolean(), altDown=boolean(), metaDown=boolean(), cmdDown=boolean()}
-
See #wxMouseState{} defined in wx.hrl
new() -> wx_object()
new(Options::[Option]) -> wx_object()
get_env() -> wx_env()
Gets this process's current wx environment. Can be sent to other processes to allow them use this process wx environment.
See also: set_env/1.
set_env(Wx_env::wx_env()) -> ok
Adds the calling process to the list of of processes that are listening to wx application events.
At the moment these are all MacOSX specific events corresponding to MacNewFile() and friends from wxWidgets wxApp:
-
{new_file, ""}
-
{open_file, Filename}
-
{print_file, Filename}
-
{open_url, Url}
-
{reopen_app, ""}
The call always returns ok but will have sent any already received events to the calling process.
null() -> wx_object()
is_null(Wx_ref::wx_object()) -> boolean()
equal(Wx_ref::wx_object(), X2::wx_object()) -> boolean()
getObjectType(Wx_ref::wx_object()) -> atom()
typeCast(Old::wx_object(), NewType::atom()) -> wx_object()
Behaves like lists:foreach/2 but batches wx commands. See batch/1.
Behaves like lists:map/2 but batches wx commands. See batch/1.
Behaves like lists:foldl/3 but batches wx commands. See batch/1.
Behaves like 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.