File: function.tex

package info (click to toggle)
wxwidgets2.8 2.8.10.1-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 239,052 kB
  • ctags: 289,550
  • sloc: cpp: 1,838,857; xml: 396,717; python: 282,506; ansic: 126,171; makefile: 51,406; sh: 14,581; asm: 299; sql: 258; lex: 194; perl: 139; yacc: 128; pascal: 95; php: 39; lisp: 38; tcl: 24; haskell: 20; java: 18; cs: 18; erlang: 17; ruby: 16; ada: 9; ml: 9; csh: 9
file content (361 lines) | stat: -rw-r--r-- 13,536 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
\chapter{Functions}\label{functions}
\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}%
\setfooter{\thepage}{}{}{}{}{\thepage}

Deprecated functions and macros defined in wxWindows are described here: you can
either look up a function using the alphabetical listing of them or find it in
the corresponding topic.

\section{Alphabetical functions and macros list}

%\helpref{wxGetResource}{wxgetresource}\\
%\helpref{wxLoadUserResource}{wxloaduserresource}\\
%\helpref{wxMakeMetafilePlaceable}{wxmakemetafileplaceable}\\
%\helpref{wxNewId}{wxnewid}\\
\helpref{wxLoadFromResource}{wxloadfromresource}\\
\helpref{wxResourceAddIdentifier}{wxresourceaddidentifier}\\
\helpref{wxResourceClear}{wxresourceclear}\\
\helpref{wxResourceCreateBitmap}{wxresourcecreatebitmap}\\
\helpref{wxResourceCreateIcon}{wxresourcecreateicon}\\
\helpref{wxResourceCreateMenuBar}{wxresourcecreatemenubar}\\
\helpref{wxResourceGetIdentifier}{wxresourcegetidentifier}\\
\helpref{wxResourceParseData}{wxresourcedata}\\
\helpref{wxResourceParseFile}{wxresourceparsefile}\\
\helpref{wxResourceParseString}{wxresourceparsestring}\\
\helpref{wxResourceRegisterBitmapData}{registerbitmapdata}\\
\helpref{wxResourceRegisterIconData}{wxresourceregistericondata}\\
%\helpref{wxSetPrinterCommand}{wxsetprintercommand}\\
%\helpref{wxSetPrinterFile}{wxsetprinterfile}\\
%\helpref{wxSetPrinterMode}{wxsetprintermode}\\
%\helpref{wxSetPrinterOptions}{wxsetprinteroptions}\\
%\helpref{wxSetPrinterOrientation}{wxsetprinterorientation}\\
%\helpref{wxSetPrinterPreviewCommand}{wxsetprinterpreviewcommand}\\
%\helpref{wxSetPrinterScaling}{wxsetprinterscaling}\\
%\helpref{wxSetPrinterTranslation}{wxsetprintertranslation}\\

\section{Printer settings}\label{printersettings}

{\bf NB:} These routines are obsolete and should no longer be used!

The following functions are used to control PostScript printing. Under
Windows, PostScript output can only be sent to a file.

\wxheading{Include files}

<wx/dcps.h>

\membersection{::wxGetPrinterCommand}\label{wxgetprintercommand}

\func{wxString}{wxGetPrinterCommand}{\void}

Gets the printer command used to print a file. The default is {\tt lpr}.

\membersection{::wxGetPrinterFile}\label{wxgetprinterfile}

\func{wxString}{wxGetPrinterFile}{\void}

Gets the PostScript output filename.

\membersection{::wxGetPrinterMode}\label{wxgetprintermode}

\func{int}{wxGetPrinterMode}{\void}

Gets the printing mode controlling where output is sent (PS\_PREVIEW, PS\_FILE or PS\_PRINTER).
The default is PS\_PREVIEW.

\membersection{::wxGetPrinterOptions}\label{wxgetprinteroptions}

\func{wxString}{wxGetPrinterOptions}{\void}

