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