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::EnableCloseButton
}\label{wxtoplevelenableclosebutton
}
45 \func{bool
}{EnableCloseButton
}{\param{bool
}{ enable = true
}}
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.
52 \membersection{wxTopLevelWindow::GetDefaultItem
}\label{wxtoplevelwindowgetdefaultitem
}
54 \constfunc{wxWindow *
}{GetDefaultItem
}{\void}
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.
60 \membersection{wxTopLevelWindow::GetIcon
}\label{wxtoplevelwindowgeticon
}
62 \constfunc{const wxIcon\&
}{GetIcon
}{\void}
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
}.
69 \helpref{GetIcons
}{wxtoplevelwindowgeticons
}
72 \membersection{wxTopLevelWindow::GetIcons
}\label{wxtoplevelwindowgeticons
}
74 \constfunc{const wxIconBundle\&
}{GetIcons
}{\void}
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.
80 Use
\helpref{GetIcon
}{wxtoplevelwindowgeticon
} to get the main icon of the
85 \helpref{wxIconBundle
}{wxiconbundle
}
88 \membersection{wxTopLevelWindow::GetTitle
}\label{wxtoplevelwindowgettitle
}
90 \constfunc{wxString
}{GetTitle
}{\void}
92 Gets a string containing the window title.
96 \helpref{wxTopLevelWindow::SetTitle
}{wxtoplevelwindowsettitle
}
99 \membersection{wxTopLevelWindow::HandleSettingChange
}\label{wxtoplevelwindowhandlesettingchange
}
101 \func{virtual bool
}{HandleSettingChange
}{\param{WXWPARAM
}{ wParam
},
\param{WXLPARAM
}{ lParam
}}
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
108 \membersection{wxTopLevelWindow::IsActive
}\label{wxtoplevelwindowisactive
}
110 \constfunc{bool
}{IsActive
}{\void}
112 Returns
\true if this window is currently active, i.e. if the user is currently
116 \membersection{wxTopLevelWindow::IsAlwaysMaximized
}\label{wxtoplevelwindowisalwaysmaximized
}
118 \constfunc{virtual bool
}{IsAlwaysMaximized
}{\void}
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.
124 \membersection{wxTopLevelWindow::Iconize
}\label{wxtoplevelwindowiconize
}
126 \func{void
}{Iconize
}{\param{bool
}{ iconize
}}
128 Iconizes or restores the window.
130 \wxheading{Parameters
}
132 \docparam{iconize
}{If
\true, iconizes the window; if
\false, shows and restores it.
}
136 \helpref{wxTopLevelWindow::IsIconized
}{wxtoplevelwindowisiconized
},
\helpref{wxTopLevelWindow::Maximize
}{wxtoplevelwindowmaximize
}.
139 \membersection{wxTopLevelWindow::IsFullScreen
}\label{wxtoplevelwindowisfullscreen
}
141 \func{bool
}{IsFullScreen
}{\void}
143 Returns
\true if the window is in fullscreen mode.
147 \helpref{wxTopLevelWindow::ShowFullScreen
}{wxtoplevelwindowshowfullscreen
}
150 \membersection{wxTopLevelWindow::IsIconized
}\label{wxtoplevelwindowisiconized
}
152 \constfunc{bool
}{IsIconized
}{\void}
154 Returns
\true if the window is iconized.
157 \membersection{wxTopLevelWindow::IsMaximized
}\label{wxtoplevelwindowismaximized
}
159 \constfunc{bool
}{IsMaximized
}{\void}
161 Returns
\true if the window is maximized.
164 \membersection{wxTopLevelWindow::IsUsingNativeDecorations
}\label{wxtoplevelwindowisusingnativedecorations
}
166 \constfunc{bool
}{IsUsingNativeDecorations
}{\void}
168 \bftt{This method is specific to wxUniversal port
}
170 Returns
\true if this window is using native decorations,
\false if we draw
175 \helpref{UseNativeDecorations
}{wxtoplevelwindowusenativedecorations
},\\
176 \helpref{UseNativeDecorationsByDefault
}{wxtoplevelwindowusenativedecorationsbydefault
}
179 \membersection{wxTopLevelWindow::Maximize
}\label{wxtoplevelwindowmaximize
}
181 \func{void
}{Maximize
}{\param{bool
}{maximize
}}
183 Maximizes or restores the window.
185 \wxheading{Parameters
}
187 \docparam{maximize
}{If
\true, maximizes the window, otherwise it restores it.
}
191 \helpref{wxTopLevelWindow::Iconize
}{wxtoplevelwindowiconize
}
194 \membersection{wxTopLevelWindow::RequestUserAttention
}\label{wxtoplevelwindowrequestuserattention
}
196 \func{void
}{RequestUserAttention
}{\param{int
}{flags = wxUSER
\_ATTENTION\_INFO}}
198 Use a system-dependent way to attract users attention to the window when it is
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.
205 Note that this function should normally be only used when the application is
206 not already in foreground.
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.
212 \membersection{wxTopLevelWindow::SetDefaultItem
}\label{wxtoplevelwindowsetdefaultitem
}
214 \func{void
}{SetDefaultItem
}{\param{wxWindow
}{*win
}}
216 Changes the default item for the panel, usually
\arg{win
} is a button.
220 \helpref{GetDefaultItem
}{wxtoplevelwindowgetdefaultitem
}
223 \membersection{wxTopLevelWindow::SetIcon
}\label{wxtoplevelwindowseticon
}
225 \func{void
}{SetIcon
}{\param{const wxIcon\&
}{icon
}}
227 Sets the icon for this window.
229 \wxheading{Parameters
}
231 \docparam{icon
}{The icon to associate with this window.
}
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.
239 See also
\helpref{wxIcon
}{wxicon
}.
242 \membersection{wxTopLevelWindow::SetIcons
}\label{wxtoplevelwindowseticons
}
244 \func{void
}{SetIcons
}{\param{const wxIconBundle\&
}{icons
}}
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
}.
251 \wxheading{Parameters
}
253 \docparam{icons
}{The icons to associate with this window.
}
257 \helpref{wxIconBundle
}{wxiconbundle
}.
260 \membersection{wxTopLevelWindow::SetLeftMenu
}\label{wxtoplevelwindowsetleftmenu
}
262 \func{void
}{SetLeftMenu
}{\param{int
}{ id = wxID
\_ANY},
\param{const wxString\&
}{ label = wxEmptyString
},
\param{wxMenu *
}{ subMenu = NULL
}}
264 Sets action or menu activated by pressing left hardware button on the smart phones.
265 Unavailable on full keyboard machines.
267 \wxheading{Parameters
}
269 \docparam{id
}{Identifier for this button.
}
271 \docparam{label
}{Text to be displayed on the screen area dedicated to this hardware button.
}
273 \docparam{subMenu
}{The menu to be opened after pressing this hardware button.
}
277 \helpref{wxTopLevelWindow::SetRightMenu
}{wxtoplevelwindowsetrightmenu
}.
280 \membersection{wxTopLevelWindow::SetRightMenu
}\label{wxtoplevelwindowsetrightmenu
}
282 \func{void
}{SetRightMenu
}{\param{int
}{ id = wxID
\_ANY},
\param{const wxString\&
}{ label = wxEmptyString
},
\param{wxMenu *
}{ subMenu = NULL
}}
284 Sets action or menu activated by pressing right hardware button on the smart phones.
285 Unavailable on full keyboard machines.
287 \wxheading{Parameters
}
289 \docparam{id
}{Identifier for this button.
}
291 \docparam{label
}{Text to be displayed on the screen area dedicated to this hardware button.
}
293 \docparam{subMenu
}{The menu to be opened after pressing this hardware button.
}
297 \helpref{wxTopLevelWindow::SetLeftMenu
}{wxtoplevelwindowsetleftmenu
}.
300 \membersection{wxTopLevelWindow::SetShape
}\label{wxtoplevelwindowsetshape
}
302 \func{bool
}{SetShape
}{\param{const wxRegion\&
}{ region
}}
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.
312 \membersection{wxTopLevelWindow::SetTitle
}\label{wxtoplevelwindowsettitle
}
314 \func{virtual void
}{SetTitle
}{\param{const wxString\&
}{ title
}}
316 Sets the window title.
318 \wxheading{Parameters
}
320 \docparam{title
}{The window title.
}
324 \helpref{wxTopLevelWindow::GetTitle
}{wxtoplevelwindowgettitle
}
327 \membersection{wxTopLevelWindow::SetTransparent
}\label{wxtoplevelwindowsettransparent
}
329 \func{virtual bool
}{SetTransparent
}{\param{int
}{ alpha
}}
331 If the platform supports it will set the window to be translucent
333 \wxheading{Parameters
}
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
340 Returns
\true if the transparency was successfully changed.
344 \membersection{wxTopLevelWindow::ShouldPreventAppExit
}\label{wxtoplevelwindowshouldpreventappexit
}
346 \constfunc{virtual bool
}{ShouldPreventAppExit
}{\void}
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
355 \membersection{wxTopLevelWindow::ShowFullScreen
}\label{wxtoplevelwindowshowfullscreen
}
357 \func{bool
}{ShowFullScreen
}{\param{bool
}{ show
},
\param{long
}{ style = wxFULLSCREEN
\_ALL}}
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:
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)
373 This function has not been tested with MDI frames.
375 Note that showing a window full screen also actually
376 \helpref{Show()s
}{wxwindowshow
} if it hadn't been shown yet.
380 \helpref{wxTopLevelWindow::IsFullScreen
}{wxtoplevelwindowisfullscreen
}
383 \membersection{wxTopLevelWindow::UseNativeDecorations
}\label{wxtoplevelwindowusenativedecorations
}
385 \func{void
}{UseNativeDecorations
}{\param{bool
}{native =
\true}}
387 \bftt{This method is specific to wxUniversal port
}
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:
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
400 \helpref{UseNativeDecorationsByDefault
}{wxtoplevelwindowusenativedecorationsbydefault
},\\
401 \helpref{IsUsingNativeDecorations
}{wxtoplevelwindowisusingnativedecorations
}
404 \membersection{wxTopLevelWindow::UseNativeDecorationsByDefault
}\label{wxtoplevelwindowusenativedecorationsbydefault
}
406 \func{void
}{UseNativeDecorationsByDefault
}{\param{bool
}{native =
\true}}
408 \bftt{This method is specific to wxUniversal port
}
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.
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
423 \helpref{UseNativeDecorations
}{wxtoplevelwindowusenativedecorations
}