1wx(3) Erlang Module Definition wx(3)
2
3
4
6 wx - A port of wxWidgets.
7
9 A port of wxWidgets.
10
11 This is the base api of wxWidgets. This module contains functions for
12 starting and stopping the wx-server, as well as other utility func‐
13 tions.
14
15 wxWidgets is object oriented, and not functional. Thus, in wxErlang a
16 module represents a class, and the object created by this class has an
17 own type, wxCLASS(). This module represents the base class, and all
18 other wxMODULE's are sub-classes of this class.
19
20 Objects of a class are created with wxCLASS:new(...) and destroyed with
21 wxCLASS:destroy(). Member functions are called with wxCLASS:member(Ob‐
22 ject, ...) instead of as in C++ Object.member(...).
23
24 Sub class modules inherit (non static) functions from their parents.
25 The inherited functions are not documented in the sub-classes.
26
27 This erlang port of wxWidgets tries to be a one-to-one mapping with the
28 original wxWidgets library. Some things are different though, as the
29 optional arguments use property lists and can be in any order. The main
30 difference is the event handling which is different from the original
31 library. See wxEvtHandler.
32
33 The following classes are implemented directly as erlang types:
34 wxPoint={x,y},wxSize={w,h},wxRect={x,y,w,h},wxColour={r,g,b [,a]},
35 wxString=unicode:chardata(), wxGBPosition={r,c},wxGBSpan={rs,cs},wx‐
36 GridCellCoords={r,c}.
37
38 wxWidgets uses a process specific environment, which is created by
39 wx:new/0. To be able to use the environment from other processes, call
40 get_env/0 to retrieve the environment and set_env/1 to assign the envi‐
41 ronment in the other process.
42
43 Global (classless) functions are located in the wx_misc module.
44
46 wx_colour() = {R::byte(), G::byte(), B::byte()} | wx_colour4():
47
48
49 wx_colour4() = {R::byte(), G::byte(), B::byte(), A::byte()}:
50
51
52 wx_datetime() = {{Year::integer(), Month::integer(), Day::integer()},
53 {Hour::integer(), Minute::integer(), Second::integer()}}:
54
55
56 In Local Timezone
57
58 wx_enum() = integer():
59
60
61 Constant defined in wx.hrl
62
63 wx_env() = #wx_env{}:
64
65
66 Opaque process environment
67
68 wx_memory() = binary() | #wx_mem{}:
69
70
71 Opaque memory reference
72
73 wx_object() = #wx_ref{}:
74
75
76 Opaque object reference
77
78 wx_wxHtmlLinkInfo() = #wxHtmlLinkInfo{href=unicode:chardata(), tar‐
79 get=unicode:chardata()}:
80
81
82 wx_wxMouseState() = #wxMouseState{x=integer(), y=integer(), left‐
83 Down=boolean(), middleDown=boolean(), rightDown=boolean(), con‐
84 trolDown=boolean(), shiftDown=boolean(), altDown=boolean(), metaD‐
85 own=boolean(), cmdDown=boolean()}:
86
87
88 See #wxMouseState{} defined in wx.hrl
89
91 parent_class(X1) -> term()
92
93 new() -> wx_object()
94
95 Starts a wx server.
96
97 new(Options::[Option]) -> wx_object()
98
99 Types:
100
101 Option = {debug, list() | atom()} | {silent_start, boolean()}
102
103 Starts a wx server. Option may be {debug, Level}, see debug/1.
104 Or {silent_start, Bool}, which causes error messages at startup
105 to be suppressed. The latter can be used as a silent test of
106 whether wx is properly installed or not.
107
108 destroy() -> ok
109
110 Stops a wx server.
111
112 get_env() -> wx_env()
113
114 Gets this process's current wx environment. Can be sent to other
115 processes to allow them use this process wx environment.
116
117 See also: set_env/1.
118
119 set_env(Wx_env::wx_env()) -> ok
120
121 Sets the process wx environment, allows this process to use an‐
122 other process wx environment.
123
124 null() -> wx_object()
125
126 Returns the null object
127
128 is_null(Wx_ref::wx_object()) -> boolean()
129
130 Returns true if object is null, false otherwise
131
132 equal(Wx_ref::wx_object(), X2::wx_object()) -> boolean()
133
134 Returns true if both arguments references the same object, false
135 otherwise
136
137 getObjectType(Wx_ref::wx_object()) -> atom()
138
139 Returns the object type
140
141 typeCast(Old::wx_object(), NewType::atom()) -> wx_object()
142
143 Casts the object to class NewType. It is needed when using func‐
144 tions like wxWindow:findWindow/2, which returns a generic wxOb‐
145 ject type.
146
147 batch(Fun::function()) -> term()
148
149 Batches all wx commands used in the fun. Improves performance of
150 the command processing by grabbing the wxWidgets thread so that
151 no event processing will be done before the complete batch of
152 commands is invoked.
153
154 See also: foldl/3, foldr/3, foreach/2, map/2.
155
156 foreach(Fun::function(), List::list()) -> ok
157
158 Behaves like lists:foreach/2 but batches wx commands. See
159 batch/1.
160
161 map(Fun::function(), List::list()) -> list()
162
163 Behaves like lists:map/2 but batches wx commands. See batch/1.
164
165 foldl(Fun::function(), Acc::term(), List::list()) -> term()
166
167 Behaves like lists:foldl/3 but batches wx commands. See batch/1.
168
169 foldr(Fun::function(), Acc::term(), List::list()) -> term()
170
171 Behaves like lists:foldr/3 but batches wx commands. See batch/1.
172
173 create_memory(Size::integer()) -> wx_memory()
174
175 Creates a memory area (of Size in bytes) which can be used by an
176 external library (i.e. opengl). It is up to the client to keep a
177 reference to this object so it does not get garbage collected by
178 erlang while still in use by the external library.
179
180 This is far from erlang's intentional usage and can crash the
181 erlang emulator. Use it carefully.
182
183 get_memory_bin(Wx_mem::wx_memory()) -> binary()
184
185 Returns the memory area as a binary.
186
187 retain_memory(Wx_mem::wx_memory()) -> ok
188
189 Saves the memory from deletion until release_memory/1 is called.
190 If release_memory/1 is not called the memory will not be garbage
191 collected.
192
193 release_memory(Wx_mem::wx_memory()) -> ok
194
195 debug(Debug::Level | [Level]) -> ok
196
197 Types:
198
199 Level = none | verbose | trace | driver | integer()
200
201 Sets debug level. If debug level is 'verbose' or 'trace' each
202 call is printed on console. If Level is 'driver' each allocated
203 object and deletion is printed on the console.
204
205 demo() -> ok | {error, atom()}
206
207 Starts a wxErlang demo if examples directory exists and is com‐
208 piled
209
211 <>
212
213
214
215 wx 2.1.4 wx(3)