]>
git.saurik.com Git - wxWidgets.git/blob - interface/toplevel.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxTopLevelWindow
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
10 Styles used with wxTopLevelWindow::RequestUserAttention().
14 wxUSER_ATTENTION_INFO
= 1, ///< Requests user attention,
15 wxUSER_ATTENTION_ERROR
= 2 ///< Results in a more drastic action.
19 Styles used with wxTopLevelWindow::ShowFullScreen().
23 wxFULLSCREEN_NOMENUBAR
= 0x0001, ///< Don't display the menu bar.
24 wxFULLSCREEN_NOTOOLBAR
= 0x0002, ///< Don't display toolbar bars.
25 wxFULLSCREEN_NOSTATUSBAR
= 0x0004, ///< Don't display the status bar.
26 wxFULLSCREEN_NOBORDER
= 0x0008, ///< Don't display any border.
27 wxFULLSCREEN_NOCAPTION
= 0x0010, ///< Don't display a caption.
30 Combination of all above, will display the least possible.
32 wxFULLSCREEN_ALL
= wxFULLSCREEN_NOMENUBAR
| wxFULLSCREEN_NOTOOLBAR
|
33 wxFULLSCREEN_NOSTATUSBAR
| wxFULLSCREEN_NOBORDER
|
34 wxFULLSCREEN_NOCAPTION
38 @class wxTopLevelWindow
41 wxTopLevelWindow is a common base class for wxDialog and wxFrame. It is an
42 abstract base class meaning that you never work with objects of this class
43 directly, but all of its methods are also applicable for the two classes
49 @see wxDialog, wxFrame
51 class wxTopLevelWindow
: public wxWindow
55 Returns @true if the platform supports making the window translucent.
59 virtual bool CanSetTransparent();
62 A synonym for CentreOnScreen().
64 void CenterOnScreen(int direction
);
67 Centres the window on screen.
70 Specifies the direction for the centering. May be @c wxHORIZONTAL,
71 @c wxVERTICAL or @c wxBOTH.
73 @see wxWindow::CentreOnParent()
75 void CentreOnScreen(int direction
= wxBOTH
);
78 Enables or disables the Close button (most often in the right upper
79 corner of a dialog) and the Close entry of the system menu (most often
80 in the left upper corner of the dialog).
82 Currently only implemented for wxMSW and wxGTK.
84 Returns @true if operation was successful. This may be wrong on X11
85 (including GTK+) where the window manager may not support this operation
86 and there is no way to find out.
88 bool EnableCloseButton(bool enable
= true);
91 Returns a pointer to the button which is the default for this window, or
92 @c @NULL. The default button is the one activated by pressing the Enter
95 wxWindow
* GetDefaultItem() const;
98 Returns the standard icon of the window. The icon will be invalid if it
99 hadn't been previously set by SetIcon().
103 const wxIcon
GetIcon() const;
106 Returns all icons associated with the window, there will be none of them
107 if neither SetIcon() nor SetIcons() had been called before. Use
108 GetIcon() to get the main icon of the window.
112 const wxIconBundle
GetIcons() const;
115 Gets a string containing the window title.
119 wxString
GetTitle() const;
122 Unique to the wxWinCE port. Responds to showing/hiding SIP (soft input
123 panel) area and resize window accordingly. Override this if you want to
124 avoid resizing or do additional operations.
126 virtual bool HandleSettingChange(WXWPARAM wParam
,
130 Iconizes or restores the window.
133 If @true, iconizes the window; if @false, shows and restores it.
135 @see IsIconized(), Maximize(), wxIconizeEvent.
137 void Iconize(bool iconize
);
140 Returns @true if this window is currently active, i.e. if the user is
141 currently working with it.
143 bool IsActive() const;
146 Returns @true if this window is expected to be always maximized, either
147 due to platform policy or due to local policy regarding particular
150 virtual bool IsAlwaysMaximized() const;
153 Returns @true if the window is in fullscreen mode.
155 @see ShowFullScreen()
160 Returns @true if the window is iconized.
162 bool IsIconized() const;
165 Returns @true if the window is maximized.
167 bool IsMaximized() const;
170 This method is specific to wxUniversal port.
172 Returns @true if this window is using native decorations, @false if we
175 @see UseNativeDecorations(),
176 UseNativeDecorationsByDefault()
178 bool IsUsingNativeDecorations() const;
181 Maximizes or restores the window.
184 If @true, maximizes the window, otherwise it restores it.
188 void Maximize(bool maximize
);
191 Use a system-dependent way to attract users attention to the window when
194 @a flags may have the value of either @c ::wxUSER_ATTENTION_INFO
195 (default) or @c ::wxUSER_ATTENTION_ERROR which results in a more drastic
196 action. When in doubt, use the default value.
199 @note This function should normally be only used when the application
200 is not already in foreground.
202 This function is currently implemented for Win32 where it flashes
203 the window icon in the taskbar, and for wxGTK with task bars
207 void RequestUserAttention(int flags
= wxUSER_ATTENTION_INFO
);
210 Changes the default item for the panel, usually @a win is a button.
212 @see GetDefaultItem()
214 void SetDefaultItem(wxWindow
* win
);
217 Sets the icon for this window.
220 The wxIcon to associate with this window.
222 @remarks The window takes a 'copy' of @a icon, but since it uses
223 reference counting, the copy is very quick. It is safe to
224 delete @a icon after calling this function.
228 void SetIcon(const wxIcon
& icon
);
231 Sets several icons of different sizes for this window: this allows to
232 use different icons for different situations (e.g. task switching bar,
233 taskbar, window title bar) instead of scaling, with possibly bad looking
234 results, the only icon set by SetIcon().
237 The icons to associate with this window.
241 void SetIcons(const wxIconBundle
& icons
);
244 Sets action or menu activated by pressing left hardware button on the
245 smart phones. Unavailable on full keyboard machines.
248 Identifier for this button.
250 Text to be displayed on the screen area dedicated to this hardware
253 The menu to be opened after pressing this hardware button.
257 void SetLeftMenu(int id
= wxID_ANY
,
258 const wxString
& label
= wxEmptyString
,
259 wxMenu
* subMenu
= NULL
);
262 A simpler interface for setting the size hints than SetSizeHints().
264 void SetMaxSize(const wxSize
& size
);
267 A simpler interface for setting the size hints than SetSizeHints().
269 void SetMinSize(const wxSize
& size
);
272 Sets action or menu activated by pressing right hardware button on the
273 smart phones. Unavailable on full keyboard machines.
276 Identifier for this button.
278 Text to be displayed on the screen area dedicated to this hardware
281 The menu to be opened after pressing this hardware button.
285 void SetRightMenu(int id
= wxID_ANY
,
286 const wxString
& label
= wxEmptyString
,
287 wxMenu
* subMenu
= NULL
);
290 If the platform supports it, sets the shape of the window to that
291 depicted by @a region. The system will not display or respond to any
292 mouse event for the pixels that lie outside of the region. To reset the
293 window to the normal rectangular shape simply call SetShape() again with
294 an empty wxRegion. Returns @true if the operation is successful.
296 bool SetShape(const wxRegion
& region
);
299 Allows specification of minimum and maximum window sizes, and window
300 size increments. If a pair of values is not set (or set to -1), no
301 constraints will be used.
304 Specifies the increment for sizing the width (GTK/Motif/Xt only).
306 Specifies the increment for sizing the height (GTK/Motif/Xt only).
308 @remarks Notice that this function not only prevents the user from
309 resizing the window outside the given bounds but it also
310 prevents the program itself from doing it using
314 virtual void SetSizeHints(int minW
, int minH
, int maxW
= -1,
320 Allows specification of minimum and maximum window sizes, and window
321 size increments. If a pair of values is not set (or set to -1), no
322 constraints will be used.
325 Increment size (only taken into account under X11-based ports such
326 as wxGTK/wxMotif/wxX11).
328 @remarks Notice that this function not only prevents the user from
329 resizing the window outside the given bounds but it also
330 prevents the program itself from doing it using
333 void SetSizeHints(const wxSize
& minSize
,
334 const wxSize
& maxSize
= wxDefaultSize
,
335 const wxSize
& incSize
= wxDefaultSize
);
338 Sets the window title.
345 virtual void SetTitle(const wxString
& title
);
348 If the platform supports it will set the window to be translucent.
351 Determines how opaque or transparent the window will be, if the
352 platform supports the opreration. A value of 0 sets the window to be
353 fully transparent, and a value of 255 sets the window to be fully
356 virtual bool SetTransparent(int alpha
);
359 This virtual function is not meant to be called directly but can be
360 overridden to return @false (it returns @true by default) to allow the
361 application to close even if this, presumably not very important, window
362 is still opened. By default, the application stays alive as long as
363 there are any open top level windows.
365 virtual bool ShouldPreventAppExit() const;
368 Depending on the value of @a show parameter the window is either shown
369 full screen or restored to its normal state. @a style is a bit list
370 containing some or all of the following values, which indicate what
371 elements of the window to hide in full-screen mode:
373 - @c ::wxFULLSCREEN_NOMENUBAR
374 - @c ::wxFULLSCREEN_NOTOOLBAR
375 - @c ::wxFULLSCREEN_NOSTATUSBAR
376 - @c ::wxFULLSCREEN_NOBORDER
377 - @c ::wxFULLSCREEN_NOCAPTION
378 - @c ::wxFULLSCREEN_ALL (all of the above)
380 This function has not been tested with MDI frames.
382 @note Showing a window full screen also actually @ref wxWindow::Show()
383 "Show()"s the window if it isn't shown.
387 bool ShowFullScreen(bool show
, long style
= wxFULLSCREEN_ALL
);
390 This method is specific to wxUniversal port.
392 Use native or custom-drawn decorations for this window only. Notice that
393 to have any effect this method must be called before really creating the
394 window, i.e. two step creation must be used:
397 MyFrame *frame = new MyFrame; // use default ctor
398 frame->UseNativeDecorations(false); // change from default "true"
399 frame->Create(parent, title, ...); // really create the frame
402 @see UseNativeDecorationsByDefault(),
403 IsUsingNativeDecorations()
405 void UseNativeDecorations(bool native
= true);
408 This method is specific to wxUniversal port.
410 Top level windows in wxUniversal port can use either system-provided
411 window decorations (i.e. title bar and various icons, buttons and menus
412 in it) or draw the decorations themselves. By default the system
413 decorations are used if they are available, but this method can be
414 called with @a native set to @false to change this for all windows
415 created after this point.
417 Also note that if @c WXDECOR environment variable is set, then custom
418 decorations are used by default and so it may make sense to call this
419 method with default argument if the application can't use custom
420 decorations at all for some reason.
422 @see UseNativeDecorations()
424 void UseNativeDecorationsByDefault(bool native
= true);