]>
git.saurik.com Git - wxWidgets.git/blob - interface/toplevel.h
d089b1e1abb6b8e0a540e2d7b520dd395968a917
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: documentation for wxTopLevelWindow class
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
10 @class wxTopLevelWindow
13 wxTopLevelWindow is a common base class for wxDialog and
14 wxFrame. It is an abstract base class meaning that you never
15 work with objects of this class directly, but all of its methods are also
16 applicable for the two classes above.
22 wxTopLevelWindow::SetTransparent
24 class wxTopLevelWindow
: public wxWindow
28 Returns @true if the platform supports making the window translucent.
32 virtual bool CanSetTransparent();
35 A synonym for CentreOnScreen().
37 void CenterOnScreen(int direction
);
40 Centres the window on screen.
43 Specifies the direction for the centering. May be wxHORIZONTAL, wxVERTICAL
46 @see wxWindow::CentreOnParent
48 void CentreOnScreen(int direction
= wxBOTH
);
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 bool EnableCloseButton(bool enable
= true);
62 Returns a pointer to the button which is the default for this window, or @c
64 The default button is the one activated by pressing the Enter key.
66 wxWindow
* GetDefaultItem() const;
69 Returns the standard icon of the window. The icon will be invalid if it hadn't
70 been previously set by SetIcon().
74 const wxIcon
GetIcon() const;
77 Returns all icons associated with the window, there will be none of them if
79 SetIcons() had been called before.
80 Use GetIcon() to get the main icon of the
85 const wxIconBundle
GetIcons() const;
88 Gets a string containing the window title.
92 wxString
GetTitle() const;
95 Unique to the wxWinCE port. Responds to showing/hiding SIP (soft input panel)
97 window accordingly. Override this if you want to avoid resizing or do additional
100 virtual bool HandleSettingChange(WXWPARAM wParam
,
104 Iconizes or restores the window.
107 If @true, iconizes the window; if @false, shows and restores it.
109 @see IsIconized(), Maximize().
111 void Iconize(bool iconize
);
114 Returns @true if this window is currently active, i.e. if the user is
118 bool IsActive() const;
121 Returns @true if this window is expected to be always maximized, either due
123 or due to local policy regarding particular class.
125 virtual bool IsAlwaysMaximized() const;
128 Returns @true if the window is in fullscreen mode.
130 @see ShowFullScreen()
135 Returns @true if the window is iconized.
137 bool IsIconized() const;
140 Returns @true if the window is maximized.
142 bool IsMaximized() const;
145 @b @c This method is specific to wxUniversal port
146 Returns @true if this window is using native decorations, @false if we draw
149 @see UseNativeDecorations(),
150 UseNativeDecorationsByDefault()
152 bool IsUsingNativeDecorations() const;
155 Maximizes or restores the window.
158 If @true, maximizes the window, otherwise it restores it.
162 void Maximize(bool maximize
);
165 Use a system-dependent way to attract users attention to the window when it is
167 @a flags may have the value of either @c wxUSER_ATTENTION_INFO
168 (default) or @c wxUSER_ATTENTION_ERROR which results in a more drastic
169 action. When in doubt, use the default value.
170 Note that this function should normally be only used when the application is
171 not already in foreground.
172 This function is currently implemented for Win32 where it flashes the
173 window icon in the taskbar, and for wxGTK with task bars supporting it.
175 void RequestUserAttention(int flags
= wxUSER_ATTENTION_INFO
);
178 Changes the default item for the panel, usually @a win is a button.
180 @see GetDefaultItem()
182 void SetDefaultItem(wxWindow win
);
185 Sets the icon for this window.
188 The icon to associate with this window.
190 @remarks The window takes a 'copy' of icon, but since it uses reference
191 counting, the copy is very quick. It is safe to delete
192 icon after calling this function.
194 void SetIcon(const wxIcon
& icon
);
197 Sets several icons of different sizes for this window: this allows to use
198 different icons for different situations (e.g. task switching bar, taskbar,
199 window title bar) instead of scaling, with possibly bad looking results, the
200 only icon set by SetIcon().
203 The icons to associate with this window.
207 void SetIcons(const wxIconBundle
& icons
);
210 Sets action or menu activated by pressing left hardware button on the smart
212 Unavailable on full keyboard machines.
215 Identifier for this button.
217 Text to be displayed on the screen area dedicated to this hardware button.
219 The menu to be opened after pressing this hardware button.
223 void SetLeftMenu(int id
= wxID_ANY
,
224 const wxString
& label
= wxEmptyString
,
225 wxMenu
* subMenu
= NULL
);
228 A simpler interface for setting the size hints than
231 void SetMaxSize(const wxSize
& size
);
234 A simpler interface for setting the size hints than
237 void SetMinSize(const wxSize
& size
);
240 Sets action or menu activated by pressing right hardware button on the smart
242 Unavailable on full keyboard machines.
245 Identifier for this button.
247 Text to be displayed on the screen area dedicated to this hardware button.
249 The menu to be opened after pressing this hardware button.
253 void SetRightMenu(int id
= wxID_ANY
,
254 const wxString
& label
= wxEmptyString
,
255 wxMenu
* subMenu
= NULL
);
258 If the platform supports it, sets the shape of the window to that
259 depicted by @e region. The system will not display or
260 respond to any mouse event for the pixels that lie outside of the
261 region. To reset the window to the normal rectangular shape simply
262 call @e SetShape again with an empty region. Returns @true if the
263 operation is successful.
265 bool SetShape(const wxRegion
& region
);
269 Allows specification of minimum and maximum window sizes, and window size
271 If a pair of values is not set (or set to -1), no constraints will be used.
274 Specifies the increment for sizing the width (GTK/Motif/Xt only).
276 Specifies the increment for sizing the height (GTK/Motif/Xt only).
278 Increment size (only taken into account under X11-based
279 ports such as wxGTK/wxMotif/wxX11).
281 @remarks Notice that this function not only prevents the user from
282 resizing the window outside the given bounds but it
283 also prevents the program itself from doing it using
286 virtual void SetSizeHints(int minW
, int minH
, int maxW
= -1,
290 void SetSizeHints(const wxSize
& minSize
,
291 const wxSize
& maxSize
= wxDefaultSize
,
292 const wxSize
& incSize
= wxDefaultSize
);
296 Sets the window title.
303 virtual void SetTitle(const wxString
& title
);
306 If the platform supports it will set the window to be translucent
309 Determines how opaque or transparent the window will
310 be, if the platform supports the opreration. A value of 0 sets the
311 window to be fully transparent, and a value of 255 sets the window
314 virtual bool SetTransparent(int alpha
);
317 This virtual function is not meant to be called directly but can be overridden
318 to return @false (it returns @true by default) to allow the application to
319 close even if this, presumably not very important, window is still opened.
320 By default, the application stays alive as long as there are any open top level
323 virtual bool ShouldPreventAppExit() const;
326 Depending on the value of @a show parameter the window is either shown full
327 screen or restored to its normal state. @a style is a bit list containing
328 some or all of the following values, which indicate what elements of the window
329 to hide in full-screen mode:
330 wxFULLSCREEN_NOMENUBAR
331 wxFULLSCREEN_NOTOOLBAR
332 wxFULLSCREEN_NOSTATUSBAR
333 wxFULLSCREEN_NOBORDER
334 wxFULLSCREEN_NOCAPTION
335 wxFULLSCREEN_ALL (all of the above)
336 This function has not been tested with MDI frames.
337 Note that showing a window full screen also actually
338 @ref wxWindow::show Show()s if it hadn't been shown yet.
342 bool ShowFullScreen(bool show
, long style
= wxFULLSCREEN_ALL
);
345 @b @c This method is specific to wxUniversal port
346 Use native or custom-drawn decorations for this window only. Notice that to
347 have any effect this method must be called before really creating the window,
348 i.e. two step creation must be used:
350 @see UseNativeDecorationsByDefault(),
351 IsUsingNativeDecorations()
353 void UseNativeDecorations(bool native
= true);
356 @b @c This method is specific to wxUniversal port
357 Top level windows in wxUniversal port can use either system-provided window
358 decorations (i.e. title bar and various icons, buttons and menus in it) or draw
359 the decorations themselves. By default the system decorations are used if they
360 are available, but this method can be called with @a native set to @false to
361 change this for all windows created after this point.
362 Also note that if @c WXDECOR environment variable is set, then custom
363 decorations are used by default and so it may make sense to call this method
364 with default argument if the application can't use custom decorations at all
367 void UseNativeDecorationsByDefault(bool native
= true);