]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/tlw.tex
dfcb1d2d9f1ca687ec2a6f168fce28c8e4204ea7
[wxWidgets.git] / docs / latex / wx / tlw.tex
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 %% Name: tlw.tex
3 %% Purpose: wxTopLevelWindow documentation
4 %% Author: Vadim Zeitlin
5 %% Modified by:
6 %% Created: 2004-09-07 (partly extracted from frame.tex)
7 %% RCS-ID: $Id$
8 %% Copyright: (c) 2004 Vadim Zeitlin
9 %% License: wxWindows license
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
12 \section{\class{wxTopLevelWindow}}\label{wxtoplevelwindow}
13
14 wxTopLevelWindow is a common base class for \helpref{wxDialog}{wxdialog} and
15 \helpref{wxFrame}{wxframe}. It is an abstract base class meaning that you never
16 work with objects of this class directly, but all of its methods are also
17 applicable for the two classes above.
18
19 \wxheading{Derived from}
20
21 \helpref{wxWindow}{wxwindow}\\
22 \helpref{wxEvtHandler}{wxevthandler}\\
23 \helpref{wxObject}{wxobject}
24
25 \wxheading{Include files}
26
27 <wx/toplevel.h>
28
29
30 \latexignore{\rtfignore{\wxheading{Members}}}
31
32 \membersection{wxTopLevelWindow::CanSetTransparent}\label{wxtoplevelwindowcansettransparent}
33
34 \func{virtual bool}{CanSetTransparent}{\void}
35
36 Returns \true if the platform supports making the window translucent.
37
38 \wxheading{See also}
39
40 \helpref{wxTopLevelWindow::SetTransparent}{wxtoplevelwindowsettransparent}
41
42
43 \membersection{wxTopLevelWindow::EnableCloseButton}\label{wxtoplevelenableclosebutton}
44
45 \func{bool}{EnableCloseButton}{\param{bool}{ enable = true}}
46
47 Enables or disables the Close button (most often in the right
48 upper corner of a dialog) and the Close entry of the system
49 menu (most often in the left upper corner of the dialog).
50 Currently only implemented for wxMSW and wxGTK.
51
52 \membersection{wxTopLevelWindow::GetDefaultItem}\label{wxtoplevelwindowgetdefaultitem}
53
54 \constfunc{wxWindow *}{GetDefaultItem}{\void}
55
56 Returns a pointer to the button which is the default for this window, or \NULL.
57 The default button is the one activated by pressing the Enter key.
58
59
60 \membersection{wxTopLevelWindow::GetIcon}\label{wxtoplevelwindowgeticon}
61
62 \constfunc{const wxIcon\&}{GetIcon}{\void}
63
64 Returns the standard icon of the window. The icon will be invalid if it hadn't
65 been previously set by \helpref{SetIcon}{wxtoplevelwindowseticon}.
66
67 \wxheading{See also}
68
69 \helpref{GetIcons}{wxtoplevelwindowgeticons}
70
71
72 \membersection{wxTopLevelWindow::GetIcons}\label{wxtoplevelwindowgeticons}
73
74 \constfunc{const wxIconBundle\&}{GetIcons}{\void}
75
76 Returns all icons associated with the window, there will be none of them if
77 neither \helpref{SetIcon}{wxtoplevelwindowseticon} nor
78 \helpref{SetIcons}{wxtoplevelwindowseticons} had been called before.
79
80 Use \helpref{GetIcon}{wxtoplevelwindowgeticon} to get the main icon of the
81 window.
82
83 \wxheading{See also}
84
85 \helpref{wxIconBundle}{wxiconbundle}
86
87
88 \membersection{wxTopLevelWindow::GetTitle}\label{wxtoplevelwindowgettitle}
89
90 \constfunc{wxString}{GetTitle}{\void}
91
92 Gets a string containing the window title.
93
94 \wxheading{See also}
95
96 \helpref{wxTopLevelWindow::SetTitle}{wxtoplevelwindowsettitle}
97
98
99 \membersection{wxTopLevelWindow::HandleSettingChange}\label{wxtoplevelwindowhandlesettingchange}
100
101 \func{virtual bool}{HandleSettingChange}{\param{WXWPARAM}{ wParam}, \param{WXLPARAM}{ lParam}}
102
103 Unique to the wxWinCE port. Responds to showing/hiding SIP (soft input panel) area and resize
104 window accordingly. Override this if you want to avoid resizing or do additional
105 operations.
106
107
108 \membersection{wxTopLevelWindow::IsActive}\label{wxtoplevelwindowisactive}
109
110 \constfunc{bool}{IsActive}{\void}
111
112 Returns \true if this window is currently active, i.e. if the user is currently
113 working with it.
114
115
116 \membersection{wxTopLevelWindow::IsAlwaysMaximized}\label{wxtoplevelwindowisalwaysmaximized}
117
118 \constfunc{virtual bool}{IsAlwaysMaximized}{\void}
119
120 Returns \true if this window is expected to be always maximized, either due to platform policy
121 or due to local policy regarding particular class.
122
123
124 \membersection{wxTopLevelWindow::Iconize}\label{wxtoplevelwindowiconize}
125
126 \func{void}{Iconize}{\param{bool}{ iconize}}
127
128 Iconizes or restores the window.
129
130 \wxheading{Parameters}
131
132 \docparam{iconize}{If \true, iconizes the window; if \false, shows and restores it.}
133
134 \wxheading{See also}
135
136 \helpref{wxTopLevelWindow::IsIconized}{wxtoplevelwindowisiconized}, \helpref{wxTopLevelWindow::Maximize}{wxtoplevelwindowmaximize}.
137
138
139 \membersection{wxTopLevelWindow::IsFullScreen}\label{wxtoplevelwindowisfullscreen}
140
141 \func{bool}{IsFullScreen}{\void}
142
143 Returns \true if the window is in fullscreen mode.
144
145 \wxheading{See also}
146
147 \helpref{wxTopLevelWindow::ShowFullScreen}{wxtoplevelwindowshowfullscreen}
148
149
150 \membersection{wxTopLevelWindow::IsIconized}\label{wxtoplevelwindowisiconized}
151
152 \constfunc{bool}{IsIconized}{\void}
153
154 Returns \true if the window is iconized.
155
156
157 \membersection{wxTopLevelWindow::IsMaximized}\label{wxtoplevelwindowismaximized}
158
159 \constfunc{bool}{IsMaximized}{\void}
160
161 Returns \true if the window is maximized.
162
163
164 \membersection{wxTopLevelWindow::IsUsingNativeDecorations}\label{wxtoplevelwindowisusingnativedecorations}
165
166 \constfunc{bool}{IsUsingNativeDecorations}{\void}
167
168 \bftt{This method is specific to wxUniversal port}
169
170 Returns \true if this window is using native decorations, \false if we draw
171 them ourselves.
172
173 \wxheading{See also}
174
175 \helpref{UseNativeDecorations}{wxtoplevelwindowusenativedecorations},\\
176 \helpref{UseNativeDecorationsByDefault}{wxtoplevelwindowusenativedecorationsbydefault}
177
178
179 \membersection{wxTopLevelWindow::Maximize}\label{wxtoplevelwindowmaximize}
180
181 \func{void}{Maximize}{\param{bool }{maximize}}
182
183 Maximizes or restores the window.
184
185 \wxheading{Parameters}
186
187 \docparam{maximize}{If \true, maximizes the window, otherwise it restores it.}
188
189 \wxheading{See also}
190
191 \helpref{wxTopLevelWindow::Iconize}{wxtoplevelwindowiconize}
192
193
194 \membersection{wxTopLevelWindow::RequestUserAttention}\label{wxtoplevelwindowrequestuserattention}
195
196 \func{void}{RequestUserAttention}{\param{int }{flags = wxUSER\_ATTENTION\_INFO}}
197
198 Use a system-dependent way to attract users attention to the window when it is
199 in background.
200
201 \arg{flags} may have the value of either \texttt{wxUSER\_ATTENTION\_INFO}
202 (default) or \texttt{wxUSER\_ATTENTION\_ERROR} which results in a more drastic
203 action. When in doubt, use the default value.
204
205 Note that this function should normally be only used when the application is
206 not already in foreground.
207
208 This function is currently implemented for Win32 where it flashes the
209 window icon in the taskbar, and for wxGTK with task bars supporting it.
210
211
212 \membersection{wxTopLevelWindow::SetDefaultItem}\label{wxtoplevelwindowsetdefaultitem}
213
214 \func{void}{SetDefaultItem}{\param{wxWindow }{*win}}
215
216 Changes the default item for the panel, usually \arg{win} is a button.
217
218 \wxheading{See also}
219
220 \helpref{GetDefaultItem}{wxtoplevelwindowgetdefaultitem}
221
222
223 \membersection{wxTopLevelWindow::SetIcon}\label{wxtoplevelwindowseticon}
224
225 \func{void}{SetIcon}{\param{const wxIcon\& }{icon}}
226
227 Sets the icon for this window.
228
229 \wxheading{Parameters}
230
231 \docparam{icon}{The icon to associate with this window.}
232
233 \wxheading{Remarks}
234
235 The window takes a `copy' of {\it icon}, but since it uses reference
236 counting, the copy is very quick. It is safe to delete {\it icon} after
237 calling this function.
238
239 See also \helpref{wxIcon}{wxicon}.
240
241
242 \membersection{wxTopLevelWindow::SetIcons}\label{wxtoplevelwindowseticons}
243
244 \func{void}{SetIcons}{\param{const wxIconBundle\& }{icons}}
245
246 Sets several icons of different sizes for this window: this allows to use
247 different icons for different situations (e.g. task switching bar, taskbar,
248 window title bar) instead of scaling, with possibly bad looking results, the
249 only icon set by \helpref{SetIcon}{wxtoplevelwindowseticon}.
250
251 \wxheading{Parameters}
252
253 \docparam{icons}{The icons to associate with this window.}
254
255 \wxheading{See also}
256
257 \helpref{wxIconBundle}{wxiconbundle}.
258
259
260 \membersection{wxTopLevelWindow::SetLeftMenu}\label{wxtoplevelwindowsetleftmenu}
261
262 \func{void}{SetLeftMenu}{\param{int}{ id = wxID\_ANY}, \param{const wxString\&}{ label = wxEmptyString}, \param{wxMenu *}{ subMenu = NULL}}
263
264 Sets action or menu activated by pressing left hardware button on the smart phones.
265 Unavailable on full keyboard machines.
266
267 \wxheading{Parameters}
268
269 \docparam{id}{Identifier for this button.}
270
271 \docparam{label}{Text to be displayed on the screen area dedicated to this hardware button.}
272
273 \docparam{subMenu}{The menu to be opened after pressing this hardware button.}
274
275 \wxheading{See also}
276
277 \helpref{wxTopLevelWindow::SetRightMenu}{wxtoplevelwindowsetrightmenu}.
278
279
280 \membersection{wxTopLevelWindow::SetRightMenu}\label{wxtoplevelwindowsetrightmenu}
281
282 \func{void}{SetRightMenu}{\param{int}{ id = wxID\_ANY}, \param{const wxString\&}{ label = wxEmptyString}, \param{wxMenu *}{ subMenu = NULL}}
283
284 Sets action or menu activated by pressing right hardware button on the smart phones.
285 Unavailable on full keyboard machines.
286
287 \wxheading{Parameters}
288
289 \docparam{id}{Identifier for this button.}
290
291 \docparam{label}{Text to be displayed on the screen area dedicated to this hardware button.}
292
293 \docparam{subMenu}{The menu to be opened after pressing this hardware button.}
294
295 \wxheading{See also}
296
297 \helpref{wxTopLevelWindow::SetLeftMenu}{wxtoplevelwindowsetleftmenu}.
298
299
300 \membersection{wxTopLevelWindow::SetShape}\label{wxtoplevelwindowsetshape}
301
302 \func{bool}{SetShape}{\param{const wxRegion\&}{ region}}
303
304 If the platform supports it, sets the shape of the window to that
305 depicted by {\it region}. The system will not display or
306 respond to any mouse event for the pixels that lie outside of the
307 region. To reset the window to the normal rectangular shape simply
308 call {\it SetShape} again with an empty region. Returns true if the
309 operation is successful.
310
311
312 \membersection{wxTopLevelWindow::SetTitle}\label{wxtoplevelwindowsettitle}
313
314 \func{virtual void}{SetTitle}{\param{const wxString\& }{ title}}
315
316 Sets the window title.
317
318 \wxheading{Parameters}
319
320 \docparam{title}{The window title.}
321
322 \wxheading{See also}
323
324 \helpref{wxTopLevelWindow::GetTitle}{wxtoplevelwindowgettitle}
325
326
327 \membersection{wxTopLevelWindow::SetTransparent}\label{wxtoplevelwindowsettransparent}
328
329 \func{virtual bool}{SetTransparent}{\param{int }{ alpha}}
330
331 If the platform supports it will set the window to be translucent
332
333 \wxheading{Parameters}
334
335 \docparam{alpha}{Determines how opaque or transparent the window will
336 be, if the platform supports the opreration. A value of 0 sets the
337 window to be fully transparent, and a value of 255 sets the window
338 to be fully opaque.}
339
340 Returns \true if the transparency was successfully changed.
341
342
343
344 \membersection{wxTopLevelWindow::ShouldPreventAppExit}\label{wxtoplevelwindowshouldpreventappexit}
345
346 \constfunc{virtual bool}{ShouldPreventAppExit}{\void}
347
348 This virtual function is not meant to be called directly but can be overridden
349 to return \false (it returns \true by default) to allow the application to
350 close even if this, presumably not very important, window is still opened.
351 By default, the application stays alive as long as there are any open top level
352 windows.
353
354
355 \membersection{wxTopLevelWindow::ShowFullScreen}\label{wxtoplevelwindowshowfullscreen}
356
357 \func{bool}{ShowFullScreen}{\param{bool}{ show}, \param{long}{ style = wxFULLSCREEN\_ALL}}
358
359 Depending on the value of {\it show} parameter the window is either shown full
360 screen or restored to its normal state. {\it style} is a bit list containing
361 some or all of the following values, which indicate what elements of the window
362 to hide in full-screen mode:
363
364 \begin{itemize}\itemsep=0pt
365 \item wxFULLSCREEN\_NOMENUBAR
366 \item wxFULLSCREEN\_NOTOOLBAR
367 \item wxFULLSCREEN\_NOSTATUSBAR
368 \item wxFULLSCREEN\_NOBORDER
369 \item wxFULLSCREEN\_NOCAPTION
370 \item wxFULLSCREEN\_ALL (all of the above)
371 \end{itemize}
372
373 This function has not been tested with MDI frames.
374
375 Note that showing a window full screen also actually
376 \helpref{Show()s}{wxwindowshow} if it hadn't been shown yet.
377
378 \wxheading{See also}
379
380 \helpref{wxTopLevelWindow::IsFullScreen}{wxtoplevelwindowisfullscreen}
381
382
383 \membersection{wxTopLevelWindow::UseNativeDecorations}\label{wxtoplevelwindowusenativedecorations}
384
385 \func{void}{UseNativeDecorations}{\param{bool }{native = \true}}
386
387 \bftt{This method is specific to wxUniversal port}
388
389 Use native or custom-drawn decorations for this window only. Notice that to
390 have any effect this method must be called before really creating the window,
391 i.e. two step creation must be used:
392 \begin{verbatim}
393 MyFrame *frame = new MyFrame; // use default ctor
394 frame->UseNativeDecorations(false); // change from default "true"
395 frame->Create(parent, title, ...); // really create the frame
396 \end{verbatim}
397
398 \wxheading{See also}
399
400 \helpref{UseNativeDecorationsByDefault}{wxtoplevelwindowusenativedecorationsbydefault},\\
401 \helpref{IsUsingNativeDecorations}{wxtoplevelwindowisusingnativedecorations}
402
403
404 \membersection{wxTopLevelWindow::UseNativeDecorationsByDefault}\label{wxtoplevelwindowusenativedecorationsbydefault}
405
406 \func{void}{UseNativeDecorationsByDefault}{\param{bool }{native = \true}}
407
408 \bftt{This method is specific to wxUniversal port}
409
410 Top level windows in wxUniversal port can use either system-provided window
411 decorations (i.e. title bar and various icons, buttons and menus in it) or draw
412 the decorations themselves. By default the system decorations are used if they
413 are available, but this method can be called with \arg{native} set to \false to
414 change this for all windows created after this point.
415
416 Also note that if \texttt{WXDECOR} environment variable is set, then custom
417 decorations are used by default and so it may make sense to call this method
418 with default argument if the application can't use custom decorations at all
419 for some reason.
420
421 \wxheading{See also}
422
423 \helpref{UseNativeDecorations}{wxtoplevelwindowusenativedecorations}
424