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
}
30 \latexignore{\rtfignore{\wxheading{Members
}}}
32 \membersection{wxTopLevelWindow::CanSetTransparent
}\label{wxtoplevelwindowcansettransparent
}
34 \func{virtual bool
}{CanSetTransparent
}{\void}
36 Returns
\true if the platform supports making the window translucent.
40 \helpref{wxTopLevelWindow::SetTransparent
}{wxtoplevelwindowsettransparent
}
43 \membersection{wxTopLevelWindow::GetDefaultItem
}\label{wxtoplevelwindowgetdefaultitem
}
45 \constfunc{wxWindow *
}{GetDefaultItem
}{\void}
47 Returns a pointer to the button which is the default for this window, or
\NULL.
48 The default button is the one activated by pressing the Enter key.
51 \membersection{wxTopLevelWindow::GetIcon
}\label{wxtoplevelwindowgeticon
}
53 \constfunc{const wxIcon\&
}{GetIcon
}{\void}
55 Returns the standard icon of the window. The icon will be invalid if it hadn't
56 been previously set by
\helpref{SetIcon
}{wxtoplevelwindowseticon
}.
60 \helpref{GetIcons
}{wxtoplevelwindowgeticons
}
63 \membersection{wxTopLevelWindow::GetIcons
}\label{wxtoplevelwindowgeticons
}
65 \constfunc{const wxIconBundle\&
}{GetIcons
}{\void}
67 Returns all icons associated with the window, there will be none of them if
68 neither
\helpref{SetIcon
}{wxtoplevelwindowseticon
} nor
69 \helpref{SetIcons
}{wxtoplevelwindowseticons
} had been called before.
71 Use
\helpref{GetIcon
}{wxtoplevelwindowgeticon
} to get the main icon of the
76 \helpref{wxIconBundle
}{wxiconbundle
}
79 \membersection{wxTopLevelWindow::GetTitle
}\label{wxtoplevelwindowgettitle
}
81 \constfunc{wxString
}{GetTitle
}{\void}
83 Gets a string containing the window title.
87 \helpref{wxTopLevelWindow::SetTitle
}{wxtoplevelwindowsettitle
}
90 \membersection{wxTopLevelWindow::HandleSettingChange
}\label{wxtoplevelwindowhandlesettingchange
}
92 \func{virtual bool
}{HandleSettingChange
}{\param{WXWPARAM
}{ wParam
},
\param{WXLPARAM
}{ lParam
}}
94 Unique to the wxWinCE port. Responds to showing/hiding SIP (soft input panel) area and resize
95 window accordingly. Override this if you want to avoid resizing or do additional
99 \membersection{wxTopLevelWindow::IsActive
}\label{wxtoplevelwindowisactive
}
101 \constfunc{bool
}{IsActive
}{\void}
103 Returns
\true if this window is currently active, i.e. if the user is currently
107 \membersection{wxTopLevelWindow::IsAlwaysMaximized
}\label{wxtoplevelwindowisalwaysmaximized
}
109 \constfunc{virtual bool
}{IsAlwaysMaximized
}{\void}
111 Returns
\true if this window is expected to be always maximized, either due to platform policy
112 or due to local policy regarding particular class.
115 \membersection{wxTopLevelWindow::Iconize
}\label{wxtoplevelwindowiconize
}
117 \func{void
}{Iconize
}{\param{bool
}{ iconize
}}
119 Iconizes or restores the window.
121 \wxheading{Parameters
}
123 \docparam{iconize
}{If
\true, iconizes the window; if
\false, shows and restores it.
}
127 \helpref{wxTopLevelWindow::IsIconized
}{wxtoplevelwindowisiconized
},
\helpref{wxTopLevelWindow::Maximize
}{wxtoplevelwindowmaximize
}.
130 \membersection{wxTopLevelWindow::IsFullScreen
}\label{wxtoplevelwindowisfullscreen
}
132 \func{bool
}{IsFullScreen
}{\void}
134 Returns
\true if the window is in fullscreen mode.
138 \helpref{wxTopLevelWindow::ShowFullScreen
}{wxtoplevelwindowshowfullscreen
}
141 \membersection{wxTopLevelWindow::IsIconized
}\label{wxtoplevelwindowisiconized
}
143 \constfunc{bool
}{IsIconized
}{\void}
145 Returns
\true if the window is iconized.
148 \membersection{wxTopLevelWindow::IsMaximized
}\label{wxtoplevelwindowismaximized
}
150 \constfunc{bool
}{IsMaximized
}{\void}
152 Returns
\true if the window is maximized.
155 \membersection{wxTopLevelWindow::IsUsingNativeDecorations
}{wxtoplevelwindowisusingnativedecorations
}
157 \constfunc{bool
}{IsUsingNativeDecorations
}{\void}
159 \bftt{This method is specific to wxUniversal port
}
161 Returns
\true if this window is using native decorations,
\false if we draw
166 \helpref{UseNativeDecorations
}{wxtoplevelwindowusenativedecorations
},\\
167 \helpref{UseNativeDecorationsByDefault
}{wxtoplevelwindowusenativedecorationsbydefault
}
170 \membersection{wxTopLevelWindow::Maximize
}\label{wxtoplevelwindowmaximize
}
172 \func{void
}{Maximize
}{\param{bool
}{maximize
}}
174 Maximizes or restores the window.
176 \wxheading{Parameters
}
178 \docparam{maximize
}{If
\true, maximizes the window, otherwise it restores it.
}
182 \helpref{wxTopLevelWindow::Iconize
}{wxtoplevelwindowiconize
}
185 \membersection{wxTopLevelWindow::RequestUserAttention
}\label{wxtoplevelwindowrequestuserattention
}
187 \func{void
}{RequestUserAttention
}{\param{int
}{flags = wxUSER
\_ATTENTION\_INFO}}
189 Use a system-dependent way to attract users attention to the window when it is
192 \arg{flags
} may have the value of either
\texttt{wxUSER
\_ATTENTION\_INFO}
193 (default) or
\texttt{wxUSER
\_ATTENTION\_ERROR} which results in a more drastic
194 action. When in doubt, use the default value.
196 Note that this function should normally be only used when the application is
197 not already in foreground.
199 This function is currently implemented for Win32 where it flashes the
200 window icon in the taskbar, and for wxGTK with task bars supporting it.
203 \membersection{wxTopLevelWindow::SetDefaultItem
}\label{wxtoplevelwindowsetdefaultitem
}
205 \func{void
}{SetDefaultItem
}{\param{wxWindow
}{*win
}}
207 Changes the default item for the panel, usually
\arg{win
} is a button.
211 \helpref{GetDefaultItem
}{wxtoplevelwindowgetdefaultitem
}
214 \membersection{wxTopLevelWindow::SetIcon
}\label{wxtoplevelwindowseticon
}
216 \func{void
}{SetIcon
}{\param{const wxIcon\&
}{icon
}}
218 Sets the icon for this window.
220 \wxheading{Parameters
}
222 \docparam{icon
}{The icon to associate with this window.
}
226 The window takes a `copy' of
{\it icon
}, but since it uses reference
227 counting, the copy is very quick. It is safe to delete
{\it icon
} after
228 calling this function.
230 See also
\helpref{wxIcon
}{wxicon
}.
233 \membersection{wxTopLevelWindow::SetIcons
}\label{wxtoplevelwindowseticons
}
235 \func{void
}{SetIcons
}{\param{const wxIconBundle\&
}{icons
}}
237 Sets several icons of different sizes for this window: this allows to use
238 different icons for different situations (e.g. task switching bar, taskbar,
239 window title bar) instead of scaling, with possibly bad looking results, the
240 only icon set by
\helpref{SetIcon
}{wxtoplevelwindowseticon
}.
242 \wxheading{Parameters
}
244 \docparam{icons
}{The icons to associate with this window.
}
248 \helpref{wxIconBundle
}{wxiconbundle
}.
251 \membersection{wxTopLevelWindow::SetLeftMenu
}\label{wxtoplevelwindowsetleftmenu
}
253 \func{void
}{SetLeftMenu
}{\param{int
}{ id = wxID
\_ANY},
\param{const wxString\&
}{ label = wxEmptyString
},
\param{wxMenu *
}{ subMenu = NULL
}}
255 Sets action or menu activated by pressing left hardware button on the smart phones.
256 Unavailable on full keyboard machines.
258 \wxheading{Parameters
}
260 \docparam{id
}{Identifier for this button.
}
262 \docparam{label
}{Text to be displayed on the screen area dedicated to this hardware button.
}
264 \docparam{subMenu
}{The menu to be opened after pressing this hardware button.
}
268 \helpref{wxTopLevelWindow::SetRightMenu
}{wxtoplevelwindowsetrightmenu
}.
271 \membersection{wxTopLevelWindow::SetRightMenu
}\label{wxtoplevelwindowsetrightmenu
}
273 \func{void
}{SetRightMenu
}{\param{int
}{ id = wxID
\_ANY},
\param{const wxString\&
}{ label = wxEmptyString
},
\param{wxMenu *
}{ subMenu = NULL
}}
275 Sets action or menu activated by pressing right hardware button on the smart phones.
276 Unavailable on full keyboard machines.
278 \wxheading{Parameters
}
280 \docparam{id
}{Identifier for this button.
}
282 \docparam{label
}{Text to be displayed on the screen area dedicated to this hardware button.
}
284 \docparam{subMenu
}{The menu to be opened after pressing this hardware button.
}
288 \helpref{wxTopLevelWindow::SetLeftMenu
}{wxtoplevelwindowsetleftmenu
}.
291 \membersection{wxTopLevelWindow::SetShape
}\label{wxtoplevelwindowsetshape
}
293 \func{bool
}{SetShape
}{\param{const wxRegion\&
}{ region
}}
295 If the platform supports it, sets the shape of the window to that
296 depicted by
{\it region
}. The system will not display or
297 respond to any mouse event for the pixels that lie outside of the
298 region. To reset the window to the normal rectangular shape simply
299 call
{\it SetShape
} again with an empty region. Returns true if the
300 operation is successful.
303 \membersection{wxTopLevelWindow::SetTitle
}\label{wxtoplevelwindowsettitle
}
305 \func{virtual void
}{SetTitle
}{\param{const wxString\&
}{ title
}}
307 Sets the window title.
309 \wxheading{Parameters
}
311 \docparam{title
}{The window title.
}
315 \helpref{wxTopLevelWindow::GetTitle
}{wxtoplevelwindowgettitle
}
318 \membersection{wxTopLevelWindow::SetTransparent
}\label{wxtoplevelwindowsettransparent
}
320 \func{virtual bool
}{SetTransparent
}{\param{int
}{ alpha
}}
322 If the platform supports it will set the window to be translucent
324 \wxheading{Parameters
}
326 \docparam{alpha
}{Determines how opaque or transparent the window will
327 be, if the platform supports the opreration. A value of
0 sets the
328 window to be fully transparent, and a value of
255 sets the window
331 Returns
\true if the transparency was successfully changed.
335 \membersection{wxTopLevelWindow::ShouldPreventAppExit
}\label{wxtoplevelwindowshouldpreventappexit
}
337 \constfunc{virtual bool
}{ShouldPreventAppExit
}{\void}
339 This virtual function is not meant to be called directly but can be overridden
340 to return
\false (it returns
\true by default) to allow the application to
341 close even if this, presumably not very important, window is still opened.
342 By default, the application stays alive as long as there are any open top level
346 \membersection{wxTopLevelWindow::ShowFullScreen
}\label{wxtoplevelwindowshowfullscreen
}
348 \func{bool
}{ShowFullScreen
}{\param{bool
}{ show
},
\param{long
}{ style = wxFULLSCREEN
\_ALL}}
350 Depending on the value of
{\it show
} parameter the window is either shown full
351 screen or restored to its normal state.
{\it style
} is a bit list containing
352 some or all of the following values, which indicate what elements of the window
353 to hide in full-screen mode:
355 \begin{itemize
}\itemsep=
0pt
356 \item wxFULLSCREEN
\_NOMENUBAR
357 \item wxFULLSCREEN
\_NOTOOLBAR
358 \item wxFULLSCREEN
\_NOSTATUSBAR
359 \item wxFULLSCREEN
\_NOBORDER
360 \item wxFULLSCREEN
\_NOCAPTION
361 \item wxFULLSCREEN
\_ALL (all of the above)
364 This function has not been tested with MDI frames.
366 Note that showing a window full screen also actually
367 \helpref{Show()s
}{wxwindowshow
} if it hadn't been shown yet.
371 \helpref{wxTopLevelWindow::IsFullScreen
}{wxtoplevelwindowisfullscreen
}
374 \membersection{wxTopLevelWindow::UseNativeDecorations
}\label{wxtoplevelwindowusenativedecorations
}
376 \func{void
}{UseNativeDecorations
}{\param{bool
}{native =
\true}}
378 \bftt{This method is specific to wxUniversal port
}
380 Use native or custom-drawn decorations for this window only. Notice that to
381 have any effect this method must be called before really creating the window,
382 i.e. two step creation must be used:
384 MyFrame *frame = new MyFrame; // use default ctor
385 frame->UseNativeDecorations(false); // change from default "true"
386 frame->Create(parent, title, ...); // really create the frame
391 \helpref{UseNativeDecorationsByDefault
}{wxtoplevelwindowusenativedecorationsbydefault
},\\
392 \helpref{IsUsingNativeDecorations
}{wxtoplevelwindowisusingnativedecorations
}
395 \membersection{wxTopLevelWindow::UseNativeDecorationsByDefault
}\label{wxtoplevelwindowusenativedecorationsbydefault
}
397 \func{void
}{UseNativeDecorationsByDefault
}{\param{bool
}{native =
\true}}
399 \bftt{This method is specific to wxUniversal port
}
401 Top level windows in wxUniversal port can use either system-provided window
402 decorations (i.e. title bar and various icons, buttons and menus in it) or draw
403 the decorations themselves. By default the system decorations are used if they
404 are available, but this method can be called with
\arg{native
} set to
\false to
405 change this for all windows created after this point.
407 Also note that if
\texttt{WXDECOR
} environment variable is set, then custom
408 decorations are used by default and so it may make sense to call this method
409 with default argument if the application can't use custom decorations at all
414 \helpref{UseNativeDecorations
}{wxtoplevelwindowusenativedecorations
}