1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %% Purpose: wxTopLevelWindow documentation
4 %% Author: Vadim Zeitlin
6 %% Created: 2004-09-07 (partly extracted from frame.tex)
8 %% Copyright: (c) 2004 Vadim Zeitlin
9 %% License: wxWindows license
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12 \section{\class{wxTopLevelWindow
}}\label{wxtoplevelwindow
}
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.
19 \wxheading{Derived from
}
21 \helpref{wxWindow
}{wxwindow
}\\
22 \helpref{wxEvtHandler
}{wxevthandler
}\\
23 \helpref{wxObject
}{wxobject
}
25 \wxheading{Include files
}
31 \helpref{wxCore
}{librarieslist
}
34 \latexignore{\rtfignore{\wxheading{Members
}}}
36 \membersection{wxTopLevelWindow::CanSetTransparent
}\label{wxtoplevelwindowcansettransparent
}
38 \func{virtual bool
}{CanSetTransparent
}{\void}
40 Returns
\true if the platform supports making the window translucent.
44 \helpref{wxTopLevelWindow::SetTransparent
}{wxtoplevelwindowsettransparent
}
47 \membersection{wxTopLevelWindow::EnableCloseButton
}\label{wxtoplevelenableclosebutton
}
49 \func{bool
}{EnableCloseButton
}{\param{bool
}{ enable = true
}}
51 Enables or disables the Close button (most often in the right
52 upper corner of a dialog) and the Close entry of the system
53 menu (most often in the left upper corner of the dialog).
54 Currently only implemented for wxMSW and wxGTK. Returns
55 true if operation was successful. This may be wrong on
56 X11 (including GTK+) where the window manager may not support
57 this operation and there is no way to find out.
59 \membersection{wxTopLevelWindow::GetDefaultItem
}\label{wxtoplevelwindowgetdefaultitem
}
61 \constfunc{wxWindow *
}{GetDefaultItem
}{\void}
63 Returns a pointer to the button which is the default for this window, or
\NULL.
64 The default button is the one activated by pressing the Enter key.
67 \membersection{wxTopLevelWindow::GetIcon
}\label{wxtoplevelwindowgeticon
}
69 \constfunc{const wxIcon\&
}{GetIcon
}{\void}
71 Returns the standard icon of the window. The icon will be invalid if it hadn't
72 been previously set by
\helpref{SetIcon
}{wxtoplevelwindowseticon
}.
76 \helpref{GetIcons
}{wxtoplevelwindowgeticons
}
79 \membersection{wxTopLevelWindow::GetIcons
}\label{wxtoplevelwindowgeticons
}
81 \constfunc{const wxIconBundle\&
}{GetIcons
}{\void}
83 Returns all icons associated with the window, there will be none of them if
84 neither
\helpref{SetIcon
}{wxtoplevelwindowseticon
} nor
85 \helpref{SetIcons
}{wxtoplevelwindowseticons
} had been called before.
87 Use
\helpref{GetIcon
}{wxtoplevelwindowgeticon
} to get the main icon of the
92 \helpref{wxIconBundle
}{wxiconbundle
}
95 \membersection{wxTopLevelWindow::GetTitle
}\label{wxtoplevelwindowgettitle
}
97 \constfunc{wxString
}{GetTitle
}{\void}
99 Gets a string containing the window title.
103 \helpref{wxTopLevelWindow::SetTitle
}{wxtoplevelwindowsettitle
}
106 \membersection{wxTopLevelWindow::HandleSettingChange
}\label{wxtoplevelwindowhandlesettingchange
}
108 \func{virtual bool
}{HandleSettingChange
}{\param{WXWPARAM
}{ wParam
},
\param{WXLPARAM
}{ lParam
}}
110 Unique to the wxWinCE port. Responds to showing/hiding SIP (soft input panel) area and resize
111 window accordingly. Override this if you want to avoid resizing or do additional
115 \membersection{wxTopLevelWindow::IsActive
}\label{wxtoplevelwindowisactive
}
117 \constfunc{bool
}{IsActive
}{\void}
119 Returns
\true if this window is currently active, i.e. if the user is currently
123 \membersection{wxTopLevelWindow::IsAlwaysMaximized
}\label{wxtoplevelwindowisalwaysmaximized
}
125 \constfunc{virtual bool
}{IsAlwaysMaximized
}{\void}
127 Returns
\true if this window is expected to be always maximized, either due to platform policy
128 or due to local policy regarding particular class.
131 \membersection{wxTopLevelWindow::Iconize
}\label{wxtoplevelwindowiconize
}
133 \func{void
}{Iconize
}{\param{bool
}{ iconize
}}
135 Iconizes or restores the window.
137 \wxheading{Parameters
}
139 \docparam{iconize
}{If
\true, iconizes the window; if
\false, shows and restores it.
}
143 \helpref{wxTopLevelWindow::IsIconized
}{wxtoplevelwindowisiconized
},
\helpref{wxTopLevelWindow::Maximize
}{wxtoplevelwindowmaximize
}.
146 \membersection{wxTopLevelWindow::IsFullScreen
}\label{wxtoplevelwindowisfullscreen
}
148 \func{bool
}{IsFullScreen
}{\void}
150 Returns
\true if the window is in fullscreen mode.
154 \helpref{wxTopLevelWindow::ShowFullScreen
}{wxtoplevelwindowshowfullscreen
}
157 \membersection{wxTopLevelWindow::IsIconized
}\label{wxtoplevelwindowisiconized
}
159 \constfunc{bool
}{IsIconized
}{\void}
161 Returns
\true if the window is iconized.
164 \membersection{wxTopLevelWindow::IsMaximized
}\label{wxtoplevelwindowismaximized
}
166 \constfunc{bool
}{IsMaximized
}{\void}
168 Returns
\true if the window is maximized.
171 \membersection{wxTopLevelWindow::IsUsingNativeDecorations
}\label{wxtoplevelwindowisusingnativedecorations
}
173 \constfunc{bool
}{IsUsingNativeDecorations
}{\void}
175 \bftt{This method is specific to wxUniversal port
}
177 Returns
\true if this window is using native decorations,
\false if we draw
182 \helpref{UseNativeDecorations
}{wxtoplevelwindowusenativedecorations
},\\
183 \helpref{UseNativeDecorationsByDefault
}{wxtoplevelwindowusenativedecorationsbydefault
}
186 \membersection{wxTopLevelWindow::Maximize
}\label{wxtoplevelwindowmaximize
}
188 \func{void
}{Maximize
}{\param{bool
}{maximize
}}
190 Maximizes or restores the window.
192 \wxheading{Parameters
}
194 \docparam{maximize
}{If
\true, maximizes the window, otherwise it restores it.
}
198 \helpref{wxTopLevelWindow::Iconize
}{wxtoplevelwindowiconize
}
201 \membersection{wxTopLevelWindow::RequestUserAttention
}\label{wxtoplevelwindowrequestuserattention
}
203 \func{void
}{RequestUserAttention
}{\param{int
}{flags = wxUSER
\_ATTENTION\_INFO}}
205 Use a system-dependent way to attract users attention to the window when it is
208 \arg{flags
} may have the value of either
\texttt{wxUSER
\_ATTENTION\_INFO}
209 (default) or
\texttt{wxUSER
\_ATTENTION\_ERROR} which results in a more drastic
210 action. When in doubt, use the default value.
212 Note that this function should normally be only used when the application is
213 not already in foreground.
215 This function is currently implemented for Win32 where it flashes the
216 window icon in the taskbar, and for wxGTK with task bars supporting it.
219 \membersection{wxTopLevelWindow::SetDefaultItem
}\label{wxtoplevelwindowsetdefaultitem
}
221 \func{void
}{SetDefaultItem
}{\param{wxWindow
}{*win
}}
223 Changes the default item for the panel, usually
\arg{win
} is a button.
227 \helpref{GetDefaultItem
}{wxtoplevelwindowgetdefaultitem
}
230 \membersection{wxTopLevelWindow::SetIcon
}\label{wxtoplevelwindowseticon
}
232 \func{void
}{SetIcon
}{\param{const wxIcon\&
}{icon
}}
234 Sets the icon for this window.
236 \wxheading{Parameters
}
238 \docparam{icon
}{The icon to associate with this window.
}
242 The window takes a `copy' of
{\it icon
}, but since it uses reference
243 counting, the copy is very quick. It is safe to delete
{\it icon
} after
244 calling this function.
246 See also
\helpref{wxIcon
}{wxicon
}.
249 \membersection{wxTopLevelWindow::SetIcons
}\label{wxtoplevelwindowseticons
}
251 \func{void
}{SetIcons
}{\param{const wxIconBundle\&
}{icons
}}
253 Sets several icons of different sizes for this window: this allows to use
254 different icons for different situations (e.g. task switching bar, taskbar,
255 window title bar) instead of scaling, with possibly bad looking results, the
256 only icon set by
\helpref{SetIcon
}{wxtoplevelwindowseticon
}.
258 \wxheading{Parameters
}
260 \docparam{icons
}{The icons to associate with this window.
}
264 \helpref{wxIconBundle
}{wxiconbundle
}.
267 \membersection{wxTopLevelWindow::SetLeftMenu
}\label{wxtoplevelwindowsetleftmenu
}
269 \func{void
}{SetLeftMenu
}{\param{int
}{ id = wxID
\_ANY},
\param{const wxString\&
}{ label = wxEmptyString
},
\param{wxMenu *
}{ subMenu = NULL
}}
271 Sets action or menu activated by pressing left hardware button on the smart phones.
272 Unavailable on full keyboard machines.
274 \wxheading{Parameters
}
276 \docparam{id
}{Identifier for this button.
}
278 \docparam{label
}{Text to be displayed on the screen area dedicated to this hardware button.
}
280 \docparam{subMenu
}{The menu to be opened after pressing this hardware button.
}
284 \helpref{wxTopLevelWindow::SetRightMenu
}{wxtoplevelwindowsetrightmenu
}.
287 \membersection{wxTopLevelWindow::SetMaxSize
}\label{wxtoplevelwindowsetmaxsize
}
289 \func{void
}{SetMaxSize
}{\param{const wxSize\&
}{size
}}
291 A simpler interface for setting the size hints than
292 \helpref{SetSizeHints
}{wxtoplevelwindowsetsizehints
}.
294 \membersection{wxTopLevelWindow::SetMinSize
}\label{wxtoplevelwindowsetminsize
}
296 \func{void
}{SetMinSize
}{\param{const wxSize\&
}{size
}}
298 A simpler interface for setting the size hints than
299 \helpref{SetSizeHints
}{wxtoplevelwindowsetsizehints
}.
301 \membersection{wxTopLevelWindow::SetSizeHints
}\label{wxtoplevelwindowsetsizehints
}
303 \func{virtual void
}{SetSizeHints
}{\param{int
}{ minW
},
\param{int
}{ minH
},
\param{int
}{ maxW=-
1},
\param{int
}{ maxH=-
1},
304 \param{int
}{ incW=-
1},
\param{int
}{ incH=-
1}}
306 \func{void
}{SetSizeHints
}{\param{const wxSize\&
}{ minSize
},
307 \param{const wxSize\&
}{ maxSize=wxDefaultSize
},
\param{const wxSize\&
}{ incSize=wxDefaultSize
}}
309 Allows specification of minimum and maximum window sizes, and window size increments.
310 If a pair of values is not set (or set to -
1), the default values will be used.
312 \docparam{incW
}{Specifies the increment for sizing the width (GTK/Motif/Xt only).
}
314 \docparam{incH
}{Specifies the increment for sizing the height (GTK/Motif/Xt only).
}
316 \docparam{incSize
}{Increment size (GTK/Motif/Xt only).
}
320 If this function is called, the user will not be able to size the window outside
321 the given bounds. The resizing increments are only significant under GTK, Motif or Xt.
324 \membersection{wxTopLevelWindow::SetRightMenu
}\label{wxtoplevelwindowsetrightmenu
}
326 \func{void
}{SetRightMenu
}{\param{int
}{ id = wxID
\_ANY},
\param{const wxString\&
}{ label = wxEmptyString
},
\param{wxMenu *
}{ subMenu = NULL
}}
328 Sets action or menu activated by pressing right hardware button on the smart phones.
329 Unavailable on full keyboard machines.
331 \wxheading{Parameters
}
333 \docparam{id
}{Identifier for this button.
}
335 \docparam{label
}{Text to be displayed on the screen area dedicated to this hardware button.
}
337 \docparam{subMenu
}{The menu to be opened after pressing this hardware button.
}
341 \helpref{wxTopLevelWindow::SetLeftMenu
}{wxtoplevelwindowsetleftmenu
}.
344 \membersection{wxTopLevelWindow::SetShape
}\label{wxtoplevelwindowsetshape
}
346 \func{bool
}{SetShape
}{\param{const wxRegion\&
}{ region
}}
348 If the platform supports it, sets the shape of the window to that
349 depicted by
{\it region
}. The system will not display or
350 respond to any mouse event for the pixels that lie outside of the
351 region. To reset the window to the normal rectangular shape simply
352 call
{\it SetShape
} again with an empty region. Returns true if the
353 operation is successful.
356 \membersection{wxTopLevelWindow::SetTitle
}\label{wxtoplevelwindowsettitle
}
358 \func{virtual void
}{SetTitle
}{\param{const wxString\&
}{ title
}}
360 Sets the window title.
362 \wxheading{Parameters
}
364 \docparam{title
}{The window title.
}
368 \helpref{wxTopLevelWindow::GetTitle
}{wxtoplevelwindowgettitle
}
371 \membersection{wxTopLevelWindow::SetTransparent
}\label{wxtoplevelwindowsettransparent
}
373 \func{virtual bool
}{SetTransparent
}{\param{int
}{ alpha
}}
375 If the platform supports it will set the window to be translucent
377 \wxheading{Parameters
}
379 \docparam{alpha
}{Determines how opaque or transparent the window will
380 be, if the platform supports the opreration. A value of
0 sets the
381 window to be fully transparent, and a value of
255 sets the window
384 Returns
\true if the transparency was successfully changed.
388 \membersection{wxTopLevelWindow::ShouldPreventAppExit
}\label{wxtoplevelwindowshouldpreventappexit
}
390 \constfunc{virtual bool
}{ShouldPreventAppExit
}{\void}
392 This virtual function is not meant to be called directly but can be overridden
393 to return
\false (it returns
\true by default) to allow the application to
394 close even if this, presumably not very important, window is still opened.
395 By default, the application stays alive as long as there are any open top level
399 \membersection{wxTopLevelWindow::ShowFullScreen
}\label{wxtoplevelwindowshowfullscreen
}
401 \func{bool
}{ShowFullScreen
}{\param{bool
}{ show
},
\param{long
}{ style = wxFULLSCREEN
\_ALL}}
403 Depending on the value of
{\it show
} parameter the window is either shown full
404 screen or restored to its normal state.
{\it style
} is a bit list containing
405 some or all of the following values, which indicate what elements of the window
406 to hide in full-screen mode:
408 \begin{itemize
}\itemsep=
0pt
409 \item wxFULLSCREEN
\_NOMENUBAR
410 \item wxFULLSCREEN
\_NOTOOLBAR
411 \item wxFULLSCREEN
\_NOSTATUSBAR
412 \item wxFULLSCREEN
\_NOBORDER
413 \item wxFULLSCREEN
\_NOCAPTION
414 \item wxFULLSCREEN
\_ALL (all of the above)
417 This function has not been tested with MDI frames.
419 Note that showing a window full screen also actually
420 \helpref{Show()s
}{wxwindowshow
} if it hadn't been shown yet.
424 \helpref{wxTopLevelWindow::IsFullScreen
}{wxtoplevelwindowisfullscreen
}
427 \membersection{wxTopLevelWindow::UseNativeDecorations
}\label{wxtoplevelwindowusenativedecorations
}
429 \func{void
}{UseNativeDecorations
}{\param{bool
}{native =
\true}}
431 \bftt{This method is specific to wxUniversal port
}
433 Use native or custom-drawn decorations for this window only. Notice that to
434 have any effect this method must be called before really creating the window,
435 i.e. two step creation must be used:
437 MyFrame *frame = new MyFrame; // use default ctor
438 frame->UseNativeDecorations(false); // change from default "true"
439 frame->Create(parent, title, ...); // really create the frame
444 \helpref{UseNativeDecorationsByDefault
}{wxtoplevelwindowusenativedecorationsbydefault
},\\
445 \helpref{IsUsingNativeDecorations
}{wxtoplevelwindowisusingnativedecorations
}
448 \membersection{wxTopLevelWindow::UseNativeDecorationsByDefault
}\label{wxtoplevelwindowusenativedecorationsbydefault
}
450 \func{void
}{UseNativeDecorationsByDefault
}{\param{bool
}{native =
\true}}
452 \bftt{This method is specific to wxUniversal port
}
454 Top level windows in wxUniversal port can use either system-provided window
455 decorations (i.e. title bar and various icons, buttons and menus in it) or draw
456 the decorations themselves. By default the system decorations are used if they
457 are available, but this method can be called with
\arg{native
} set to
\false to
458 change this for all windows created after this point.
460 Also note that if
\texttt{WXDECOR
} environment variable is set, then custom
461 decorations are used by default and so it may make sense to call this method
462 with default argument if the application can't use custom decorations at all
467 \helpref{UseNativeDecorations
}{wxtoplevelwindowusenativedecorations
}