Gets the additional options for the print command (e.g. specific printer). The default is nothing.

\membersection{::wxGetPrinterOrientation}\label{wxgetprinterorientation}

\func{int}{wxGetPrinterOrientation}{\void}

Gets the orientation (PS\_PORTRAIT or PS\_LANDSCAPE). The default is PS\_PORTRAIT.

\membersection{::wxGetPrinterPreviewCommand}\label{wxgetprinterpreviewcommand}

\func{wxString}{wxGetPrinterPreviewCommand}{\void}

Gets the command used to view a PostScript file. The default depends on the platform.

\membersection{::wxGetPrinterScaling}\label{wxgetprinterscaling}

\func{void}{wxGetPrinterScaling}{\param{float *}{x}, \param{float *}{y}}

Gets the scaling factor for PostScript output. The default is 1.0, 1.0.

\membersection{::wxGetPrinterTranslation}\label{wxgetprintertranslation}

\func{void}{wxGetPrinterTranslation}{\param{float *}{x}, \param{float *}{y}}

Gets the translation (from the top left corner) for PostScript output. The default is 0.0, 0.0.

\membersection{::wxSetPrinterCommand}\label{wxsetprintercommand}

\func{void}{wxSetPrinterCommand}{\param{const wxString\& }{command}}

Sets the printer command used to print a file. The default is {\tt lpr}.

\membersection{::wxSetPrinterFile}\label{wxsetprinterfile}

\func{void}{wxSetPrinterFile}{\param{const wxString\& }{filename}}

Sets the PostScript output filename.

\membersection{::wxSetPrinterMode}\label{wxsetprintermode}

\func{void}{wxSetPrinterMode}{\param{int }{mode}}

Sets the printing mode controlling where output is sent (PS\_PREVIEW, PS\_FILE or PS\_PRINTER).
The default is PS\_PREVIEW.

\membersection{::wxSetPrinterOptions}\label{wxsetprinteroptions}

\func{void}{wxSetPrinterOptions}{\param{const wxString\& }{options}}

Sets the additional options for the print command (e.g. specific printer). The default is nothing.

\membersection{::wxSetPrinterOrientation}\label{wxsetprinterorientation}

\func{void}{wxSetPrinterOrientation}{\param{int}{ orientation}}

Sets the orientation (PS\_PORTRAIT or PS\_LANDSCAPE). The default is PS\_PORTRAIT.

\membersection{::wxSetPrinterPreviewCommand}\label{wxsetprinterpreviewcommand}

\func{void}{wxSetPrinterPreviewCommand}{\param{const wxString\& }{command}}

Sets the command used to view a PostScript file. The default depends on the platform.

\membersection{::wxSetPrinterScaling}\label{wxsetprinterscaling}

\func{void}{wxSetPrinterScaling}{\param{float }{x}, \param{float }{y}}

Sets the scaling factor for PostScript output. The default is 1.0, 1.0.

\membersection{::wxSetPrinterTranslation}\label{wxsetprintertranslation}

\func{void}{wxSetPrinterTranslation}{\param{float }{x}, \param{float }{y}}

Sets the translation (from the top left corner) for PostScript output. The default is 0.0, 0.0.

\section{Resource functions}\label{resourcefunctions}

\overview{Resource functions}{resourceformats}

This section details functions for manipulating wxWindows (.WXR) resource
files and loading user interface elements from resources.

