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{wxWindow::CenterOnScreen
}\label{wxtoplevelwindowcenteronscreen
}
49 \func{void
}{CenterOnScreen
}{\param{int
}{ direction
}}
51 A synonym for
\helpref{CentreOnScreen
}{wxtoplevelwindowcentreonscreen
}.
54 \membersection{wxTopLevelWindow::CentreOnScreen
}\label{wxtoplevelwindowcentreonscreen
}
56 \func{void
}{CentreOnScreen
}{\param{int
}{ direction = wxBOTH
}}
58 Centres the window on screen.
60 \wxheading{Parameters
}
62 \docparam{direction
}{Specifies the direction for the centering. May be
{\tt wxHORIZONTAL
},
{\tt wxVERTICAL
}\rtfsp
67 \helpref{wxWindow::CentreOnParent
}{wxwindowcenteronparent
}
70 \membersection{wxTopLevelWindow::EnableCloseButton
}\label{wxtoplevelenableclosebutton
}
72 \func{bool
}{EnableCloseButton
}{\param{bool
}{ enable = true
}}
74 Enables or disables the Close button (most often in the right
75 upper corner of a dialog) and the Close entry of the system
76 menu (most often in the left upper corner of the dialog).
77 Currently only implemented for wxMSW and wxGTK. Returns
78 true if operation was successful. This may be wrong on
79 X11 (including GTK+) where the window manager may not support
80 this operation and there is no way to find out.
82 \membersection{wxTopLevelWindow::GetDefaultItem
}\label{wxtoplevelwindowgetdefaultitem
}
84 \constfunc{wxWindow *
}{GetDefaultItem
}{\void}
86 Returns a pointer to the button which is the default for this window, or
\NULL.
87 The default button is the one activated by pressing the Enter key.
90 \membersection{wxTopLevelWindow::GetIcon
}\label{wxtoplevelwindowgeticon
}
92 \constfunc{const wxIcon\&
}{GetIcon
}{\void}
94 Returns the standard icon of the window. The icon will be invalid if it hadn't
95 been previously set by
\helpref{SetIcon
}{wxtoplevelwindowseticon
}.
99 \helpref{GetIcons
}{wxtoplevelwindowgeticons
}
102 \membersection{wxTopLevelWindow::GetIcons
}\label{wxtoplevelwindowgeticons
}
104 \constfunc{const wxIconBundle\&
}{GetIcons
}{\void}
106 Returns all icons associated with the window, there will be none of them if
107 neither
\helpref{SetIcon
}{wxtoplevelwindowseticon
} nor
108 \helpref{SetIcons
}{wxtoplevelwindowseticons
} had been called before.
110 Use
\helpref{GetIcon
}{wxtoplevelwindowgeticon
} to get the main icon of the
115 \helpref{wxIconBundle
}{wxiconbundle
}
118 \membersection{wxTopLevelWindow::GetTitle
}\label{wxtoplevelwindowgettitle
}
120 \constfunc{wxString
}{GetTitle
}{\void}
122 Gets a string containing the window title.
126 \helpref{wxTopLevelWindow::SetTitle
}{wxtoplevelwindowsettitle
}
129 \membersection{wxTopLevelWindow::HandleSettingChange
}\label{wxtoplevelwindowhandlesettingchange
}
131 \func{virtual bool
}{HandleSettingChange
}{\param{WXWPARAM
}{ wParam
},
\param{WXLPARAM
}{ lParam
}}
133 Unique to the wxWinCE port. Responds to showing/hiding SIP (soft input panel) area and resize
134 window accordingly. Override this if you want to avoid resizing or do additional
138 \membersection{wxTopLevelWindow::IsActive
}\label{wxtoplevelwindowisactive
}
140 \constfunc{bool
}{IsActive
}{\void}
142 Returns
\true if this window is currently active, i.e. if the user is currently
146 \membersection{wxTopLevelWindow::IsAlwaysMaximized
}\label{wxtoplevelwindowisalwaysmaximized
}
148 \constfunc{virtual bool
}{IsAlwaysMaximized
}{\void}
150 Returns
\true if this window is expected to be always maximized, either due to platform policy
151 or due to local policy regarding particular class.
154 \membersection{wxTopLevelWindow::Iconize
}\label{wxtoplevelwindowiconize
}
156 \func{void
}{Iconize
}{\param{bool
}{ iconize
}}
158 Iconizes or restores the window.
160 \wxheading{Parameters
}
162 \docparam{iconize
}{If
\true, iconizes the window; if
\false, shows and restores it.
}
166 \helpref{wxTopLevelWindow::IsIconized
}{wxtoplevelwindowisiconized
},
\helpref{wxTopLevelWindow::Maximize
}{wxtoplevelwindowmaximize
}.
169 \membersection{wxTopLevelWindow::IsFullScreen
}\label{wxtoplevelwindowisfullscreen
}
171 \func{bool
}{IsFullScreen
}{\void}
173 Returns
\true if the window is in fullscreen mode.
177 \helpref{wxTopLevelWindow::ShowFullScreen
}{wxtoplevelwindowshowfullscreen
}
180 \membersection{wxTopLevelWindow::IsIconized
}\label{wxtoplevelwindowisiconized
}
182 \constfunc{bool
}{IsIconized
}{\void}
184 Returns
\true if the window is iconized.
187 \membersection{wxTopLevelWindow::IsMaximized
}\label{wxtoplevelwindowismaximized
}
189 \constfunc{bool
}{IsMaximized
}{\void}
191 Returns
\true if the window is maximized.
194 \membersection{wxTopLevelWindow::IsUsingNativeDecorations
}\label{wxtoplevelwindowisusingnativedecorations
}
196 \constfunc{bool
}{IsUsingNativeDecorations
}{\void}
198 \bftt{This method is specific to wxUniversal port
}
200 Returns
\true if this window is using native decorations,
\false if we draw
205 \helpref{UseNativeDecorations
}{wxtoplevelwindowusenativedecorations
},\\
206 \helpref{UseNativeDecorationsByDefault
}{wxtoplevelwindowusenativedecorationsbydefault
}
209 \membersection{wxTopLevelWindow::Maximize
}\label{wxtoplevelwindowmaximize
}
211 \func{void
}{Maximize
}{\param{bool
}{maximize
}}
213 Maximizes or restores the window.
215 \wxheading{Parameters
}
217 \docparam{maximize
}{If
\true, maximizes the window, otherwise it restores it.
}
221 \helpref{wxTopLevelWindow::Iconize
}{wxtoplevelwindowiconize
}
224 \membersection{wxTopLevelWindow::RequestUserAttention
}\label{wxtoplevelwindowrequestuserattention
}
226 \func{void
}{RequestUserAttention
}{\param{int
}{flags = wxUSER
\_ATTENTION\_INFO}}
228 Use a system-dependent way to attract users attention to the window when it is
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
233 action. When in doubt, use the default value.
235 Note that this function should normally be only used when the application is
236 not already in foreground.
238 This function is currently implemented for Win32 where it flashes the
239 window icon in the taskbar, and for wxGTK with task bars supporting it.
242 \membersection{wxTopLevelWindow::SetDefaultItem
}\label{wxtoplevelwindowsetdefaultitem
}
244 \func{void
}{SetDefaultItem
}{\param{wxWindow
}{*win
}}
246 Changes the default item for the panel, usually
\arg{win
} is a button.
250 \helpref{GetDefaultItem
}{wxtoplevelwindowgetdefaultitem
}
253 \membersection{wxTopLevelWindow::SetIcon
}\label{wxtoplevelwindowseticon
}
255 \func{void
}{SetIcon
}{\param{const wxIcon\&
}{icon
}}
257 Sets the icon for this window.
259 \wxheading{Parameters
}
261 \docparam{icon
}{The icon to associate with this window.
}
265 The window takes a `copy' of
{\it icon
}, but since it uses reference
266 counting, the copy is very quick. It is safe to delete
{\it icon
} after
267 calling this function.
269 See also
\helpref{wxIcon
}{wxicon
}.
272 \membersection{wxTopLevelWindow::SetIcons
}\label{wxtoplevelwindowseticons
}
274 \func{void
}{SetIcons
}{\param{const wxIconBundle\&
}{icons
}}
276 Sets several icons of different sizes for this window: this allows to use
277 different icons for different situations (e.g. task switching bar, taskbar,
278 window title bar) instead of scaling, with possibly bad looking results, the
279 only icon set by
\helpref{SetIcon
}{wxtoplevelwindowseticon
}.
281 \wxheading{Parameters
}
283 \docparam{icons
}{The icons to associate with this window.
}
287 \helpref{wxIconBundle
}{wxiconbundle
}.
290 \membersection{wxTopLevelWindow::SetLeftMenu
}\label{wxtoplevelwindowsetleftmenu
}
292 \func{void
}{SetLeftMenu
}{\param{int
}{ id = wxID
\_ANY},
\param{const wxString\&
}{ label = wxEmptyString
},
\param{wxMenu *
}{ subMenu = NULL
}}
294 Sets action or menu activated by pressing left hardware button on the smart phones.
295 Unavailable on full keyboard machines.
297 \wxheading{Parameters
}
299 \docparam{id
}{Identifier for this button.
}
301 \docparam{label
}{Text to be displayed on the screen area dedicated to this hardware button.
}
303 \docparam{subMenu
}{The menu to be opened after pressing this hardware button.
}
307 \helpref{wxTopLevelWindow::SetRightMenu
}{wxtoplevelwindowsetrightmenu
}.
310 \membersection{wxTopLevelWindow::SetMaxSize
}\label{wxtoplevelwindowsetmaxsize
}
312 \func{void
}{SetMaxSize
}{\param{const wxSize\&
}{size
}}
314 A simpler interface for setting the size hints than
315 \helpref{SetSizeHints
}{wxtoplevelwindowsetsizehints
}.
317 \membersection{wxTopLevelWindow::SetMinSize
}\label{wxtoplevelwindowsetminsize
}
319 \func{void
}{SetMinSize
}{\param{const wxSize\&
}{size
}}
321 A simpler interface for setting the size hints than
322 \helpref{SetSizeHints
}{wxtoplevelwindowsetsizehints
}.
324 \membersection{wxTopLevelWindow::SetSizeHints
}\label{wxtoplevelwindowsetsizehints
}
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}}
329 \func{void
}{SetSizeHints
}{\param{const wxSize\&
}{ minSize
},
330 \param{const wxSize\&
}{ maxSize=wxDefaultSize
},
\param{const wxSize\&
}{ incSize=wxDefaultSize
}}
332 Allows specification of minimum and maximum window sizes, and window size increments.
333 If a pair of values is not set (or set to -
1), the default values will be used.
335 \docparam{incW
}{Specifies the increment for sizing the width (GTK/Motif/Xt only).
}
337 \docparam{incH
}{Specifies the increment for sizing the height (GTK/Motif/Xt only).
}
339 \docparam{incSize
}{Increment size (GTK/Motif/Xt only).
}
343 If this function is called, the user will not be able to size the window outside
344 the given bounds. The resizing increments are only significant under GTK, Motif or Xt.
347 \membersection{wxTopLevelWindow::SetRightMenu
}\label{wxtoplevelwindowsetrightmenu
}
349 \func{void
}{SetRightMenu
}{\param{int
}{ id = wxID
\_ANY},
\param{const wxString\&
}{ label = wxEmptyString
},
\param{wxMenu *
}{ subMenu = NULL
}}
351 Sets action or menu activated by pressing right hardware button on the smart phones.
352 Unavailable on full keyboard machines.
354 \wxheading{Parameters
}
356 \docparam{id
}{Identifier for this button.
}
358 \docparam{label
}{Text to be displayed on the screen area dedicated to this hardware button.
}
360 \docparam{subMenu
}{The menu to be opened after pressing this hardware button.
}
364 \helpref{wxTopLevelWindow::SetLeftMenu
}{wxtoplevelwindowsetleftmenu
}.
367 \membersection{wxTopLevelWindow::SetShape
}\label{wxtoplevelwindowsetshape
}
369 \func{bool
}{SetShape
}{\param{const wxRegion\&
}{ region
}}
371 If the platform supports it, sets the shape of the window to that
372 depicted by
{\it region
}. The system will not display or
373 respond to any mouse event for the pixels that lie outside of the
374 region. To reset the window to the normal rectangular shape simply
375 call
{\it SetShape
} again with an empty region. Returns true if the
376 operation is successful.
379 \membersection{wxTopLevelWindow::SetTitle
}\label{wxtoplevelwindowsettitle
}
381 \func{virtual void
}{SetTitle
}{\param{const wxString\&
}{ title
}}
383 Sets the window title.
385 \wxheading{Parameters
}
387 \docparam{title
}{The window title.
}
391 \helpref{wxTopLevelWindow::GetTitle
}{wxtoplevelwindowgettitle
}
394 \membersection{wxTopLevelWindow::SetTransparent
}\label{wxtoplevelwindowsettransparent
}
396 \func{virtual bool
}{SetTransparent
}{\param{int
}{ alpha
}}
398 If the platform supports it will set the window to be translucent
400 \wxheading{Parameters
}
402 \docparam{alpha
}{Determines how opaque or transparent the window will
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
407 Returns
\true if the transparency was successfully changed.
411 \membersection{wxTopLevelWindow::ShouldPreventAppExit
}\label{wxtoplevelwindowshouldpreventappexit
}
413 \constfunc{virtual bool
}{ShouldPreventAppExit
}{\void}
415 This virtual function is not meant to be called directly but can be overridden
416 to return
\false (it returns
\true by default) to allow the application to
417 close even if this, presumably not very important, window is still opened.
418 By default, the application stays alive as long as there are any open top level
422 \membersection{wxTopLevelWindow::ShowFullScreen
}\label{wxtoplevelwindowshowfullscreen
}
424 \func{bool
}{ShowFullScreen
}{\param{bool
}{ show
},
\param{long
}{ style = wxFULLSCREEN
\_ALL}}
426 Depending on the value of
{\it show
} parameter the window is either shown full
427 screen or restored to its normal state.
{\it style
} is a bit list containing
428 some or all of the following values, which indicate what elements of the window
429 to hide in full-screen mode:
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)
440 This function has not been tested with MDI frames.
442 Note that showing a window full screen also actually
443 \helpref{Show()s
}{wxwindowshow
} if it hadn't been shown yet.
447 \helpref{wxTopLevelWindow::IsFullScreen
}{wxtoplevelwindowisfullscreen
}
450 \membersection{wxTopLevelWindow::UseNativeDecorations
}\label{wxtoplevelwindowusenativedecorations
}
452 \func{void
}{UseNativeDecorations
}{\param{bool
}{native =
\true}}
454 \bftt{This method is specific to wxUniversal port
}
456 Use native or custom-drawn decorations for this window only. Notice that to
457 have any effect this method must be called before really creating the window,
458 i.e. two step creation must be used:
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
467 \helpref{UseNativeDecorationsByDefault
}{wxtoplevelwindowusenativedecorationsbydefault
},\\
468 \helpref{IsUsingNativeDecorations
}{wxtoplevelwindowisusingnativedecorations
}
471 \membersection{wxTopLevelWindow::UseNativeDecorationsByDefault
}\label{wxtoplevelwindowusenativedecorationsbydefault
}
473 \func{void
}{UseNativeDecorationsByDefault
}{\param{bool
}{native =
\true}}
475 \bftt{This method is specific to wxUniversal port
}
477 Top level windows in wxUniversal port can use either system-provided window
478 decorations (i.e. title bar and various icons, buttons and menus in it) or draw
479 the decorations themselves. By default the system decorations are used if they
480 are available, but this method can be called with
\arg{native
} set to
\false to
481 change this for all windows created after this point.
483 Also note that if
\texttt{WXDECOR
} environment variable is set, then custom
484 decorations are used by default and so it may make sense to call this method
485 with default argument if the application can't use custom decorations at all
490 \helpref{UseNativeDecorations
}{wxtoplevelwindowusenativedecorations
}