\normalbox{Please note that this use of the word `resource' is different from that used when talking
about initialisation file resource reading and writing, using such functions
as wxWriteResource and wxGetResource. It is just an unfortunate clash of terminology.}

\helponly{For an overview of the wxWindows resource mechanism, see \helpref{the wxWindows resource system}{resourceformats}.}

See also \helpref{wxWindow::LoadFromResource}{wxwindowloadfromresource} for
loading from resource data.

\membersection{wxLoadFromResource}\label{wxloadfromresource}

\func{virtual bool}{LoadFromResource}{\param{wxWindow* thisWindow}, \param{wxWindow* }{parent},\rtfsp
\param{const wxString\& }{resourceName}, \param{const wxResourceTable* }{resourceTable = NULL}}

Loads a panel or dialog from a resource file.

\wxheading{Parameters}

\docparam{thisWindow}{Window to load the resource into.}

\docparam{parent}{Parent window.}

\docparam{resourceName}{The name of the resource to load.}

\docparam{resourceTable}{The resource table to load it from. If this is NULL, the
default resource table will be used.}

\wxheading{Return value}

{\tt true} if the operation succeeded, otherwise {\tt false}.

\membersection{::wxResourceAddIdentifier}\label{wxresourceaddidentifier}

\func{bool}{wxResourceAddIdentifier}{\param{const wxString\& }{name}, \param{int }{value}}

Used for associating a name with an integer identifier (equivalent to dynamically\rtfsp
{\tt\#}defining a name to an integer). Unlikely to be used by an application except
perhaps for implementing resource functionality for interpreted languages.

\membersection{::wxResourceClear}\label{wxresourceclear}

\func{void}{wxResourceClear}{\void}

Clears the wxWindows resource table.

\membersection{::wxResourceCreateBitmap}\label{wxresourcecreatebitmap}

\func{wxBitmap *}{wxResourceCreateBitmap}{\param{const wxString\& }{resource}}

Creates a new bitmap from a file, static data, or Windows resource, given a valid
wxWindows bitmap resource identifier. For example, if the .WXR file contains
the following:

\begin{verbatim}
static const wxString\& project_resource = "bitmap(name = 'project_resource',\
  bitmap = ['project', wxBITMAP_TYPE_BMP_RESOURCE, 'WINDOWS'],\
  bitmap = ['project.xpm', wxBITMAP_TYPE_XPM, 'X']).";
\end{verbatim}

then this function can be called as follows:

\begin{verbatim}
  wxBitmap *bitmap  = wxResourceCreateBitmap("project_resource");
\end{verbatim}

\membersection{::wxResourceCreateIcon}\label{wxresourcecreateicon}

\func{wxIcon *}{wxResourceCreateIcon}{\param{const wxString\& }{resource}}

Creates a new icon from a file, static data, or Windows resource, given a valid
wxWindows icon resource identifier. For example, if the .WXR file contains
the following:

\begin{verbatim}
static const wxString\& project_resource = "icon(name = 'project_resource',\
  icon = ['project', wxBITMAP_TYPE_ICO_RESOURCE, 'WINDOWS'],\
  icon = ['project', wxBITMAP_TYPE_XBM_DATA, 'X']).";
\end{verbatim}

then this function can be called as follows:

\begin{verbatim}
  wxIcon *icon = wxResourceCreateIcon("project_resource");
\end{verbatim}

\membersection{::wxResourceCreateMenuBar}\label{wxresourcecreatemenubar}

\func{wxMenuBar *}{wxResourceCreateMenuBar}{\param{const wxString\& }{resource}}

Creates a new menu bar given a valid wxWindows menubar resource
identifier. For example, if the .WXR file contains the following:

\begin{verbatim}
static const wxString\& menuBar11 = "menu(name = 'menuBar11',\
  menu = \
  [\
    ['&File', 1, '', \
      ['&Open File', 2, 'Open a file'],\
      ['&Save File', 3, 'Save a file'],\
      [],\
      ['E&xit', 4, 'Exit program']\
    ],\
    ['&Help', 5, '', \
      ['&About', 6, 'About this program']\
    ]\
  ]).";
\end{verbatim}

then this function can be called as follows:

\begin{verbatim}
  wxMenuBar *menuBar = wxResourceCreateMenuBar("menuBar11");
\end{verbatim}


\membersection{::wxResourceGetIdentifier}\label{wxresourcegetidentifier}

\func{int}{wxResourceGetIdentifier}{\param{const wxString\& }{name}}

Used for retrieving the integer value associated with an identifier.
A zero value indicates that the identifier was not found.

See \helpref{wxResourceAddIdentifier}{wxresourceaddidentifier}.

\membersection{::wxResourceParseData}\label{wxresourcedata}

\func{bool}{wxResourceParseData}{\param{const wxString\& }{resource}, \param{wxResourceTable *}{table = NULL}}

Parses a string containing one or more wxWindows resource objects. If
the resource objects are global static data that are included into the
C++ program, then this function must be called for each variable
containing the resource data, to make it known to wxWindows.

{\it resource} should contain data in the following form:

\begin{verbatim}
dialog(name = 'dialog1',
  style = 'wxCAPTION | wxDEFAULT_DIALOG_STYLE',
  title = 'Test dialog box',
  x = 312, y = 234, width = 400, height = 300,
  modal = 0,
  control = [1000, wxStaticBox, 'Groupbox', '0', 'group6', 5, 4, 380, 262,
      [11, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0]],
  control = [1001, wxTextCtrl, '', 'wxTE_MULTILINE', 'text3',
      156, 126, 200, 70, 'wxWindows is a multi-platform, GUI toolkit.',
      [11, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0],
      [11, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0]]).
\end{verbatim}

This function will typically be used after including a {\tt .wxr} file into
a C++ program as follows:

\begin{verbatim}
#include "dialog1.wxr"
\end{verbatim}

Each of the contained resources will declare a new C++ variable, and each
of these variables should be passed to wxResourceParseData.

\membersection{::wxResourceParseFile}\label{wxresourceparsefile}

\func{bool}{wxResourceParseFile}{\param{const wxString\& }{filename}, \param{wxResourceTable *}{table = NULL}}

Parses a file containing one or more wxWindows resource objects
in C++-compatible syntax. Use this function to dynamically load
wxWindows resource data.

\membersection{::wxResourceParseString}\label{wxresourceparsestring}

\func{bool}{wxResourceParseString}{\param{char *}{s}, \param{wxResourceTable *}{table = NULL}}

Parses a string containing one or more wxWindows resource objects. If
the resource objects are global static data that are included into the
C++ program, then this function must be called for each variable
containing the resource data, to make it known to wxWindows.

{\it resource} should contain data with the following form:

\begin{verbatim}
dialog(name = 'dialog1',
  style = 'wxCAPTION | wxDEFAULT_DIALOG_STYLE',
  title = 'Test dialog box',
  x = 312, y = 234, width = 400, height = 300,
  modal = 0,
  control = [1000, wxStaticBox, 'Groupbox', '0', 'group6', 5, 4, 380, 262,
      [11, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0]],
  control = [1001, wxTextCtrl, '', 'wxTE_MULTILINE', 'text3',
      156, 126, 200, 70, 'wxWindows is a multi-platform, GUI toolkit.',
      [11, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0],
      [11, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0]]).
\end{verbatim}

This function will typically be used after calling \helpref{wxLoadUserResource}{wxloaduserresource} to
load an entire {\tt .wxr file} into a string.

\membersection{::wxResourceRegisterBitmapData}\label{registerbitmapdata}

\func{bool}{wxResourceRegisterBitmapData}{\param{const wxString\& }{name}, \param{char *}{xbm\_data}, \param{int }{width},
\param{int }{height}, \param{wxResourceTable *}{table = NULL}}

\func{bool}{wxResourceRegisterBitmapData}{\param{const wxString\& }{name}, \param{char **}{xpm\_data}}

Makes {\tt\#}included XBM or XPM bitmap data known to the wxWindows resource system.
This is required if other resources will use the bitmap data, since otherwise there
is no connection between names used in resources, and the global bitmap data.

\membersection{::wxResourceRegisterIconData}\label{wxresourceregistericondata}

Another name for \helpref{wxResourceRegisterBitmapData}{registerbitmapdata}.