]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/window.h
fix VC9 compilation: FileNameInfo identifier conflicts with an enum name in the SDK...
[wxWidgets.git] / interface / wx / window.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: window.h
e54c96f1 3// Purpose: interface of wxWindow
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
6// Licence: wxWindows license
7/////////////////////////////////////////////////////////////////////////////
8
e25cd775
FM
9
10/**
11 Background styles. See wxWindow::SetBackgroundStyle().
12*/
13enum wxBackgroundStyle
14{
15 /// Use the default background, as determined by
16 /// the system or the current theme.
17 wxBG_STYLE_SYSTEM,
18
19 /// Use a solid colour for the background, this style is set automatically if you call
20 /// SetBackgroundColour() so you only need to set it explicitly if you had
21 /// changed the background style to something else before.
22 wxBG_STYLE_COLOUR,
23
24 /// Don't draw the background at all, it's supposed that it is drawn by
25 /// the user-defined erase background event handler.
26 /// This style should be used to avoid flicker when the background is entirely
27 /// custom-drawn.
28 wxBG_STYLE_CUSTOM,
29
30 /// The background is (partially) transparent,this style is automatically set if you call
31 /// SetTransparent() which is used to set the transparency level.
32 wxBG_STYLE_TRANSPARENT
33};
34
35
36/**
37 Valid values for wxWindow::ShowWithEffect() and wxWindow::HideWithEffect().
38*/
39enum wxShowEffect
40{
41 /// Roll window to the left
42 wxSHOW_EFFECT_ROLL_TO_LEFT,
43
44 /// Roll window to the right
45 wxSHOW_EFFECT_ROLL_TO_RIGHT,
46
47 /// Roll window to the top
48 wxSHOW_EFFECT_ROLL_TO_TOP,
49
50 /// Roll window to the bottom
51 wxSHOW_EFFECT_ROLL_TO_BOTTOM,
52
53 /// Slide window to the left
54 wxSHOW_EFFECT_SLIDE_TO_LEFT,
55
56 /// Slide window to the right
57 wxSHOW_EFFECT_SLIDE_TO_RIGHT,
58
59 /// Slide window to the top
60 wxSHOW_EFFECT_SLIDE_TO_TOP,
61
62 /// Slide window to the bottom
63 wxSHOW_EFFECT_SLIDE_TO_BOTTOM,
64
65 /// Fade in or out effect
66 wxSHOW_EFFECT_BLEND,
67
68 /// Expanding or collapsing effect
69 wxSHOW_EFFECT_EXPAND
70};
71
72/**
73 Different window variants, on platforms like eg mac uses different
74 rendering sizes.
75*/
76enum wxWindowVariant
77{
78 wxWINDOW_VARIANT_NORMAL, //!< Normal size
79 wxWINDOW_VARIANT_SMALL, //!< Smaller size (about 25 % smaller than normal)
80 wxWINDOW_VARIANT_MINI, //!< Mini size (about 33 % smaller than normal)
81 wxWINDOW_VARIANT_LARGE, //!< Large size (about 25 % larger than normal)
82 wxWINDOW_VARIANT_MAX
83};
84
85
86/**
87 Flags which can be used in wxWindow::UpdateWindowUI().
88*/
89enum wxUpdateUI
90{
91 wxUPDATE_UI_NONE,
92 wxUPDATE_UI_RECURSE,
93 wxUPDATE_UI_FROMIDLE /**< Invoked from On(Internal)Idle */
94};
95
96
23324ae1
FM
97/**
98 @class wxWindow
7c913512 99
e25cd775
FM
100 wxWindow is the base class for all windows and represents any visible object
101 om screen. All controls, top level windows and so on are windows. Sizers and
23324ae1 102 device contexts are not, however, as they don't appear on screen themselves.
7c913512 103
23324ae1
FM
104 Please note that all children of the window will be deleted automatically by
105 the destructor before the window itself is deleted which means that you don't
106 have to worry about deleting them manually. Please see the @ref
962fb6d2 107 overview_windowdeletion "window deletion overview" for more information.
7c913512 108
23324ae1
FM
109 Also note that in this, and many others, wxWidgets classes some
110 @c GetXXX() methods may be overloaded (as, for example,
962fb6d2 111 wxWindow::GetSize or wxWindow::GetClientSize). In this case, the overloads
23324ae1
FM
112 are non-virtual because having multiple virtual functions with the same name
113 results in a virtual function name hiding at the derived class level (in
114 English, this means that the derived class has to override all overloaded
115 variants if it overrides any of them). To allow overriding them in the derived
116 class, wxWidgets uses a unique protected virtual @c DoGetXXX() method
117 and all @c GetXXX() ones are forwarded to it, so overriding the former
118 changes the behaviour of the latter.
7c913512 119
23324ae1 120 @beginStyleTable
8c6791e4 121 @style{wxBORDER_DEFAULT}
23324ae1 122 The window class will decide the kind of border to show, if any.
8c6791e4 123 @style{wxBORDER_SIMPLE}
23324ae1
FM
124 Displays a thin border around the window. wxSIMPLE_BORDER is the
125 old name for this style.
8c6791e4 126 @style{wxBORDER_SUNKEN}
23324ae1
FM
127 Displays a sunken border. wxSUNKEN_BORDER is the old name for this
128 style.
8c6791e4 129 @style{wxBORDER_RAISED}
23324ae1
FM
130 Displays a raised border. wxRAISED_BORDER is the old name for this
131 style.
8c6791e4 132 @style{wxBORDER_STATIC}
23324ae1
FM
133 Displays a border suitable for a static control. wxSTATIC_BORDER
134 is the old name for this style. Windows only.
8c6791e4 135 @style{wxBORDER_THEME}
23324ae1
FM
136 Displays a native border suitable for a control, on the current
137 platform. On Windows XP or Vista, this will be a themed border; on
138 most other platforms a sunken border will be used. For more
139 information for themed borders on Windows, please see Themed
140 borders on Windows.
8c6791e4 141 @style{wxBORDER_NONE}
23324ae1
FM
142 Displays no border, overriding the default border style for the
143 window. wxNO_BORDER is the old name for this style.
8c6791e4 144 @style{wxBORDER_DOUBLE}
23324ae1 145 This style is obsolete and should not be used.
8c6791e4 146 @style{wxTRANSPARENT_WINDOW}
23324ae1
FM
147 The window is transparent, that is, it will not receive paint
148 events. Windows only.
8c6791e4 149 @style{wxTAB_TRAVERSAL}
23324ae1 150 Use this to enable tab traversal for non-dialog windows.
8c6791e4 151 @style{wxWANTS_CHARS}
23324ae1
FM
152 Use this to indicate that the window wants to get all char/key
153 events for all keys - even for keys like TAB or ENTER which are
154 usually used for dialog navigation and which wouldn't be generated
155 without this style. If you need to use this style in order to get
156 the arrows or etc., but would still like to have normal keyboard
157 navigation take place, you should call Navigate in response to the
158 key events for Tab and Shift-Tab.
8c6791e4 159 @style{wxNO_FULL_REPAINT_ON_RESIZE}
23324ae1
FM
160 On Windows, this style used to disable repainting the window
161 completely when its size is changed. Since this behaviour is now
162 the default, the style is now obsolete and no longer has an effect.
8c6791e4 163 @style{wxVSCROLL}
23324ae1
FM
164 Use this style to enable a vertical scrollbar. Notice that this
165 style cannot be used with native controls which don't support
166 scrollbars nor with top-level windows in most ports.
8c6791e4 167 @style{wxHSCROLL}
23324ae1
FM
168 Use this style to enable a horizontal scrollbar. The same
169 limitations as for wxVSCROLL apply to this style.
8c6791e4 170 @style{wxALWAYS_SHOW_SB}
23324ae1
FM
171 If a window has scrollbars, disable them instead of hiding them
172 when they are not needed (i.e. when the size of the window is big
173 enough to not require the scrollbars to navigate it). This style is
174 currently implemented for wxMSW, wxGTK and wxUniversal and does
175 nothing on the other platforms.
8c6791e4 176 @style{wxCLIP_CHILDREN}
23324ae1
FM
177 Use this style to eliminate flicker caused by the background being
178 repainted, then children being painted over them. Windows only.
8c6791e4 179 @style{wxFULL_REPAINT_ON_RESIZE}
23324ae1
FM
180 Use this style to force a complete redraw of the window whenever it
181 is resized instead of redrawing just the part of the window
182 affected by resizing. Note that this was the behaviour by default
183 before 2.5.1 release and that if you experience redraw problems
184 with code which previously used to work you may want to try this.
185 Currently this style applies on GTK+ 2 and Windows only, and full
186 repainting is always done on other platforms.
187 @endStyleTable
7c913512 188
23324ae1 189 @beginExtraStyleTable
8c6791e4 190 @style{wxWS_EX_VALIDATE_RECURSIVELY}
23324ae1
FM
191 By default, Validate/TransferDataTo/FromWindow() only work on
192 direct children of the window (compatible behaviour). Set this flag
193 to make them recursively descend into all subwindows.
8c6791e4 194 @style{wxWS_EX_BLOCK_EVENTS}
23324ae1
FM
195 wxCommandEvents and the objects of the derived classes are
196 forwarded to the parent window and so on recursively by default.
197 Using this flag for the given window allows to block this
198 propagation at this window, i.e. prevent the events from being
e25cd775
FM
199 propagated further upwards. Dialogs have this flag on by default
200 for the reasons explained in the @ref overview_eventhandling "Event Handling Overview".
8c6791e4 201 @style{wxWS_EX_TRANSIENT}
23324ae1
FM
202 Don't use this window as an implicit parent for the other windows:
203 this must be used with transient windows as otherwise there is the
204 risk of creating a dialog/frame with this window as a parent which
205 would lead to a crash if the parent is destroyed before the child.
e25cd775
FM
206 @style{wxWS_EX_CONTEXTHELP}
207 Under Windows, puts a query button on the caption. When pressed,
208 Windows will go into a context-sensitive help mode and wxWidgets
209 will send a wxEVT_HELP event if the user clicked on an application window.
210 This style cannot be used together with wxMAXIMIZE_BOX or wxMINIMIZE_BOX, so
211 these two styles are automatically turned of if this one is used.
8c6791e4 212 @style{wxWS_EX_PROCESS_IDLE}
23324ae1
FM
213 This window should always process idle events, even if the mode set
214 by wxIdleEvent::SetMode is wxIDLE_PROCESS_SPECIFIED.
8c6791e4 215 @style{wxWS_EX_PROCESS_UI_UPDATES}
23324ae1 216 This window should always process UI update events, even if the
e25cd775 217 mode set by wxUpdateUIEvent::SetMode is wxUPDATE_UI_PROCESS_SPECIFIED.
23324ae1 218 @endExtraStyleTable
7c913512 219
23324ae1 220 @library{wxcore}
e25cd775 221 @category{miscwnd}
7c913512 222
a3ac93e3 223 @see @ref overview_eventhandling "Event handling overview",
962fb6d2 224 @ref overview_windowsizing "Window sizing overview"
23324ae1
FM
225*/
226class wxWindow : public wxEvtHandler
227{
228public:
1c7910c3
RR
229 /**
230 Default constructor
231 */
232 wxWindow();
a3ac93e3 233
23324ae1
FM
234 /**
235 Constructs a window, which can be a child of a frame, dialog or any other
236 non-control window.
3c4f71cc 237
7c913512 238 @param parent
4cc4bfaf 239 Pointer to a parent window.
7c913512 240 @param id
4cc4bfaf 241 Window identifier. If wxID_ANY, will automatically create an identifier.
7c913512 242 @param pos
4cc4bfaf 243 Window position. wxDefaultPosition indicates that wxWidgets
e25cd775
FM
244 should generate a default position for the window.
245 If using the wxWindow class directly, supply an actual position.
7c913512 246 @param size
e25cd775
FM
247 Window size. wxDefaultSize indicates that wxWidgets should generate
248 a default size for the window. If no suitable size can be found, the
4cc4bfaf 249 window will be sized to 20x20 pixels so that the window is visible but
e25cd775 250 obviously not correctly sized.
7c913512 251 @param style
4cc4bfaf 252 Window style. For generic window styles, please see wxWindow.
7c913512 253 @param name
4cc4bfaf 254 Window name.
23324ae1 255 */
7c913512
FM
256 wxWindow(wxWindow* parent, wxWindowID id,
257 const wxPoint& pos = wxDefaultPosition,
258 const wxSize& size = wxDefaultSize,
259 long style = 0,
260 const wxString& name = wxPanelNameStr);
23324ae1
FM
261
262 /**
e25cd775
FM
263 Destructor.
264
265 Deletes all sub-windows, then deletes itself. Instead of using
266 the @b delete operator explicitly, you should normally use Destroy()
267 so that wxWidgets can delete a window only when it is safe to do so, in idle time.
3c4f71cc 268
75b00cf8 269 @see @ref overview_windowdeletion "Window Deletion Overview",
4cc4bfaf 270 Destroy(), wxCloseEvent
23324ae1
FM
271 */
272 ~wxWindow();
273
274 /**
275 This method may be overridden in the derived classes to return @false to
e25cd775
FM
276 indicate that this control doesn't accept input at all (i.e. behaves like
277 e.g. wxStaticText) and so doesn't need focus.
3c4f71cc 278
4cc4bfaf 279 @see AcceptsFocusFromKeyboard()
23324ae1 280 */
962fb6d2 281 virtual bool AcceptsFocus() const;
23324ae1
FM
282
283 /**
284 This method may be overridden in the derived classes to return @false to
285 indicate that while this control can, in principle, have focus if the user
286 clicks it with the mouse, it shouldn't be included in the TAB traversal chain
287 when using the keyboard.
288 */
962fb6d2 289 virtual bool AcceptsFocusFromKeyboard() const;
23324ae1 290
962fb6d2
RR
291 /**
292 Overridden to indicate wehter this window or one of its children accepts
293 focus. Usually it's the same as AcceptsFocus() but is overridden for
e25cd775 294 container windows.
962fb6d2
RR
295 */
296 virtual bool AcceptsFocusRecursively() const;
a3ac93e3 297
23324ae1 298 /**
e25cd775 299 Adds a child window. This is called automatically by window creation
23324ae1 300 functions so should not be required by the application programmer.
23324ae1
FM
301 Notice that this function is mostly internal to wxWidgets and shouldn't be
302 called by the user code.
3c4f71cc 303
7c913512 304 @param child
4cc4bfaf 305 Child window to add.
23324ae1
FM
306 */
307 virtual void AddChild(wxWindow* child);
308
309 /**
310 Call this function to force one or both scrollbars to be always shown, even if
311 the window is big enough to show its entire contents without scrolling.
3c4f71cc 312
1e24c2af 313 @since 2.9.0
3c4f71cc 314
7c913512 315 @param hflag
4cc4bfaf 316 Whether the horizontal scroll bar should always be visible.
7c913512 317 @param vflag
4cc4bfaf 318 Whether the vertical scroll bar should always be visible.
3c4f71cc 319
23324ae1
FM
320 @remarks This function is currently only implemented under Mac/Carbon.
321 */
322 void AlwaysShowScrollbars(bool hflag, bool vflag);
323
324 /**
325 Sets the cached best size value.
326 */
328f5751 327 void CacheBestSize(const wxSize& size) const;
23324ae1
FM
328
329 /**
7c913512 330 Returns @true if the system supports transparent windows and calling
e25cd775
FM
331 SetTransparent() may succeed. If this function returns @false, transparent
332 windows are definitely not supported by the current system.
23324ae1
FM
333 */
334 bool CanSetTransparent();
335
336 /**
e25cd775
FM
337 Directs all mouse input to this window.
338 Call ReleaseMouse() to release the capture.
339
23324ae1
FM
340 Note that wxWidgets maintains the stack of windows having captured the mouse
341 and when the mouse is released the capture returns to the window which had had
342 captured it previously and it is only really released if there were no previous
343 window. In particular, this means that you must release the mouse as many times
e25cd775
FM
344 as you capture it, unless the window receives the wxMouseCaptureLostEvent event.
345
23324ae1 346 Any application which captures the mouse in the beginning of some operation
e25cd775
FM
347 must handle wxMouseCaptureLostEvent and cancel this operation when it receives
348 the event. The event handler must not recapture mouse.
3c4f71cc 349
4cc4bfaf 350 @see ReleaseMouse(), wxMouseCaptureLostEvent
23324ae1
FM
351 */
352 virtual void CaptureMouse();
353
354 /**
355 A synonym for Centre().
356 */
357 void Center(int direction);
358
359 /**
360 A synonym for CentreOnParent().
361 */
362 void CenterOnParent(int direction);
363
364 /**
365 Centres the window.
3c4f71cc 366
7c913512 367 @param direction
4cc4bfaf
FM
368 Specifies the direction for the centering. May be wxHORIZONTAL, wxVERTICAL
369 or wxBOTH. It may also include wxCENTRE_ON_SCREEN flag
370 if you want to center the window on the entire screen and not on its
371 parent window.
3c4f71cc 372
23324ae1 373 @remarks If the window is a top level one (i.e. doesn't have a parent),
4cc4bfaf 374 it will be centered relative to the screen anyhow.
3c4f71cc 375
4cc4bfaf 376 @see Center()
23324ae1
FM
377 */
378 void Centre(int direction = wxBOTH);
379
380 /**
e25cd775 381 Centres the window on its parent. This is a more readable synonym for Centre().
3c4f71cc 382
7c913512 383 @param direction
4cc4bfaf
FM
384 Specifies the direction for the centering. May be wxHORIZONTAL, wxVERTICAL
385 or wxBOTH.
3c4f71cc 386
23324ae1 387 @remarks This methods provides for a way to center top level windows over
4cc4bfaf
FM
388 their parents instead of the entire screen. If there
389 is no parent or if the window is not a top level
390 window, then behaviour is the same as Centre().
3c4f71cc 391
4cc4bfaf 392 @see wxTopLevelWindow::CentreOnScreen
23324ae1
FM
393 */
394 void CentreOnParent(int direction = wxBOTH);
395
396 /**
397 Clears the window by filling it with the current background colour. Does not
398 cause an erase background event to be generated.
399 */
400 void ClearBackground();
401
402 //@{
403 /**
404 Converts to screen coordinates from coordinates relative to this window.
3c4f71cc 405
7c913512 406 @param x
4cc4bfaf 407 A pointer to a integer value for the x coordinate. Pass the client
e25cd775 408 coordinate in, and a screen coordinate will be passed out.
7c913512 409 @param y
4cc4bfaf 410 A pointer to a integer value for the y coordinate. Pass the client
e25cd775 411 coordinate in, and a screen coordinate will be passed out.
7c913512 412 @param pt
4cc4bfaf 413 The client position for the second form of the function.
e25cd775
FM
414
415 @beginWxPythonOnly
416 In place of a single overloaded method name, wxPython implements the following methods:
417 - ClientToScreen(point): Accepts and returns a wxPoint
418 - ClientToScreenXY(x, y): Returns a 2-tuple, (x, y)
419 @endWxPythonOnly
23324ae1 420 */
962fb6d2
RR
421 void ClientToScreen(int* x, int* y) const;
422 wxPoint ClientToScreen(const wxPoint& pt) const;
23324ae1
FM
423 //@}
424
425 /**
e25cd775
FM
426 Converts client area size @a size to corresponding window size.
427
428 In other words, the returned value is what would GetSize() return if this
491a5ece
VS
429 window had client area of given size. Components with wxDefaultCoord
430 value are left unchanged. Note that the conversion is not always
431 exact, it assumes that non-client area doesn't change and so doesn't
432 take into account things like menu bar (un)wrapping or (dis)appearance
433 of the scrollbars.
434
435 @since 2.8.8
436
4cc4bfaf 437 @see WindowToClientSize()
23324ae1
FM
438 */
439 virtual wxSize ClientToWindowSize(const wxSize& size);
440
491a5ece 441 /**
e25cd775
FM
442 Converts window size @a size to corresponding client area size
443 In other words, the returned value is what would GetClientSize() return if
491a5ece 444 this window had given window size. Components with wxDefaultCoord value
3c4f71cc 445 are left unchanged.
491a5ece
VS
446
447 Note that the conversion is not always exact, it assumes that
448 non-client area doesn't change and so doesn't take into account things
449 like menu bar (un)wrapping or (dis)appearance of the scrollbars.
450
451 @since 2.8.8
452
453 @see ClientToWindowSize()
454 */
455 virtual wxSize WindowToClientSize(const wxSize& size);
456
23324ae1 457 /**
e25cd775
FM
458 This function simply generates a wxCloseEvent whose handler usually tries
459 to close the window. It doesn't close the window itself, however.
491a5ece 460
7c913512 461 @param force
4cc4bfaf
FM
462 @false if the window's close handler should be able to veto the destruction
463 of this window, @true if it cannot.
3c4f71cc 464
23324ae1 465 @remarks Close calls the close handler for the window, providing an
4cc4bfaf
FM
466 opportunity for the window to choose whether to destroy
467 the window. Usually it is only used with the top level
468 windows (wxFrame and wxDialog classes) as the others
469 are not supposed to have any special OnClose() logic.
e25cd775
FM
470 The close handler should check whether the window is being deleted
471 forcibly, using wxCloseEvent::CanVeto, in which case it should
472 destroy the window using wxWindow::Destroy.
473 Note that calling Close does not guarantee that the window will
474 be destroyed; but it provides a way to simulate a manual close
475 of a window, which may or may not be implemented by destroying
476 the window. The default implementation of wxDialog::OnCloseWindow
477 does not necessarily delete the dialog, since it will simply
478 simulate an wxID_CANCEL event which is handled by the appropriate
479 button event handler and may do anything at all.
480 To guarantee that the window will be destroyed, call
481 wxWindow::Destroy instead
3c4f71cc 482
75b00cf8 483 @see @ref overview_windowdeletion "Window Deletion Overview",
4cc4bfaf 484 Destroy(), wxCloseEvent
23324ae1 485 */
4cc4bfaf 486 bool Close(bool force = false);
23324ae1
FM
487
488 //@{
489 /**
490 Converts a point or size from dialog units to pixels.
e25cd775 491
23324ae1 492 For the x dimension, the dialog units are multiplied by the average character
e25cd775 493 width and then divided by 4.
23324ae1 494 For the y dimension, the dialog units are multiplied by the average character
e25cd775 495 height and then divided by 8.
3c4f71cc 496
23324ae1 497 @remarks Dialog units are used for maintaining a dialog's proportions
4cc4bfaf 498 even if the font changes.
e25cd775
FM
499 You can also use these functions programmatically.
500 A convenience macro is defined:
501 @code
502 #define wxDLG_UNIT(parent, pt) parent->ConvertDialogToPixels(pt)
503 @endcode
3c4f71cc 504
4cc4bfaf 505 @see ConvertPixelsToDialog()
23324ae1
FM
506 */
507 wxPoint ConvertDialogToPixels(const wxPoint& pt);
7c913512 508 wxSize ConvertDialogToPixels(const wxSize& sz);
23324ae1
FM
509 //@}
510
511 //@{
512 /**
513 Converts a point or size from pixels to dialog units.
e25cd775 514
23324ae1 515 For the x dimension, the pixels are multiplied by 4 and then divided by the
e25cd775 516 average character width.
23324ae1 517 For the y dimension, the pixels are multiplied by 8 and then divided by the
e25cd775 518 average character height.
3c4f71cc 519
23324ae1 520 @remarks Dialog units are used for maintaining a dialog's proportions
4cc4bfaf 521 even if the font changes.
3c4f71cc 522
4cc4bfaf 523 @see ConvertDialogToPixels()
23324ae1
FM
524 */
525 wxPoint ConvertPixelsToDialog(const wxPoint& pt);
7c913512 526 wxSize ConvertPixelsToDialog(const wxSize& sz);
23324ae1
FM
527 //@}
528
529 /**
530 Destroys the window safely. Use this function instead of the delete operator,
e25cd775 531 since different window classes can be destroyed differently. Frames and dialogs
23324ae1
FM
532 are not destroyed immediately when this function is called -- they are added
533 to a list of windows to be deleted on idle time, when all the window's events
534 have been processed. This prevents problems with events being sent to
e25cd775 535 non-existent windows.
3c4f71cc 536
d29a9a8a 537 @return @true if the window has either been successfully deleted, or it
e25cd775 538 has been added to the list of windows pending real deletion.
23324ae1
FM
539 */
540 virtual bool Destroy();
541
542 /**
e25cd775 543 Destroys all children of a window. Called automatically by the destructor.
23324ae1
FM
544 */
545 virtual void DestroyChildren();
546
a3ac93e3
VZ
547 /**
548 Returns true if this window is in process of being destroyed.
549
550 The top level windows are not deleted immediately but are rather
551 scheduled for later destruction to give them time to process any
552 pending messages, see Destroy() description.
553
554 This function returns @true if this window, or one of its parent
555 windows, is scheduled for destruction and can be useful to avoid
556 manipulating it as it's usually useless to do something with a window
557 which is on the point of disappearing anyhow.
558 */
559 bool IsBeingDeleted() const;
560
23324ae1 561 /**
75b00cf8 562 Disables the window. Same as @ref Enable() Enable(@false).
3c4f71cc 563
d29a9a8a 564 @return Returns @true if the window has been disabled, @false if it had
e25cd775 565 been already disabled before the call to this function.
23324ae1
FM
566 */
567 bool Disable();
568
569 /**
570 Gets the size which best suits the window: for a control, it would be
571 the minimal size which doesn't truncate the control, for a panel - the
572 same size as it would have after a call to Fit().
cded6aa1
FM
573
574 The default implementation of this function is designed for use in container
575 windows, such as wxPanel, and works something like this:
576 -# If the window has a sizer then it is used to calculate the best size.
577 -# Otherwise if the window has layout constraints then those are used to
578 calculate the best size.
579 -# Otherwise if the window has children then the best size is set to be large
580 enough to show all the children.
581 -# Otherwise if there are no children then the window's minimal size will be
582 used as its best size.
583 -# Otherwise if there is no minimal size set, then the current size is used
584 for the best size.
585
586 @see @ref overview_windowsizing
23324ae1 587 */
328f5751 588 virtual wxSize DoGetBestSize() const;
23324ae1
FM
589
590 /**
591 Does the window-specific updating after processing the update event.
75b00cf8
VZ
592 This function is called by UpdateWindowUI() in order to check return
593 values in the wxUpdateUIEvent and act appropriately.
e25cd775
FM
594 For example, to allow frame and dialog title updating, wxWidgets
595 implements this function as follows:
596
597 @code
598 // do the window-specific processing after processing the update event
599 void wxTopLevelWindowBase::DoUpdateWindowUI(wxUpdateUIEvent& event)
600 {
601 if ( event.GetSetEnabled() )
602 Enable(event.GetEnabled());
603
604 if ( event.GetSetText() )
605 {
606 if ( event.GetText() != GetTitle() )
607 SetTitle(event.GetText());
608 }
609 }
610 @endcode
23324ae1
FM
611 */
612 virtual void DoUpdateWindowUI(wxUpdateUIEvent& event);
613
614 /**
615 Enables or disables eligibility for drop file events (OnDropFiles).
3c4f71cc 616
7c913512 617 @param accept
e25cd775
FM
618 If @true, the window is eligible for drop file events.
619 If @false, the window will not accept drop file events.
3c4f71cc 620
23324ae1
FM
621 @remarks Windows only.
622 */
623 virtual void DragAcceptFiles(bool accept);
624
625 /**
626 Enable or disable the window for user input. Note that when a parent window is
627 disabled, all of its children are disabled as well and they are reenabled again
628 when the parent is.
3c4f71cc 629
7c913512 630 @param enable
4cc4bfaf 631 If @true, enables the window for input. If @false, disables the window.
3c4f71cc 632
d29a9a8a 633 @return Returns @true if the window has been enabled or disabled, @false
e25cd775
FM
634 if nothing was done, i.e. if the window had already
635 been in the specified state.
3c4f71cc 636
4cc4bfaf 637 @see IsEnabled(), Disable(), wxRadioBox::Enable
23324ae1 638 */
4cc4bfaf 639 virtual bool Enable(bool enable = true);
23324ae1
FM
640
641 /**
642 Finds the window or control which currently has the keyboard focus.
3c4f71cc 643
23324ae1 644 @remarks Note that this is a static function, so it can be called without
4cc4bfaf 645 needing a wxWindow pointer.
3c4f71cc 646
4cc4bfaf 647 @see SetFocus(), HasFocus()
23324ae1
FM
648 */
649 static wxWindow* FindFocus();
650
23324ae1 651 /**
e25cd775
FM
652 Find a child of this window, by @a id.
653 May return @a this if it matches itself.
23324ae1 654 */
328f5751 655 wxWindow* FindWindow(long id) const;
a3ac93e3 656
1c7910c3 657 /**
e25cd775
FM
658 Find a child of this window, by name.
659 May return @a this if it matches itself.
1c7910c3
RR
660 */
661 wxWindow* FindWindow(const wxString& name) const;
23324ae1
FM
662
663 /**
664 Find the first window with the given @e id.
e25cd775
FM
665
666 If @a parent is @NULL, the search will start from all top-level frames
667 and dialog boxes; if non-@NULL, the search will be limited to the given
23324ae1
FM
668 window hierarchy.
669 The search is recursive in both cases.
3c4f71cc 670
4cc4bfaf 671 @see FindWindow()
23324ae1 672 */
4cc4bfaf 673 static wxWindow* FindWindowById(long id, wxWindow* parent = NULL);
23324ae1
FM
674
675 /**
e25cd775
FM
676 Find a window by its label.
677
678 Depending on the type of window, the label may be a window title
4cc4bfaf 679 or panel item label. If @a parent is @NULL, the search will start from all
e25cd775
FM
680 top-level frames and dialog boxes; if non-@NULL, the search will be
681 limited to the given window hierarchy.
23324ae1 682 The search is recursive in both cases.
3c4f71cc 683
4cc4bfaf 684 @see FindWindow()
23324ae1
FM
685 */
686 static wxWindow* FindWindowByLabel(const wxString& label,
4cc4bfaf 687 wxWindow* parent = NULL);
23324ae1
FM
688
689 /**
690 Find a window by its name (as given in a window constructor or @b Create
691 function call).
e25cd775
FM
692
693 If @a parent is @NULL, the search will start from all top-level frames
694 and dialog boxes; if non-@NULL, the search will be limited to the given
23324ae1 695 window hierarchy.
e25cd775
FM
696
697 The search is recursive in both cases. If no window with such name is found,
23324ae1 698 FindWindowByLabel() is called.
3c4f71cc 699
4cc4bfaf 700 @see FindWindow()
23324ae1
FM
701 */
702 static wxWindow* FindWindowByName(const wxString& name,
4cc4bfaf 703 wxWindow* parent = NULL);
23324ae1
FM
704
705 /**
cded6aa1
FM
706 Sizes the window so that it fits around its subwindows.
707
708 This function won't do anything if there are no subwindows and will only really
709 work correctly if sizers are used for the subwindows layout.
710
711 Also, if the window has exactly one subwindow it is better (faster and the result
712 is more precise as Fit() adds some margin to account for fuzziness of its calculations)
713 to call:
714
75b00cf8 715 @code
e25cd775 716 window->SetClientSize(child->GetSize());
cded6aa1
FM
717 @endcode
718
719 instead of calling Fit().
3c4f71cc 720
cded6aa1 721 @see @ref overview_windowsizing
23324ae1 722 */
4cc4bfaf 723 virtual void Fit();
23324ae1
FM
724
725 /**
e25cd775
FM
726 Similar to Fit(), but sizes the interior (virtual) size of a window.
727
728 Mainly useful with scrolled windows to reset scrollbars after sizing
729 changes that do not trigger a size event, and/or scrolled windows without
730 an interior sizer. This function similarly won't do anything if there are
731 no subwindows.
23324ae1
FM
732 */
733 virtual void FitInside();
734
735 /**
a7c01bb1
VS
736 Freezes the window or, in other words, prevents any updates from taking
737 place on screen, the window is not redrawn at all.
738
739 Thaw() must be called to reenable window redrawing. Calls to these two
740 functions may be nested but to ensure that the window is properly
e25cd775 741 repainted again, you must thaw it exactly as many times as you froze it.
a7c01bb1
VS
742
743 If the window has any children, they are recursively frozen too.
744
745 This method is useful for visual appearance optimization (for example,
746 it is a good idea to use it before doing many large text insertions in
747 a row into a wxTextCtrl under wxGTK) but is not implemented on all
748 platforms nor for all controls so it is mostly just a hint to wxWidgets
749 and not a mandatory directive.
750
751 @see wxWindowUpdateLocker, Thaw(), IsFrozen()
23324ae1
FM
752 */
753 virtual void Freeze();
754
755 /**
756 Gets the accelerator table for this window. See wxAcceleratorTable.
757 */
328f5751 758 wxAcceleratorTable* GetAcceleratorTable() const;
23324ae1
FM
759
760 /**
761 Returns the accessible object for this window, if any.
23324ae1
FM
762 See also wxAccessible.
763 */
764 wxAccessible* GetAccessible();
765
766 /**
e25cd775 767 @deprecated
cded6aa1 768 This method is deprecated, use GetEffectiveMinSize() instead.
23324ae1 769 */
328f5751 770 wxSize GetAdjustedBestSize() const;
23324ae1
FM
771
772 /**
773 Returns the background colour of the window.
3c4f71cc 774
e25cd775 775 @see SetBackgroundColour(), SetForegroundColour(), GetForegroundColour()
23324ae1 776 */
962fb6d2 777 wxColour GetBackgroundColour() const;
23324ae1
FM
778
779 /**
e25cd775
FM
780 Returns the background style of the window.
781 The background style can be one of the wxBackgroundStyle.
3c4f71cc 782
4cc4bfaf
FM
783 @see SetBackgroundColour(), GetForegroundColour(),
784 SetBackgroundStyle(), SetTransparent()
23324ae1 785 */
328f5751 786 virtual wxBackgroundStyle GetBackgroundStyle() const;
23324ae1
FM
787
788 /**
e25cd775
FM
789 This functions returns the best acceptable minimal size for the window.
790
791 For example, for a static control, it will be the minimal size such that the
23324ae1 792 control label is not truncated. For windows containing subwindows (typically
e25cd775
FM
793 wxPanel), the size returned by this function will be the same as the size
794 the window would have had after calling Fit().
23324ae1 795 */
328f5751 796 wxSize GetBestSize() const;
23324ae1
FM
797
798 /**
799 Returns the currently captured window.
3c4f71cc 800
4cc4bfaf
FM
801 @see HasCapture(), CaptureMouse(), ReleaseMouse(),
802 wxMouseCaptureLostEvent, wxMouseCaptureChangedEvent
23324ae1 803 */
4cc4bfaf 804 static wxWindow* GetCapture();
23324ae1
FM
805
806 /**
e54c96f1 807 Returns the caret() associated with the window.
23324ae1 808 */
328f5751 809 wxCaret* GetCaret() const;
23324ae1
FM
810
811 /**
812 Returns the character height for this window.
813 */
328f5751 814 virtual int GetCharHeight() const;
23324ae1
FM
815
816 /**
817 Returns the average character width for this window.
818 */
328f5751 819 virtual int GetCharWidth() const;
23324ae1
FM
820
821 //@{
822 /**
7c913512 823 Returns a reference to the list of the window's children. @c wxWindowList
1c7910c3 824 is a type-safe wxList-like class whose elements are of type @c wxWindow*.
23324ae1 825 */
1c7910c3
RR
826 wxWindowList& GetChildren();
827 const wxWindowList& GetChildren() const;
23324ae1
FM
828 //@}
829
830 /**
e25cd775
FM
831 Returns the default font and colours which are used by the control.
832
833 This is useful if you want to use the same font or colour in your own control
834 as in a standard control -- which is a much better idea than hard coding specific
23324ae1
FM
835 colours or fonts which might look completely out of place on the users
836 system, especially if it uses themes.
e25cd775 837
4cc4bfaf 838 The @a variant parameter is only relevant under Mac currently and is
23324ae1 839 ignore under other platforms. Under Mac, it will change the size of the
e25cd775
FM
840 returned font. See SetWindowVariant() for more about this.
841
cdbcf4c2 842 This static method is "overridden" in many derived classes and so calling,
23324ae1
FM
843 for example, wxButton::GetClassDefaultAttributes() will typically
844 return the values appropriate for a button which will be normally different
845 from those returned by, say, wxListCtrl::GetClassDefaultAttributes().
e25cd775 846
23324ae1
FM
847 The @c wxVisualAttributes structure has at least the fields
848 @c font, @c colFg and @c colBg. All of them may be invalid
849 if it was not possible to determine the default control appearance or,
850 especially for the background colour, if the field doesn't make sense as is
851 the case for @c colBg for the controls with themed background.
3c4f71cc 852
4cc4bfaf 853 @see InheritAttributes()
23324ae1
FM
854 */
855 static wxVisualAttributes GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
856
857 //@{
858 /**
e25cd775
FM
859 Returns the size of the window 'client area' in pixels.
860 The client area is the area which may be drawn on by the programmer,
861 excluding title bar, border, scrollbars, etc.
23324ae1
FM
862 Note that if this window is a top-level one and it is currently minimized, the
863 return size is empty (both width and height are 0).
3c4f71cc 864
7c913512 865 @param width
4cc4bfaf 866 Receives the client width in pixels.
7c913512 867 @param height
4cc4bfaf 868 Receives the client height in pixels.
3c4f71cc 869
4cc4bfaf 870 @see GetSize(), GetVirtualSize()
23324ae1 871 */
328f5751 872 void GetClientSize(int* width, int* height) const;
1c7910c3 873 wxSize GetClientSize() const;
23324ae1
FM
874 //@}
875
876 /**
877 Returns a pointer to the window's layout constraints, or @NULL if there are none.
878 */
328f5751 879 wxLayoutConstraints* GetConstraints() const;
23324ae1
FM
880
881 /**
e25cd775 882 Return the sizer that this window is a member of, if any, otherwise @NULL.
23324ae1 883 */
962fb6d2 884 wxSizer* GetContainingSizer() const;
23324ae1
FM
885
886 /**
887 Return the cursor associated with this window.
3c4f71cc 888
4cc4bfaf 889 @see SetCursor()
23324ae1 890 */
1c7910c3 891 const wxCursor& GetCursor() const;
23324ae1
FM
892
893 /**
894 Currently this is the same as calling
895 wxWindow::GetClassDefaultAttributes(wxWindow::GetWindowVariant()).
e25cd775 896
23324ae1
FM
897 One advantage of using this function compared to the static version is that
898 the call is automatically dispatched to the correct class (as usual with
899 virtual functions) and you don't have to specify the class name explicitly.
e25cd775 900
23324ae1 901 The other one is that in the future this function could return different
cdbcf4c2 902 results, for example it might return a different font for an "Ok" button
23324ae1
FM
903 than for a generic button if the users GUI is configured to show such buttons
904 in bold font. Of course, the down side is that it is impossible to call this
905 function without actually having an object to apply it to whereas the static
906 version can be used without having to create an object first.
907 */
328f5751 908 virtual wxVisualAttributes GetDefaultAttributes() const;
23324ae1
FM
909
910 /**
911 Returns the associated drop target, which may be @NULL.
3c4f71cc 912
75b00cf8 913 @see SetDropTarget(), @ref overview_dnd
23324ae1 914 */
328f5751 915 wxDropTarget* GetDropTarget() const;
23324ae1
FM
916
917 /**
cded6aa1
FM
918 Merges the window's best size into the min size and returns the result.
919 This is the value used by sizers to determine the appropriate
23324ae1 920 ammount of space to allocate for the widget.
3c4f71cc 921
cded6aa1 922 @see GetBestSize(), SetInitialSize(), @ref overview_windowsizing
23324ae1 923 */
328f5751 924 wxSize GetEffectiveMinSize() const;
23324ae1
FM
925
926 /**
e25cd775
FM
927 Returns the event handler for this window.
928 By default, the window is its own event handler.
3c4f71cc 929
4cc4bfaf
FM
930 @see SetEventHandler(), PushEventHandler(),
931 PopEventHandler(), wxEvtHandler::ProcessEvent, wxEvtHandler
23324ae1 932 */
328f5751 933 wxEvtHandler* GetEventHandler() const;
23324ae1
FM
934
935 /**
936 Returns the extra style bits for the window.
937 */
328f5751 938 long GetExtraStyle() const;
23324ae1
FM
939
940 /**
941 Returns the font for this window.
3c4f71cc 942
4cc4bfaf 943 @see SetFont()
23324ae1 944 */
328f5751 945 wxFont GetFont() const;
23324ae1
FM
946
947 /**
948 Returns the foreground colour of the window.
3c4f71cc 949
23324ae1 950 @remarks The interpretation of foreground colour is open to
4cc4bfaf 951 interpretation according to the window class; it may be
e25cd775 952 the text colour or other colour, or it may not be used at all.
3c4f71cc 953
4cc4bfaf
FM
954 @see SetForegroundColour(), SetBackgroundColour(),
955 GetBackgroundColour()
23324ae1 956 */
962fb6d2 957 wxColour GetForegroundColour();
23324ae1
FM
958
959 /**
960 Returns the grandparent of a window, or @NULL if there isn't one.
961 */
328f5751 962 wxWindow* GetGrandParent() const;
23324ae1
FM
963
964 /**
e25cd775
FM
965 Returns the platform-specific handle of the physical window.
966 Cast it to an appropriate handle, such as @b HWND for Windows,
967 @b Widget for Motif, @b GtkWidget for GTK or @b WinHandle for PalmOS.
23324ae1 968 */
328f5751 969 void* GetHandle() const;
23324ae1
FM
970
971 /**
972 Gets the help text to be used as context-sensitive help for this window.
23324ae1 973 Note that the text is actually stored by the current wxHelpProvider
e25cd775 974 implementation, and not in the window object itself.
3c4f71cc 975
4cc4bfaf 976 @see SetHelpText(), GetHelpTextAtPoint(), wxHelpProvider
23324ae1 977 */
328f5751 978 virtual wxString GetHelpText() const;
23324ae1
FM
979
980 /**
e25cd775
FM
981 Gets the help text to be used as context-sensitive help for this window.
982 This method should be overridden if the help message depends on the position
983 inside the window, otherwise GetHelpText() can be used.
3c4f71cc 984
7c913512 985 @param point
4cc4bfaf 986 Coordinates of the mouse at the moment of help event emission.
7c913512 987 @param origin
4cc4bfaf 988 Help event origin, see also wxHelpEvent::GetOrigin.
23324ae1
FM
989 */
990 virtual wxString GetHelpTextAtPoint(const wxPoint point,
328f5751 991 wxHelpEvent::Origin origin) const;
23324ae1
FM
992
993 /**
994 Returns the identifier of the window.
3c4f71cc 995
e25cd775
FM
996 @remarks Each window has an integer identifier. If the application
997 has not provided one (or the default wxID_ANY) an unique
4cc4bfaf 998 identifier with a negative value will be generated.
3c4f71cc 999
e25cd775 1000 @see SetId(), @ref overview_windowids
23324ae1 1001 */
328f5751 1002 int GetId() const;
23324ae1
FM
1003
1004 /**
1005 Generic way of getting a label from any window, for
1006 identification purposes.
3c4f71cc 1007
23324ae1 1008 @remarks The interpretation of this function differs from class to class.
4cc4bfaf
FM
1009 For frames and dialogs, the value returned is the
1010 title. For buttons or static text controls, it is the
1011 button text. This function can be useful for
1012 meta-programs (such as testing tools or special-needs
1013 access programs) which need to identify windows by name.
23324ae1 1014 */
328f5751 1015 virtual wxString GetLabel() const;
23324ae1
FM
1016
1017 /**
7c913512 1018 Returns the maximum size of window's client area.
e25cd775 1019
23324ae1
FM
1020 This is an indication to the sizer layout mechanism that this is the maximum
1021 possible size as well as the upper bound on window's size settable using
7c913512 1022 SetClientSize().
3c4f71cc 1023
4cc4bfaf 1024 @see GetMaxSize()
23324ae1 1025 */
328f5751 1026 wxSize GetMaxClientSize() const;
23324ae1
FM
1027
1028 /**
e25cd775
FM
1029 Returns the maximum size of the window.
1030
1031 This is an indication to the sizer layout mechanism that this is the maximum
1032 possible size as well as the upper bound on window's size settable using SetSize().
3c4f71cc 1033
4cc4bfaf 1034 @see GetMaxClientSize()
23324ae1 1035 */
328f5751 1036 wxSize GetMaxSize() const;
23324ae1
FM
1037
1038 /**
1039 Returns the minimum size of window's client area, an indication to the sizer
e25cd775
FM
1040 layout mechanism that this is the minimum required size of its client area.
1041
1042 It normally just returns the value set by SetMinClientSize(), but it can be
1043 overridden to do the calculation on demand.
3c4f71cc 1044
4cc4bfaf 1045 @see GetMinSize()
23324ae1 1046 */
328f5751 1047 virtual wxSize GetMinClientSize() const;
23324ae1
FM
1048
1049 /**
1050 Returns the minimum size of the window, an indication to the sizer layout
5af86f4d
VZ
1051 mechanism that this is the minimum required size.
1052
1053 This method normally just returns the value set by SetMinSize(), but it
1054 can be overridden to do the calculation on demand.
3c4f71cc 1055
4cc4bfaf 1056 @see GetMinClientSize()
23324ae1 1057 */
328f5751 1058 virtual wxSize GetMinSize() const;
23324ae1
FM
1059
1060 /**
1061 Returns the window's name.
3c4f71cc 1062
23324ae1 1063 @remarks This name is not guaranteed to be unique; it is up to the
4cc4bfaf
FM
1064 programmer to supply an appropriate name in the window
1065 constructor or via SetName().
3c4f71cc 1066
4cc4bfaf 1067 @see SetName()
23324ae1 1068 */
328f5751 1069 virtual wxString GetName() const;
23324ae1
FM
1070
1071 /**
e25cd775
FM
1072 Returns the next window after this one among the parent children or @NULL
1073 if this window is the last child.
3c4f71cc 1074
1e24c2af 1075 @since 2.8.8
3c4f71cc 1076
4cc4bfaf 1077 @see GetPrevSibling()
23324ae1 1078 */
328f5751 1079 wxWindow* GetNextSibling() const;
23324ae1
FM
1080
1081 /**
1082 Returns the parent of the window, or @NULL if there is no parent.
1083 */
328f5751 1084 virtual wxWindow* GetParent() const;
23324ae1
FM
1085
1086 //@{
1087 /**
1088 This function shows a popup menu at the given position in this window and
1089 returns the selected id. It can be more convenient than the general purpose
e25cd775
FM
1090 PopupMenu() function for simple menus proposing a choice in a list of
1091 strings to the user.
3c4f71cc 1092
7c913512 1093 @param menu
4cc4bfaf 1094 The menu to show
7c913512 1095 @param pos
4cc4bfaf 1096 The position at which to show the menu in client coordinates
7c913512 1097 @param x
4cc4bfaf 1098 The horizontal position of the menu
7c913512 1099 @param y
4cc4bfaf 1100 The vertical position of the menu
3c4f71cc 1101
d29a9a8a 1102 @return The selected menu item id or wxID_NONE if none selected or an
4cc4bfaf 1103 error occurred.
23324ae1 1104 */
e25cd775 1105 int GetPopupMenuSelectionFromUser(wxMenu& menu, const wxPoint& pos);
7c913512 1106 int GetPopupMenuSelectionFromUser(wxMenu& menu, int x, int y);
23324ae1
FM
1107 //@}
1108
1109 //@{
1110 /**
1111 This gets the position of the window in pixels, relative to the parent window
e25cd775 1112 for the child windows or relative to the display origin for the top level windows.
3c4f71cc 1113
7c913512 1114 @param x
4cc4bfaf 1115 Receives the x position of the window if non-@NULL.
7c913512 1116 @param y
4cc4bfaf 1117 Receives the y position of the window if non-@NULL.
3c4f71cc 1118
4cc4bfaf 1119 @see GetScreenPosition()
23324ae1 1120 */
962fb6d2 1121 void GetPosition(int* x, int* y) const;
1c7910c3 1122 wxPoint GetPosition() const;
23324ae1
FM
1123 //@}
1124
1125 /**
1126 Returns the previous window before this one among the parent children or @c
e25cd775 1127 @NULL if this window is the first child.
3c4f71cc 1128
1e24c2af 1129 @since 2.8.8
3c4f71cc 1130
4cc4bfaf 1131 @see GetNextSibling()
23324ae1 1132 */
328f5751 1133 wxWindow* GetPrevSibling() const;
23324ae1
FM
1134
1135 /**
1136 Returns the position and size of the window as a wxRect object.
3c4f71cc 1137
4cc4bfaf 1138 @see GetScreenRect()
23324ae1 1139 */
962fb6d2 1140 wxRect GetRect() const;
23324ae1
FM
1141
1142 //@{
1143 /**
1144 Returns the window position in screen coordinates, whether the window is a
1145 child window or a top level one.
3c4f71cc 1146
7c913512 1147 @param x
4cc4bfaf 1148 Receives the x position of the window on the screen if non-@NULL.
7c913512 1149 @param y
4cc4bfaf 1150 Receives the y position of the window on the screen if non-@NULL.
3c4f71cc 1151
4cc4bfaf 1152 @see GetPosition()
23324ae1 1153 */
962fb6d2
RR
1154 void GetScreenPosition(int* x, int* y) const;
1155 wxPoint GetScreenPosition() const;
23324ae1
FM
1156 //@}
1157
1158 /**
e25cd775 1159 Returns the position and size of the window on the screen as a wxRect object.
3c4f71cc 1160
4cc4bfaf 1161 @see GetRect()
23324ae1 1162 */
962fb6d2 1163 wxRect GetScreenRect() const;
23324ae1
FM
1164
1165 /**
1166 Returns the built-in scrollbar position.
3c4f71cc 1167
4cc4bfaf 1168 @see See SetScrollbar()
23324ae1
FM
1169 */
1170 virtual int GetScrollPos(int orientation);
1171
1172 /**
1173 Returns the built-in scrollbar range.
3c4f71cc 1174
4cc4bfaf 1175 @see SetScrollbar()
23324ae1
FM
1176 */
1177 virtual int GetScrollRange(int orientation);
1178
1179 /**
1180 Returns the built-in scrollbar thumb size.
3c4f71cc 1181
4cc4bfaf 1182 @see SetScrollbar()
23324ae1
FM
1183 */
1184 virtual int GetScrollThumb(int orientation);
1185
1186 //@{
1187 /**
1188 Returns the size of the entire window in pixels, including title bar, border,
1189 scrollbars, etc.
e25cd775 1190
23324ae1
FM
1191 Note that if this window is a top-level one and it is currently minimized, the
1192 returned size is the restored window size, not the size of the window icon.
3c4f71cc 1193
7c913512 1194 @param width
4cc4bfaf 1195 Receives the window width.
7c913512 1196 @param height
4cc4bfaf 1197 Receives the window height.
3c4f71cc 1198
4cc4bfaf 1199 @see GetClientSize(), GetVirtualSize()
23324ae1 1200 */
328f5751 1201 void GetSize(int* width, int* height) const;
e25cd775 1202 wxSize GetSize() const;
23324ae1
FM
1203 //@}
1204
1205 /**
1206 Return the sizer associated with the window by a previous call to
1207 SetSizer() or @NULL.
1208 */
328f5751 1209 wxSizer* GetSizer() const;
23324ae1
FM
1210
1211 //@{
1212 /**
1213 Gets the dimensions of the string as it would be drawn on the
1214 window with the currently selected font.
e25cd775
FM
1215
1216 The text extent is returned in @a w and @a h pointers.
3c4f71cc 1217
7c913512 1218 @param string
4cc4bfaf 1219 String whose extent is to be measured.
7c913512 1220 @param w
4cc4bfaf 1221 Return value for width.
7c913512 1222 @param h
4cc4bfaf 1223 Return value for height.
7c913512 1224 @param descent
4cc4bfaf 1225 Return value for descent (optional).
7c913512 1226 @param externalLeading
4cc4bfaf 1227 Return value for external leading (optional).
7c913512 1228 @param font
4cc4bfaf 1229 Font to use instead of the current window font (optional).
7c913512 1230 @param use16
4cc4bfaf 1231 If @true, string contains 16-bit characters. The default is @false.
23324ae1 1232 */
e25cd775 1233 virtual void GetTextExtent(const wxString& string, int* w, int* h,
4cc4bfaf
FM
1234 int* descent = NULL,
1235 int* externalLeading = NULL,
1236 const wxFont* font = NULL,
328f5751 1237 bool use16 = false) const;
e25cd775
FM
1238
1239 /**
1240 Gets the dimensions of the string as it would be drawn on the
1241 window with the currently selected font.
1242 */
1243 wxSize GetTextExtent(const wxString& string) const;
23324ae1
FM
1244 //@}
1245
1246 /**
1247 Get the associated tooltip or @NULL if none.
1248 */
328f5751 1249 wxToolTip* GetToolTip() const;
23324ae1
FM
1250
1251 /**
1252 Returns the region specifying which parts of the window have been damaged.
e25cd775 1253 Should only be called within an wxPaintEvent handler.
3c4f71cc 1254
4cc4bfaf 1255 @see wxRegion, wxRegionIterator
23324ae1 1256 */
328f5751 1257 virtual wxRegion GetUpdateRegion() const;
23324ae1
FM
1258
1259 /**
e25cd775
FM
1260 Returns a pointer to the current validator for the window, or @NULL if
1261 there is none.
23324ae1 1262 */
328f5751 1263 wxValidator* GetValidator() const;
23324ae1
FM
1264
1265 //@{
1266 /**
e25cd775
FM
1267 This gets the virtual size of the window in pixels.
1268 By default it returns the client size of the window, but after a call to
1269 SetVirtualSize() it will return that size.
3c4f71cc 1270
7c913512 1271 @param width
4cc4bfaf 1272 Receives the window virtual width.
7c913512 1273 @param height
4cc4bfaf 1274 Receives the window virtual height.
23324ae1 1275 */
328f5751 1276 void GetVirtualSize(int* width, int* height) const;
e25cd775 1277 wxSize GetVirtualSize() const;
23324ae1
FM
1278 //@}
1279
1280 /**
1281 Returns the size of the left/right and top/bottom borders of this window in x
1282 and y components of the result respectively.
1283 */
328f5751 1284 wxSize GetWindowBorderSize() const;
23324ae1
FM
1285
1286 /**
1287 Gets the window style that was passed to the constructor or @b Create
1288 method. @b GetWindowStyle() is another name for the same function.
1289 */
328f5751 1290 long GetWindowStyleFlag() const;
23324ae1
FM
1291
1292 /**
e25cd775 1293 Returns the value previously passed to SetWindowVariant().
23324ae1 1294 */
328f5751 1295 wxWindowVariant GetWindowVariant() const;
23324ae1
FM
1296
1297 /**
1298 This function will generate the appropriate call to
1299 Navigate() if the key event is one normally used for
1300 keyboard navigation and return @true in this case.
3c4f71cc 1301
d29a9a8a 1302 @return Returns @true if the key pressed was for navigation and was
e25cd775 1303 handled, @false otherwise.
3c4f71cc 1304
4cc4bfaf 1305 @see Navigate()
23324ae1
FM
1306 */
1307 bool HandleAsNavigationKey(const wxKeyEvent& event);
1308
1309 /**
e25cd775
FM
1310 Shorthand for:
1311 @code
1312 GetEventHandler()->SafelyProcessEvent(event);
1313 @endcode
23324ae1
FM
1314 */
1315 bool HandleWindowEvent(wxEvent& event);
1316
1317 /**
1318 Returns @true if this window has the current mouse capture.
3c4f71cc 1319
4cc4bfaf
FM
1320 @see CaptureMouse(), ReleaseMouse(), wxMouseCaptureLostEvent,
1321 wxMouseCaptureChangedEvent
23324ae1 1322 */
328f5751 1323 virtual bool HasCapture() const;
23324ae1
FM
1324
1325 /**
4cc4bfaf 1326 Returns @true if the window has the given @a exFlag bit set in its
23324ae1 1327 extra styles.
3c4f71cc 1328
4cc4bfaf 1329 @see SetExtraStyle()
23324ae1 1330 */
328f5751 1331 bool HasExtraStyle(int exFlag) const;
23324ae1
FM
1332
1333 /**
4cc4bfaf 1334 Returns @true if the window has the given @a flag bit set.
23324ae1 1335 */
328f5751 1336 bool HasFlag(int flag) const;
23324ae1
FM
1337
1338 /**
1339 Returns @true if the window (or in case of composite controls, its main
1340 child window) has focus.
3c4f71cc 1341
4cc4bfaf 1342 @see FindFocus()
23324ae1 1343 */
328f5751 1344 virtual bool HasFocus() const;
23324ae1
FM
1345
1346 /**
1347 This method should be overridden to return @true if this window has
7c913512 1348 multiple pages. All standard class with multiple pages such as
e25cd775
FM
1349 wxNotebook, wxListbook and wxTreebook already override it to return @true
1350 and user-defined classes with similar behaviour should do it as well to
1351 allow the library to handle such windows appropriately.
23324ae1 1352 */
328f5751 1353 virtual bool HasMultiplePages() const;
23324ae1
FM
1354
1355 /**
1356 Returns @true if this window has a scroll bar for this orientation.
3c4f71cc 1357
7c913512 1358 @param orient
4cc4bfaf 1359 Orientation to check, either wxHORIZONTAL or wxVERTICAL.
23324ae1 1360 */
328f5751 1361 virtual bool HasScrollbar(int orient) const;
23324ae1
FM
1362
1363 /**
e25cd775
FM
1364 Returns @true if this window background is transparent (as, for example,
1365 for wxStaticText) and should show the parent window background.
1366
23324ae1
FM
1367 This method is mostly used internally by the library itself and you normally
1368 shouldn't have to call it. You may, however, have to override it in your
1369 wxWindow-derived class to ensure that background is painted correctly.
1370 */
328f5751 1371 virtual bool HasTransparentBackground() const;
23324ae1
FM
1372
1373 /**
1374 Equivalent to calling wxWindow::Show(@false).
1375 */
1376 bool Hide();
1377
1378 /**
eed04c99
VS
1379 This function hides a window, like Hide(), but using a special visual
1380 effect if possible.
1381
1382 The parameters of this function are the same as for ShowWithEffect(),
1383 please see their description there.
3c4f71cc 1384
1e24c2af 1385 @since 2.9.0
23324ae1
FM
1386 */
1387 virtual bool HideWithEffect(wxShowEffect effect,
eed04c99 1388 unsigned timeout = 0);
23324ae1
FM
1389
1390 /**
1391 This function is (or should be, in case of custom controls) called during
1392 window creation to intelligently set up the window visual attributes, that is
1393 the font and the foreground and background colours.
e25cd775 1394
cdbcf4c2 1395 By "intelligently" the following is meant: by default, all windows use their
e25cd775
FM
1396 own @ref GetClassDefaultAttributes() default attributes.
1397 However if some of the parents attributes are explicitly (that is, using
1398 SetFont() and not wxWindow::SetOwnFont) changed and if the corresponding
1399 attribute hadn't been explicitly set for this window itself, then this
1400 window takes the same value as used by the parent.
1401 In addition, if the window overrides ShouldInheritColours() to return @false,
1402 the colours will not be changed no matter what and only the font might.
1403
23324ae1
FM
1404 This rather complicated logic is necessary in order to accommodate the
1405 different usage scenarios. The most common one is when all default attributes
1406 are used and in this case, nothing should be inherited as in modern GUIs
1407 different controls use different fonts (and colours) than their siblings so
1408 they can't inherit the same value from the parent. However it was also deemed
1409 desirable to allow to simply change the attributes of all children at once by
1410 just changing the font or colour of their common parent, hence in this case we
1411 do inherit the parents attributes.
1412 */
1413 void InheritAttributes();
1414
1415 /**
1416 Sends an @c wxEVT_INIT_DIALOG event, whose handler usually transfers data
1417 to the dialog via validators.
1418 */
1419 void InitDialog();
1420
1421 /**
1422 Resets the cached best size value so it will be recalculated the next time it
1423 is needed.
1424 */
1425 void InvalidateBestSize();
1426
1427 /**
1428 Returns @true if the window contents is double-buffered by the system, i.e. if
1429 any drawing done on the window is really done on a temporary backing surface
1430 and transferred to the screen all at once later.
3c4f71cc 1431
4cc4bfaf 1432 @see wxBufferedDC
23324ae1 1433 */
328f5751 1434 virtual bool IsDoubleBuffered() const;
23324ae1
FM
1435
1436 /**
e25cd775
FM
1437 Returns @true if the window is enabled, i.e. if it accepts user input,
1438 @false otherwise.
1439
23324ae1 1440 Notice that this method can return @false even if this window itself hadn't
e25cd775
FM
1441 been explicitly disabled when one of its parent windows is disabled.
1442 To get the intrinsic status of this window, use IsThisEnabled()
3c4f71cc 1443
4cc4bfaf 1444 @see Enable()
23324ae1 1445 */
328f5751 1446 virtual bool IsEnabled() const;
23324ae1
FM
1447
1448 //@{
1449 /**
1450 Returns @true if the given point or rectangle area has been exposed since the
1451 last repaint. Call this in an paint event handler to optimize redrawing by
1452 only redrawing those areas, which have been exposed.
1453 */
328f5751
FM
1454 bool IsExposed(int x, int y) const;
1455 const bool IsExposed(wxPoint amp;pt) const;
1456 const bool IsExposed(int x, int y, int w, int h) const;
1457 const bool IsExposed(wxRect amp;rect) const;
23324ae1
FM
1458 //@}
1459
1460 /**
e25cd775 1461 Returns @true if the window is currently frozen by a call to Freeze().
3c4f71cc 1462
a7c01bb1 1463 @see Freeze(), Thaw()
23324ae1 1464 */
328f5751 1465 virtual bool IsFrozen() const;
23324ae1
FM
1466
1467 /**
1468 Returns @true if the window is retained, @false otherwise.
3c4f71cc 1469
23324ae1
FM
1470 @remarks Retained windows are only available on X platforms.
1471 */
328f5751 1472 virtual bool IsRetained() const;
23324ae1
FM
1473
1474 /**
1475 Return whether a scrollbar is always shown.
3c4f71cc 1476
7c913512 1477 @param orient
4cc4bfaf 1478 Orientation to check, either wxHORIZONTAL or wxVERTICAL.
3c4f71cc 1479
4cc4bfaf 1480 @see AlwaysShowScrollbars()
23324ae1
FM
1481 */
1482 bool IsScrollbarAlwaysShown(int orient);
1483
1484 /**
1485 Returns @true if the window is shown, @false if it has been hidden.
3c4f71cc 1486
4cc4bfaf 1487 @see IsShownOnScreen()
23324ae1 1488 */
328f5751 1489 virtual bool IsShown() const;
23324ae1
FM
1490
1491 /**
1492 Returns @true if the window is physically visible on the screen, i.e. it
1493 is shown and all its parents up to the toplevel window are shown as well.
3c4f71cc 1494
4cc4bfaf 1495 @see IsShown()
23324ae1 1496 */
328f5751 1497 virtual bool IsShownOnScreen() const;
23324ae1
FM
1498
1499 /**
1500 Returns @true if this window is intrinsically enabled, @false otherwise,
e25cd775 1501 i.e. if @ref Enable() Enable(@false) had been called. This method is
7c913512 1502 mostly used for wxWidgets itself, user code should normally use
23324ae1
FM
1503 IsEnabled() instead.
1504 */
328f5751 1505 bool IsThisEnabled() const;
23324ae1
FM
1506
1507 /**
1508 Returns @true if the given window is a top-level one. Currently all frames and
1509 dialogs are considered to be top-level windows (even if they have a parent
1510 window).
1511 */
328f5751 1512 bool IsTopLevel() const;
23324ae1
FM
1513
1514 /**
1515 Invokes the constraint-based layout algorithm or the sizer-based algorithm
1516 for this window.
cded6aa1
FM
1517
1518 See SetAutoLayout(): when auto layout is on, this function gets called automatically
1519 when the window is resized.
1520
1521 @see @ref overview_windowsizing
23324ae1
FM
1522 */
1523 void Layout();
1524
23324ae1
FM
1525 /**
1526 Lowers the window to the bottom of the window hierarchy (Z-order).
3c4f71cc 1527
4cc4bfaf 1528 @see Raise()
23324ae1
FM
1529 */
1530 void Lower();
1531
1532 /**
1533 Disables all other windows in the application so that
1534 the user can only interact with this window.
3c4f71cc 1535
7c913512 1536 @param flag
4cc4bfaf
FM
1537 If @true, this call disables all other windows in the application so that
1538 the user can only interact with this window. If @false, the effect is
e25cd775 1539 reversed.
23324ae1
FM
1540 */
1541 virtual void MakeModal(bool flag);
1542
23324ae1
FM
1543 /**
1544 Moves the window to the given position.
3c4f71cc 1545
7c913512 1546 @param x
4cc4bfaf 1547 Required x position.
7c913512 1548 @param y
4cc4bfaf 1549 Required y position.
3c4f71cc 1550
23324ae1 1551 @remarks Implementations of SetSize can also implicitly implement the
e25cd775
FM
1552 Move() function, which is defined in the base wxWindow class as the call:
1553 @code
1554 SetSize(x, y, wxDefaultCoord, wxDefaultCoord, wxSIZE_USE_EXISTING);
1555 @endcode
3c4f71cc 1556
4cc4bfaf 1557 @see SetSize()
23324ae1
FM
1558 */
1559 void Move(int x, int y);
e25cd775
FM
1560
1561 /**
1562 Moves the window to the given position.
1563
1564 @param pt
1565 wxPoint object representing the position.
1566
1567 @remarks Implementations of SetSize() can also implicitly implement the
1568 Move() function, which is defined in the base wxWindow class as the call:
1569 @code
1570 SetSize(x, y, wxDefaultCoord, wxDefaultCoord, wxSIZE_USE_EXISTING);
1571 @endcode
1572
1573 @see SetSize()
1574 */
7c913512 1575 void Move(const wxPoint& pt);
23324ae1
FM
1576
1577 /**
1578 Moves this window in the tab navigation order after the specified @e win.
1579 This means that when the user presses @c TAB key on that other window,
1580 the focus switches to this window.
e25cd775 1581
23324ae1
FM
1582 Default tab order is the same as creation order, this function and
1583 MoveBeforeInTabOrder() allow to change
1584 it after creating all the windows.
3c4f71cc 1585
7c913512 1586 @param win
4cc4bfaf
FM
1587 A sibling of this window which should precede it in tab order,
1588 must not be @NULL
23324ae1 1589 */
4cc4bfaf 1590 void MoveAfterInTabOrder(wxWindow* win);
23324ae1
FM
1591
1592 /**
e25cd775
FM
1593 Same as MoveAfterInTabOrder() except that it inserts this window just
1594 before @a win instead of putting it right after it.
23324ae1 1595 */
4cc4bfaf 1596 void MoveBeforeInTabOrder(wxWindow* win);
23324ae1
FM
1597
1598 /**
e25cd775
FM
1599 Performs a keyboard navigation action starting from this window.
1600 This method is equivalent to calling NavigateIn() method on the
23324ae1 1601 parent window.
3c4f71cc 1602
7c913512 1603 @param flags
4cc4bfaf 1604 A combination of wxNavigationKeyEvent::IsForward and
e25cd775 1605 wxNavigationKeyEvent::WinChange.
3c4f71cc 1606
d29a9a8a 1607 @return Returns @true if the focus was moved to another window or @false
e25cd775 1608 if nothing changed.
3c4f71cc 1609
23324ae1 1610 @remarks You may wish to call this from a text control custom keypress
4cc4bfaf
FM
1611 handler to do the default navigation behaviour for the
1612 tab key, since the standard default behaviour for a
1613 multiline text control with the wxTE_PROCESS_TAB style
1614 is to insert a tab and not navigate to the next
1615 control. See also wxNavigationKeyEvent and
1616 HandleAsNavigationKey.
23324ae1
FM
1617 */
1618 bool Navigate(int flags = wxNavigationKeyEvent::IsForward);
1619
1620 /**
1621 Performs a keyboard navigation action inside this window.
23324ae1
FM
1622 See Navigate() for more information.
1623 */
1624 bool NavigateIn(int flags = wxNavigationKeyEvent::IsForward);
1625
1626 /**
e25cd775
FM
1627 Create a new ID or range of IDs that are not currently in use.
1628 The IDs will be reserved until assigned to a wxWindow ID
23324ae1 1629 or unreserved with UnreserveControlId().
e25cd775
FM
1630
1631 See @ref overview_windowids for more information.
3c4f71cc 1632
7c913512 1633 @param count
4cc4bfaf 1634 The number of sequential IDs to reserve.
3c4f71cc 1635
d29a9a8a 1636 @return Returns the ID or the first ID of the range, or wxID_NONE if the
e25cd775 1637 specified number of identifiers couldn't be allocated.
3c4f71cc 1638
e25cd775
FM
1639 @see UnreserveControlId(), wxIdManager,
1640 @ref overview_windowids
23324ae1
FM
1641 */
1642 static wxWindowID NewControlId(int count = 1);
1643
1644 /**
1645 This virtual function is normally only used internally, but
1646 sometimes an application may need it to implement functionality
1647 that should not be disabled by an application defining an OnIdle
1648 handler in a derived class.
e25cd775 1649
23324ae1
FM
1650 This function may be used to do delayed painting, for example,
1651 and most implementations call UpdateWindowUI()
1652 in order to send update events to the window in idle time.
1653 */
1654 virtual void OnInternalIdle();
1655
1656 /**
592584e4
VS
1657 Same as #ScrollLines (-1).
1658 */
1659 bool LineUp();
1660
1661 /**
1662 Same as #ScrollLines (1).
23324ae1 1663 */
592584e4 1664 bool LineDown();
23324ae1 1665
592584e4
VS
1666 /**
1667 Same as #ScrollPages (-1).
1668 */
1669 bool PageUp();
23324ae1
FM
1670
1671 /**
592584e4 1672 Same as #ScrollPages (1).
23324ae1 1673 */
592584e4 1674 bool PageDown();
23324ae1
FM
1675
1676
1677 /**
1678 Removes and returns the top-most event handler on the event handler stack.
3c4f71cc 1679
7c913512 1680 @param deleteHandler
e25cd775
FM
1681 If this is @true, the handler will be deleted after it is removed.
1682 The default value is @false.
3c4f71cc 1683
4cc4bfaf
FM
1684 @see SetEventHandler(), GetEventHandler(),
1685 PushEventHandler(), wxEvtHandler::ProcessEvent, wxEvtHandler
23324ae1 1686 */
328f5751 1687 wxEvtHandler* PopEventHandler(bool deleteHandler = false) const;
23324ae1
FM
1688
1689 //@{
1690 /**
1691 Pops up the given menu at the specified coordinates, relative to this
e25cd775
FM
1692 window, and returns control when the user has dismissed the menu.
1693
1694 If a menu item is selected, the corresponding menu event is generated and will be
23324ae1
FM
1695 processed as usually. If the coordinates are not specified, current mouse
1696 cursor position is used.
3c4f71cc 1697
7c913512 1698 @param menu
4cc4bfaf 1699 Menu to pop up.
7c913512 1700 @param pos
4cc4bfaf 1701 The position where the menu will appear.
7c913512 1702 @param x
4cc4bfaf 1703 Required x position for the menu to appear.
7c913512 1704 @param y
4cc4bfaf 1705 Required y position for the menu to appear.
3c4f71cc 1706
23324ae1 1707 @remarks Just before the menu is popped up, wxMenu::UpdateUI is called to
4cc4bfaf
FM
1708 ensure that the menu items are in the correct state.
1709 The menu does not get deleted by the window.
e25cd775
FM
1710 It is recommended to not explicitly specify coordinates when
1711 calling PopupMenu in response to mouse click, because some of
1712 the ports (namely, wxGTK) can do a better job of positioning
1713 the menu in that case.
3c4f71cc 1714
4cc4bfaf 1715 @see wxMenu
23324ae1
FM
1716 */
1717 bool PopupMenu(wxMenu* menu,
1718 const wxPoint& pos = wxDefaultPosition);
7c913512 1719 bool PopupMenu(wxMenu* menu, int x, int y);
23324ae1
FM
1720 //@}
1721
ecdc1183
VZ
1722 /**
1723 Posts a size event to the window.
1724
1725 This is the same as SendSizeEvent() with @c wxSEND_EVENT_POST argument.
1726 */
1727 void PostSizeEvent();
1728
1729 /**
1730 Posts a size event to the parent of this window.
1731
1732 This is the same as SendSizeEventToParent() with @c wxSEND_EVENT_POST
1733 argument.
1734 */
1735 void PostSizeEventToParent();
1736
23324ae1
FM
1737 /**
1738 Pushes this event handler onto the event stack for the window.
3c4f71cc 1739
7c913512 1740 @param handler
4cc4bfaf 1741 Specifies the handler to be pushed.
3c4f71cc 1742
23324ae1 1743 @remarks An event handler is an object that is capable of processing the
4cc4bfaf
FM
1744 events sent to a window. By default, the window is its
1745 own event handler, but an application may wish to
1746 substitute another, for example to allow central
1747 implementation of event-handling for a variety of
1748 different window classes.
e25cd775
FM
1749 wxWindow::PushEventHandler allows an application to set up a
1750 chain of event handlers, where an event not handled by one event
1751 handler is handed to the next one in the chain.
1752 Use wxWindow::PopEventHandler to remove the event handler.
3c4f71cc 1753
4cc4bfaf
FM
1754 @see SetEventHandler(), GetEventHandler(),
1755 PopEventHandler(), wxEvtHandler::ProcessEvent, wxEvtHandler
23324ae1
FM
1756 */
1757 void PushEventHandler(wxEvtHandler* handler);
1758
1759 /**
1760 Raises the window to the top of the window hierarchy (Z-order).
23324ae1 1761 In current version of wxWidgets this works both for managed and child windows.
3c4f71cc 1762
4cc4bfaf 1763 @see Lower()
23324ae1
FM
1764 */
1765 void Raise();
1766
1767 /**
1768 Causes this window, and all of its children recursively (except under wxGTK1
1769 where this is not implemented), to be repainted. Note that repainting doesn't
1770 happen immediately but only during the next event loop iteration, if you need
e25cd775 1771 to update the window immediately you should use Update() instead.
3c4f71cc 1772
7c913512 1773 @param eraseBackground
e25cd775 1774 If @true, the background will be erased.
7c913512 1775 @param rect
e25cd775 1776 If non-@NULL, only the given rectangle will be treated as damaged.
3c4f71cc 1777
4cc4bfaf 1778 @see RefreshRect()
23324ae1 1779 */
4cc4bfaf
FM
1780 virtual void Refresh(bool eraseBackground = true,
1781 const wxRect* rect = NULL);
23324ae1
FM
1782
1783 /**
1784 Redraws the contents of the given rectangle: only the area inside it will be
1785 repainted.
e25cd775
FM
1786
1787 This is the same as Refresh() but has a nicer syntax as it can be called
1788 with a temporary wxRect object as argument like this @c RefreshRect(wxRect(x, y, w, h)).
23324ae1 1789 */
4cc4bfaf 1790 void RefreshRect(const wxRect& rect, bool eraseBackground = true);
23324ae1
FM
1791
1792 /**
1793 Registers a system wide hotkey. Every time the user presses the hotkey
e25cd775
FM
1794 registered here, this window will receive a hotkey event.
1795
1796 It will receive the event even if the application is in the background
1797 and does not have the input focus because the user is working with some
1798 other application.
3c4f71cc 1799
7c913512 1800 @param hotkeyId
4cc4bfaf 1801 Numeric identifier of the hotkey. For applications this must be between 0
e25cd775
FM
1802 and 0xBFFF. If this function is called from a shared DLL, it must be a
1803 system wide unique identifier between 0xC000 and 0xFFFF.
4cc4bfaf 1804 This is a MSW specific detail.
7c913512 1805 @param modifiers
4cc4bfaf
FM
1806 A bitwise combination of wxMOD_SHIFT, wxMOD_CONTROL, wxMOD_ALT
1807 or wxMOD_WIN specifying the modifier keys that have to be pressed along
e25cd775 1808 with the key.
7c913512 1809 @param virtualKeyCode
4cc4bfaf 1810 The virtual key code of the hotkey.
3c4f71cc 1811
d29a9a8a 1812 @return @true if the hotkey was registered successfully. @false if some
4cc4bfaf
FM
1813 other application already registered a hotkey with this
1814 modifier/virtualKeyCode combination.
3c4f71cc 1815
23324ae1 1816 @remarks Use EVT_HOTKEY(hotkeyId, fnc) in the event table to capture the
4cc4bfaf
FM
1817 event. This function is currently only implemented
1818 under Windows. It is used in the Windows CE port for
1819 detecting hardware button presses.
3c4f71cc 1820
4cc4bfaf 1821 @see UnregisterHotKey()
23324ae1
FM
1822 */
1823 bool RegisterHotKey(int hotkeyId, int modifiers,
1824 int virtualKeyCode);
1825
1826 /**
1827 Releases mouse input captured with CaptureMouse().
3c4f71cc 1828
4cc4bfaf
FM
1829 @see CaptureMouse(), HasCapture(), ReleaseMouse(),
1830 wxMouseCaptureLostEvent, wxMouseCaptureChangedEvent
23324ae1
FM
1831 */
1832 virtual void ReleaseMouse();
1833
1834 /**
e25cd775
FM
1835 Removes a child window.
1836
1837 This is called automatically by window deletion functions so should not
1838 be required by the application programmer.
23324ae1
FM
1839 Notice that this function is mostly internal to wxWidgets and shouldn't be
1840 called by the user code.
3c4f71cc 1841
7c913512 1842 @param child
4cc4bfaf 1843 Child window to remove.
23324ae1
FM
1844 */
1845 virtual void RemoveChild(wxWindow* child);
1846
1847 /**
e25cd775
FM
1848 Find the given @a handler in the windows event handler chain and remove
1849 (but not delete) it from it.
3c4f71cc 1850
7c913512 1851 @param handler
4cc4bfaf
FM
1852 The event handler to remove, must be non-@NULL and
1853 must be present in this windows event handlers chain
3c4f71cc 1854
d29a9a8a 1855 @return Returns @true if it was found and @false otherwise (this also
e25cd775
FM
1856 results in an assert failure so this function should
1857 only be called when the handler is supposed to be there).
3c4f71cc 1858
4cc4bfaf 1859 @see PushEventHandler(), PopEventHandler()
23324ae1 1860 */
4cc4bfaf 1861 bool RemoveEventHandler(wxEvtHandler* handler);
23324ae1
FM
1862
1863 /**
1864 Reparents the window, i.e the window will be removed from its
1865 current parent window (e.g. a non-standard toolbar in a wxFrame)
1866 and then re-inserted into another.
3c4f71cc 1867
7c913512 1868 @param newParent
4cc4bfaf 1869 New parent.
23324ae1
FM
1870 */
1871 virtual bool Reparent(wxWindow* newParent);
1872
1873 //@{
1874 /**
1875 Converts from screen to client window coordinates.
3c4f71cc 1876
7c913512 1877 @param x
4cc4bfaf 1878 Stores the screen x coordinate and receives the client x coordinate.
7c913512 1879 @param y
4cc4bfaf 1880 Stores the screen x coordinate and receives the client x coordinate.
7c913512 1881 @param pt
4cc4bfaf 1882 The screen position for the second form of the function.
23324ae1 1883 */
328f5751 1884 virtual void ScreenToClient(int* x, int* y) const;
e25cd775 1885 virtual wxPoint ScreenToClient(const wxPoint& pt) const;
23324ae1
FM
1886 //@}
1887
1888 /**
4cc4bfaf 1889 Scrolls the window by the given number of lines down (if @a lines is
23324ae1 1890 positive) or up.
3c4f71cc 1891
d29a9a8a 1892 @return Returns @true if the window was scrolled, @false if it was already
e25cd775 1893 on top/bottom and nothing was done.
3c4f71cc 1894
23324ae1 1895 @remarks This function is currently only implemented under MSW and
f09b5681
BP
1896 wxTextCtrl under wxGTK (it also works for wxScrolled classes
1897 under all platforms).
3c4f71cc 1898
4cc4bfaf 1899 @see ScrollPages()
23324ae1
FM
1900 */
1901 virtual bool ScrollLines(int lines);
1902
1903 /**
4cc4bfaf 1904 Scrolls the window by the given number of pages down (if @a pages is
23324ae1 1905 positive) or up.
3c4f71cc 1906
d29a9a8a 1907 @return Returns @true if the window was scrolled, @false if it was already
e25cd775 1908 on top/bottom and nothing was done.
3c4f71cc 1909
23324ae1 1910 @remarks This function is currently only implemented under MSW and wxGTK.
3c4f71cc 1911
4cc4bfaf 1912 @see ScrollLines()
23324ae1
FM
1913 */
1914 virtual bool ScrollPages(int pages);
1915
1916 /**
1917 Physically scrolls the pixels in the window and move child windows accordingly.
3c4f71cc 1918
7c913512 1919 @param dx
4cc4bfaf 1920 Amount to scroll horizontally.
7c913512 1921 @param dy
4cc4bfaf 1922 Amount to scroll vertically.
7c913512 1923 @param rect
4cc4bfaf
FM
1924 Rectangle to scroll, if it is @NULL, the whole window is
1925 scrolled (this is always the case under wxGTK which doesn't support this
1926 parameter)
3c4f71cc 1927
f09b5681
BP
1928 @remarks Note that you can often use wxScrolled instead of using this
1929 function directly.
23324ae1
FM
1930 */
1931 virtual void ScrollWindow(int dx, int dy,
4cc4bfaf 1932 const wxRect* rect = NULL);
23324ae1 1933
0dba08dd
VZ
1934 /**
1935 This function sends a dummy @ref overview_wxsizeevent "size event" to
1936 the window allowing it to re-layout its children positions.
1937
1938 It is sometimes useful to call this function after adding or deleting a
1939 children after the frame creation or if a child size changes. Note that
1940 if the frame is using either sizers or constraints for the children
1941 layout, it is enough to call wxWindow::Layout() directly and this
1942 function should not be used in this case.
ecdc1183
VZ
1943
1944 If @a flags includes @c wxSEND_EVENT_POST value, this function posts
1945 the event, i.e. schedules it for later processing, instead of
1946 dispatching it directly. You can also use PostSizeEvent() as a more
1947 readable equivalent of calling this function with this flag.
1948
1949 @param flags
1950 May include @c wxSEND_EVENT_POST. Default value is 0.
0dba08dd 1951 */
ecdc1183 1952 void SendSizeEvent(int flags = 0);
0dba08dd
VZ
1953
1954 /**
1955 Safe wrapper for GetParent()->SendSizeEvent().
1956
1957 This function simply checks that the window has a valid parent which is
1958 not in process of being deleted and calls SendSizeEvent() on it. It is
1959 used internally by windows such as toolbars changes to whose state
1960 should result in parent re-layout (e.g. when a toolbar is added to the
1961 top of the window, all the other windows must be shifted down).
ecdc1183
VZ
1962
1963 @see PostSizeEventToParent()
1964
1965 @param flags
1966 See description of this parameter in SendSizeEvent() documentation.
0dba08dd 1967 */
ecdc1183 1968 void SendSizeEventToParent(int flags = 0);
0dba08dd 1969
23324ae1
FM
1970 /**
1971 Sets the accelerator table for this window. See wxAcceleratorTable.
1972 */
1973 virtual void SetAcceleratorTable(const wxAcceleratorTable& accel);
1974
1975 /**
1976 Sets the accessible for this window. Any existing accessible for this window
1977 will be deleted first, if not identical to @e accessible.
23324ae1
FM
1978 See also wxAccessible.
1979 */
1980 void SetAccessible(wxAccessible* accessible);
1981
1982 /**
e25cd775
FM
1983 Determines whether the Layout() function will be called automatically
1984 when the window is resized. Please note that this only happens for the
1985 windows usually used to contain children, namely wxPanel and wxTopLevelWindow
23324ae1 1986 (and the classes deriving from them).
e25cd775
FM
1987
1988 This method is called implicitly by SetSizer() but if you use SetConstraints()
1989 you should call it manually or otherwise the window layout won't be correctly
1990 updated when its size changes.
3c4f71cc 1991
7c913512 1992 @param autoLayout
4cc4bfaf
FM
1993 Set this to @true if you wish the Layout function to be
1994 called automatically when the window is resized.
3c4f71cc 1995
4cc4bfaf 1996 @see SetConstraints()
23324ae1
FM
1997 */
1998 void SetAutoLayout(bool autoLayout);
1999
2000 /**
2001 Sets the background colour of the window.
e25cd775
FM
2002 Please see InheritAttributes() for explanation of the difference between
2003 this method and SetOwnBackgroundColour().
3c4f71cc 2004
7c913512 2005 @param colour
4cc4bfaf 2006 The colour to be used as the background colour, pass
e25cd775 2007 wxNullColour to reset to the default colour.
3c4f71cc 2008
23324ae1 2009 @remarks The background colour is usually painted by the default
4cc4bfaf
FM
2010 wxEraseEvent event handler function under Windows and
2011 automatically under GTK.
e25cd775
FM
2012 Note that setting the background colour does not cause an
2013 immediate refresh, so you may wish to call wxWindow::ClearBackground
2014 or wxWindow::Refresh after calling this function.
2015 Using this function will disable attempts to use themes for
2016 this window, if the system supports them. Use with care since
2017 usually the themes represent the appearance chosen by the user
2018 to be used for all applications on the system.
3c4f71cc 2019
4cc4bfaf
FM
2020 @see GetBackgroundColour(), SetForegroundColour(),
2021 GetForegroundColour(), ClearBackground(),
2022 Refresh(), wxEraseEvent
23324ae1
FM
2023 */
2024 virtual bool SetBackgroundColour(const wxColour& colour);
2025
2026 /**
e25cd775
FM
2027 Sets the background style of the window. see GetBackgroundStyle() for
2028 the description of the possible style values.
3c4f71cc 2029
4cc4bfaf
FM
2030 @see SetBackgroundColour(), GetForegroundColour(),
2031 SetTransparent()
23324ae1
FM
2032 */
2033 virtual void SetBackgroundStyle(wxBackgroundStyle style);
2034
2035 /**
2036 This method is only implemented by ports which have support for
e25cd775
FM
2037 native TAB traversal (such as GTK+ 2.0).
2038
2039 It is called by wxWidgets' container control code to give the native
2040 system a hint when doing TAB traversal. A call to this does not disable
2041 or change the effect of programmatically calling SetFocus().
3c4f71cc 2042
4cc4bfaf 2043 @see wxFocusEvent, wxPanel::SetFocus, wxPanel::SetFocusIgnoringChildren
23324ae1
FM
2044 */
2045 virtual void SetCanFocus(bool canFocus);
2046
2047 /**
e54c96f1 2048 Sets the caret() associated with the window.
23324ae1 2049 */
328f5751 2050 void SetCaret(wxCaret* caret) const;
23324ae1
FM
2051
2052 //@{
2053 /**
e25cd775
FM
2054 This sets the size of the window client area in pixels.
2055
2056 Using this function to size a window tends to be more device-independent
2057 than SetSize(), since the application need not worry about what dimensions
2058 the border or title bar have when trying to fit the window around panel
2059 items, for example.
3c4f71cc 2060
7c913512 2061 @param width
4cc4bfaf 2062 The required client area width.
7c913512 2063 @param height
4cc4bfaf 2064 The required client area height.
7c913512 2065 @param size
4cc4bfaf 2066 The required client size.
23324ae1
FM
2067 */
2068 virtual void SetClientSize(int width, int height);
7c913512 2069 virtual void SetClientSize(const wxSize& size);
23324ae1
FM
2070 //@}
2071
2072 /**
2073 Sets the window to have the given layout constraints. The window
2074 will then own the object, and will take care of its deletion.
2075 If an existing layout constraints object is already owned by the
2076 window, it will be deleted.
3c4f71cc 2077
7c913512 2078 @param constraints
4cc4bfaf
FM
2079 The constraints to set. Pass @NULL to disassociate and delete the window's
2080 constraints.
3c4f71cc 2081
23324ae1 2082 @remarks You must call SetAutoLayout() to tell a window to use
4cc4bfaf
FM
2083 the constraints automatically in OnSize; otherwise, you
2084 must override OnSize and call Layout() explicitly. When
2085 setting both a wxLayoutConstraints and a wxSizer, only
2086 the sizer will have effect.
23324ae1
FM
2087 */
2088 void SetConstraints(wxLayoutConstraints* constraints);
2089
2090 /**
e25cd775
FM
2091 This normally does not need to be called by user code.
2092 It is called when a window is added to a sizer, and is used so the window
2093 can remove itself from the sizer when it is destroyed.
23324ae1
FM
2094 */
2095 void SetContainingSizer(wxSizer* sizer);
2096
2097 /**
2098 Sets the window's cursor. Notice that the window cursor also sets it for the
2099 children of the window implicitly.
e25cd775 2100
4cc4bfaf 2101 The @a cursor may be @c wxNullCursor in which case the window cursor will
23324ae1 2102 be reset back to default.
3c4f71cc 2103
7c913512 2104 @param cursor
4cc4bfaf 2105 Specifies the cursor that the window should normally display.
3c4f71cc 2106
4cc4bfaf 2107 @see ::wxSetCursor, wxCursor
23324ae1
FM
2108 */
2109 virtual void SetCursor(const wxCursor& cursor);
2110
2111 /**
2112 Associates a drop target with this window.
23324ae1 2113 If the window already has a drop target, it is deleted.
3c4f71cc 2114
75b00cf8 2115 @see GetDropTarget(), @ref overview_dnd
23324ae1
FM
2116 */
2117 void SetDropTarget(wxDropTarget* target);
2118
2119 /**
2120 Sets the event handler for this window.
3c4f71cc 2121
7c913512 2122 @param handler
4cc4bfaf 2123 Specifies the handler to be set.
3c4f71cc 2124
23324ae1 2125 @remarks An event handler is an object that is capable of processing the
4cc4bfaf
FM
2126 events sent to a window. By default, the window is its
2127 own event handler, but an application may wish to
2128 substitute another, for example to allow central
2129 implementation of event-handling for a variety of
2130 different window classes.
e25cd775
FM
2131 It is usually better to use wxWindow::PushEventHandler since
2132 this sets up a chain of event handlers, where an event not
2133 handled by one event handler is handed to the next one in the chain.
3c4f71cc 2134
4cc4bfaf
FM
2135 @see GetEventHandler(), PushEventHandler(),
2136 PopEventHandler(), wxEvtHandler::ProcessEvent, wxEvtHandler
23324ae1
FM
2137 */
2138 void SetEventHandler(wxEvtHandler* handler);
2139
2140 /**
e25cd775
FM
2141 Sets the extra style bits for the window.
2142 The currently defined extra style bits are reported in the class
2143 description.
23324ae1
FM
2144 */
2145 void SetExtraStyle(long exStyle);
2146
2147 /**
2148 This sets the window to receive keyboard input.
3c4f71cc 2149
4cc4bfaf
FM
2150 @see HasFocus(), wxFocusEvent, wxPanel::SetFocus,
2151 wxPanel::SetFocusIgnoringChildren
23324ae1
FM
2152 */
2153 virtual void SetFocus();
2154
2155 /**
2156 This function is called by wxWidgets keyboard navigation code when the user
2157 gives the focus to this window from keyboard (e.g. using @c TAB key).
e25cd775 2158
23324ae1
FM
2159 By default this method simply calls SetFocus() but
2160 can be overridden to do something in addition to this in the derived classes.
2161 */
2162 virtual void SetFocusFromKbd();
2163
2164 /**
2165 Sets the font for this window. This function should not be called for the
2166 parent window if you don't want its font to be inherited by its children,
e25cd775 2167 use SetOwnFont() instead in this case and see InheritAttributes() for more
23324ae1 2168 explanations.
e25cd775 2169
7c913512 2170 Please notice that the given font is not automatically used for
23324ae1
FM
2171 wxPaintDC objects associated with this window, you need to
2172 call wxDC::SetFont too. However this font is used by
7c913512 2173 any standard controls for drawing their text as well as by
23324ae1 2174 GetTextExtent().
3c4f71cc 2175
7c913512 2176 @param font
4cc4bfaf
FM
2177 Font to associate with this window, pass
2178 wxNullFont to reset to the default font.
3c4f71cc 2179
d29a9a8a 2180 @return @true if the want was really changed, @false if it was already set
e25cd775 2181 to this font and so nothing was done.
3c4f71cc 2182
4cc4bfaf 2183 @see GetFont(), InheritAttributes()
23324ae1
FM
2184 */
2185 bool SetFont(const wxFont& font);
2186
2187 /**
2188 Sets the foreground colour of the window.
e25cd775
FM
2189 Please see InheritAttributes() for explanation of the difference between
2190 this method and SetOwnForegroundColour().
3c4f71cc 2191
7c913512 2192 @param colour
4cc4bfaf 2193 The colour to be used as the foreground colour, pass
e25cd775 2194 wxNullColour to reset to the default colour.
3c4f71cc 2195
23324ae1 2196 @remarks The interpretation of foreground colour is open to
4cc4bfaf 2197 interpretation according to the window class; it may be
e25cd775 2198 the text colour or other colour, or it may not be used at all.
3c4f71cc 2199
4cc4bfaf
FM
2200 @see GetForegroundColour(), SetBackgroundColour(),
2201 GetBackgroundColour(), ShouldInheritColours()
23324ae1
FM
2202 */
2203 virtual void SetForegroundColour(const wxColour& colour);
2204
2205 /**
2206 Sets the help text to be used as context-sensitive help for this window.
23324ae1 2207 Note that the text is actually stored by the current wxHelpProvider
e25cd775 2208 implementation, and not in the window object itself.
3c4f71cc 2209
d155b6f4 2210 @see GetHelpText(), wxHelpProvider::AddHelp()
23324ae1
FM
2211 */
2212 virtual void SetHelpText(const wxString& helpText);
2213
2214 /**
2215 Sets the identifier of the window.
3c4f71cc 2216
23324ae1 2217 @remarks Each window has an integer identifier. If the application has
4cc4bfaf
FM
2218 not provided one, an identifier will be generated.
2219 Normally, the identifier should be provided on creation
2220 and should not be modified subsequently.
3c4f71cc 2221
e25cd775 2222 @see GetId(), @ref overview_windowids
23324ae1
FM
2223 */
2224 void SetId(int id);
2225
2226 /**
2227 Sets the initial window size if none is given (i.e. at least one of the
2228 components of the size passed to ctor/Create() is wxDefaultCoord).
2229 */
2230 virtual void SetInitialBestSize(const wxSize& size);
2231
2232 /**
2233 A @e smart SetSize that will fill in default size components with the
cded6aa1
FM
2234 window's @e best size values.
2235
2236 Also sets the window's minsize to the value passed in for use with sizers.
2237 This means that if a full or partial size is passed to this function then
2238 the sizers will use that size instead of the results of GetBestSize() to
2239 determine the minimum needs of the window for layout.
2240
23324ae1
FM
2241 Most controls will use this to set their initial size, and their min
2242 size to the passed in value (if any.)
3c4f71cc 2243
cded6aa1
FM
2244 @see SetSize(), GetBestSize(), GetEffectiveMinSize(),
2245 @ref overview_windowsizing
23324ae1
FM
2246 */
2247 void SetInitialSize(const wxSize& size = wxDefaultSize);
2248
2249 /**
2250 Sets the window's label.
3c4f71cc 2251
7c913512 2252 @param label
4cc4bfaf 2253 The window label.
3c4f71cc 2254
4cc4bfaf 2255 @see GetLabel()
23324ae1
FM
2256 */
2257 virtual void SetLabel(const wxString& label);
2258
2259 /**
2260 Sets the maximum client size of the window, to indicate to the sizer
2261 layout mechanism that this is the maximum possible size of its client area.
3c4f71cc 2262
4cc4bfaf 2263 @see SetMaxSize()
23324ae1
FM
2264 */
2265 void SetMaxClientSize(const wxSize& size);
2266
2267 /**
2268 Sets the maximum size of the window, to indicate to the sizer layout mechanism
2269 that this is the maximum possible size.
3c4f71cc 2270
4cc4bfaf 2271 @see SetMaxClientSize()
23324ae1
FM
2272 */
2273 void SetMaxSize(const wxSize& size);
2274
2275 /**
2276 Sets the minimum client size of the window, to indicate to the sizer
2277 layout mechanism that this is the minimum required size of window's client
5af86f4d
VZ
2278 area.
2279
2280 You may need to call this if you change the window size after
23324ae1 2281 construction and before adding to its parent sizer.
3c4f71cc 2282
5af86f4d
VZ
2283 Note, that just as with SetMinSize(), calling this method doesn't
2284 prevent the program from explicitly making the window smaller than the
2285 specified size.
2286
4cc4bfaf 2287 @see SetMinSize()
23324ae1
FM
2288 */
2289 void SetMinClientSize(const wxSize& size);
2290
2291 /**
5af86f4d
VZ
2292 Sets the minimum size of the window, to indicate to the sizer layout
2293 mechanism that this is the minimum required size.
2294
2295 You may need to call this if you change the window size after
2296 construction and before adding to its parent sizer.
2297
2298 Notice that calling this method doesn't prevent the program from making
2299 the window explicitly smaller than the specified size by calling
2300 SetSize(), it just ensures that it won't become smaller than this size
2301 during the automatic layout.
3c4f71cc 2302
4cc4bfaf 2303 @see SetMinClientSize()
23324ae1
FM
2304 */
2305 void SetMinSize(const wxSize& size);
2306
2307 /**
2308 Sets the window's name.
3c4f71cc 2309
7c913512 2310 @param name
4cc4bfaf 2311 A name to set for the window.
3c4f71cc 2312
4cc4bfaf 2313 @see GetName()
23324ae1
FM
2314 */
2315 virtual void SetName(const wxString& name);
2316
2317 /**
2318 Sets the background colour of the window but prevents it from being inherited
2319 by the children of this window.
3c4f71cc 2320
4cc4bfaf 2321 @see SetBackgroundColour(), InheritAttributes()
23324ae1
FM
2322 */
2323 void SetOwnBackgroundColour(const wxColour& colour);
2324
2325 /**
2326 Sets the font of the window but prevents it from being inherited by the
2327 children of this window.
3c4f71cc 2328
4cc4bfaf 2329 @see SetFont(), InheritAttributes()
23324ae1
FM
2330 */
2331 void SetOwnFont(const wxFont& font);
2332
2333 /**
2334 Sets the foreground colour of the window but prevents it from being inherited
2335 by the children of this window.
3c4f71cc 2336
4cc4bfaf 2337 @see SetForegroundColour(), InheritAttributes()
23324ae1
FM
2338 */
2339 void SetOwnForegroundColour(const wxColour& colour);
2340
2341 /**
e25cd775 2342 @deprecated use wxDC::SetPalette instead.
23324ae1
FM
2343 */
2344 virtual void SetPalette(wxPalette* palette);
2345
2346 /**
2347 Sets the position of one of the built-in scrollbars.
3c4f71cc 2348
7c913512 2349 @param orientation
e25cd775
FM
2350 Determines the scrollbar whose position is to be set.
2351 May be wxHORIZONTAL or wxVERTICAL.
7c913512 2352 @param pos
4cc4bfaf 2353 Position in scroll units.
7c913512 2354 @param refresh
4cc4bfaf 2355 @true to redraw the scrollbar, @false otherwise.
3c4f71cc 2356
23324ae1 2357 @remarks This function does not directly affect the contents of the
4cc4bfaf
FM
2358 window: it is up to the application to take note of
2359 scrollbar attributes and redraw contents accordingly.
3c4f71cc 2360
f09b5681
BP
2361 @see SetScrollbar(), GetScrollPos(), GetScrollThumb(), wxScrollBar,
2362 wxScrolled
23324ae1
FM
2363 */
2364 virtual void SetScrollPos(int orientation, int pos,
4cc4bfaf 2365 bool refresh = true);
23324ae1
FM
2366
2367 /**
2368 Sets the scrollbar properties of a built-in scrollbar.
3c4f71cc 2369
7c913512 2370 @param orientation
e25cd775
FM
2371 Determines the scrollbar whose page size is to be set.
2372 May be wxHORIZONTAL or wxVERTICAL.
7c913512 2373 @param position
4cc4bfaf 2374 The position of the scrollbar in scroll units.
7c913512 2375 @param thumbSize
4cc4bfaf 2376 The size of the thumb, or visible portion of the scrollbar, in scroll units.
7c913512 2377 @param range
4cc4bfaf 2378 The maximum position of the scrollbar.
7c913512 2379 @param refresh
4cc4bfaf 2380 @true to redraw the scrollbar, @false otherwise.
3c4f71cc 2381
23324ae1 2382 @remarks Let's say you wish to display 50 lines of text, using the same
4cc4bfaf
FM
2383 font. The window is sized so that you can only see 16
2384 lines at a time.
e25cd775
FM
2385 You would use:
2386 @code
2387 SetScrollbar(wxVERTICAL, 0, 16, 50);
2388 @endcode
2389 Note that with the window at this size, the thumb position can never
2390 go above 50 minus 16, or 34. You can determine how many lines are
2391 currently visible by dividing the current view size by the character
2392 height in pixels.
2393 When defining your own scrollbar behaviour, you will always need
2394 to recalculate the scrollbar settings when the window size changes.
2395 You could therefore put your scrollbar calculations and SetScrollbar
2396 call into a function named AdjustScrollbars, which can be called
2397 initially and also from your wxSizeEvent handler function.
3c4f71cc 2398
f09b5681 2399 @see @ref overview_scrolling, wxScrollBar, wxScrolled, wxScrollWinEvent
23324ae1
FM
2400 */
2401 virtual void SetScrollbar(int orientation, int position,
2402 int thumbSize,
2403 int range,
4cc4bfaf 2404 bool refresh = true);
23324ae1
FM
2405
2406 //@{
2407 /**
2408 Sets the size of the window in pixels.
3c4f71cc 2409
7c913512 2410 @param x
4cc4bfaf 2411 Required x position in pixels, or wxDefaultCoord to indicate that the
e25cd775 2412 existing value should be used.
7c913512 2413 @param y
4cc4bfaf 2414 Required y position in pixels, or wxDefaultCoord to indicate that the
e25cd775 2415 existing value should be used.
7c913512 2416 @param width
4cc4bfaf
FM
2417 Required width in pixels, or wxDefaultCoord to indicate that the existing
2418 value should be used.
7c913512 2419 @param height
4cc4bfaf 2420 Required height position in pixels, or wxDefaultCoord to indicate that the
e25cd775 2421 existing value should be used.
7c913512 2422 @param size
4cc4bfaf 2423 wxSize object for setting the size.
7c913512 2424 @param rect
4cc4bfaf 2425 wxRect object for setting the position and size.
7c913512 2426 @param sizeFlags
e25cd775
FM
2427 Indicates the interpretation of other parameters.
2428 It is a bit list of the following:
2429 - @c wxSIZE_AUTO_WIDTH: a wxDefaultCoord width value is taken to indicate
2430 a wxWidgets-supplied default width.
2431 - @c wxSIZE_AUTO_HEIGHT: a wxDefaultCoord height value is taken to indicate
2432 a wxWidgets-supplied default height.
2433 - @c wxSIZE_AUTO: wxDefaultCoord size values are taken to indicate
2434 a wxWidgets-supplied default size.
2435 - @c wxSIZE_USE_EXISTING: existing dimensions should be used
2436 if wxDefaultCoord values are supplied.
2437 - @c wxSIZE_ALLOW_MINUS_ONE: allow negative dimensions (i.e. value of
2438 wxDefaultCoord) to be interpreted as real
2439 dimensions, not default values.
2440 - @c wxSIZE_FORCE: normally, if the position and the size of the window are
2441 already the same as the parameters of this function,
2442 nothing is done. but with this flag a window resize may
2443 be forced even in this case (supported in wx 2.6.2 and
2444 later and only implemented for MSW and ignored elsewhere
2445 currently).
3c4f71cc 2446
23324ae1 2447 @remarks The second form is a convenience for calling the first form with
4cc4bfaf
FM
2448 default x and y parameters, and must be used with
2449 non-default width and height values.
e25cd775
FM
2450 The first form sets the position and optionally size, of the window.
2451 Parameters may be wxDefaultCoord to indicate either that a default
2452 should be supplied by wxWidgets, or that the current value of the
2453 dimension should be used.
3c4f71cc 2454
4cc4bfaf 2455 @see Move()
23324ae1
FM
2456 */
2457 virtual void SetSize(int x, int y, int width, int height,
2458 int sizeFlags = wxSIZE_AUTO);
7c913512
FM
2459 virtual void SetSize(const wxRect& rect);
2460 virtual void SetSize(int width, int height);
2461 virtual void SetSize(const wxSize& size);
23324ae1
FM
2462 //@}
2463
23324ae1 2464 /**
e25cd775
FM
2465 Sets the window to have the given layout sizer.
2466 The window will then own the object, and will take care of its deletion.
23324ae1
FM
2467 If an existing layout constraints object is already owned by the
2468 window, it will be deleted if the deleteOld parameter is @true.
e25cd775
FM
2469
2470 Note that this function will also call SetAutoLayout() implicitly with @true
4cc4bfaf 2471 parameter if the @a sizer is non-@NULL and @false otherwise.
3c4f71cc 2472
7c913512 2473 @param sizer
4cc4bfaf 2474 The sizer to set. Pass @NULL to disassociate and conditionally delete
75b00cf8 2475 the window's sizer. See below.
7c913512 2476 @param deleteOld
4cc4bfaf
FM
2477 If @true (the default), this will delete any pre-existing sizer.
2478 Pass @false if you wish to handle deleting the old sizer yourself.
e25cd775 2479
75b00cf8 2480 @remarks SetSizer enables and disables Layout automatically.
23324ae1 2481 */
4cc4bfaf 2482 void SetSizer(wxSizer* sizer, bool deleteOld = true);
23324ae1
FM
2483
2484 /**
e25cd775 2485 This method calls SetSizer() and then wxSizer::SetSizeHints which sets the initial
23324ae1
FM
2486 window size to the size needed to accommodate all sizer elements and sets the
2487 size hints which, if this window is a top level one, prevent the user from
2488 resizing it to be less than this minimial size.
2489 */
4cc4bfaf 2490 void SetSizerAndFit(wxSizer* sizer, bool deleteOld = true);
23324ae1
FM
2491
2492 /**
2493 This function tells a window if it should use the system's "theme" code
2494 to draw the windows' background instead if its own background drawing
2495 code. This does not always have any effect since the underlying platform
2496 obviously needs to support the notion of themes in user defined windows.
2497 One such platform is GTK+ where windows can have (very colourful) backgrounds
2498 defined by a user's selected theme.
e25cd775 2499
23324ae1
FM
2500 Dialogs, notebook pages and the status bar have this flag set to @true
2501 by default so that the default look and feel is simulated best.
2502 */
2503 virtual void SetThemeEnabled(bool enable);
2504
2505 //@{
2506 /**
2507 Attach a tooltip to the window.
410201d9
VZ
2508
2509 wxToolTip pointer can be @NULL in the overload taking the pointer,
2510 meaning to unset any existing tooltips, however UnsetToolTip() provides
2511 a more readable alternative to this operation.
2512
2513 Notice that these methods are always available, even if wxWidgets was
2514 compiled with @c wxUSE_TOOLTIPS set to 0, but don't do anything in this
2515 case.
2516
2517 @see GetToolTip(), wxToolTip
23324ae1
FM
2518 */
2519 void SetToolTip(const wxString& tip);
7c913512 2520 void SetToolTip(wxToolTip* tip);
23324ae1
FM
2521 //@}
2522
2523 /**
2524 Set the transparency of the window. If the system supports transparent windows,
2525 returns @true, otherwise returns @false and the window remains fully opaque.
2526 See also CanSetTransparent().
e25cd775 2527
4cc4bfaf 2528 The parameter @a alpha is in the range 0..255 where 0 corresponds to a
23324ae1 2529 fully transparent window and 255 to the fully opaque one. The constants
e25cd775 2530 @c wxIMAGE_ALPHA_TRANSPARENT and @c wxIMAGE_ALPHA_OPAQUE can be used.
23324ae1
FM
2531 */
2532 bool SetTransparent(wxByte alpha);
2533
2534 /**
2535 Deletes the current validator (if any) and sets the window validator, having
e25cd775 2536 called wxValidator::Clone to create a new validator of this type.
23324ae1
FM
2537 */
2538 virtual void SetValidator(const wxValidator& validator);
2539
2540 //@{
2541 /**
2542 Sets the virtual size of the window in pixels.
2543 */
2544 void SetVirtualSize(int width, int height);
7c913512 2545 void SetVirtualSize(const wxSize& size);
23324ae1
FM
2546 //@}
2547
23324ae1
FM
2548 /**
2549 Identical to SetWindowStyleFlag().
2550 */
2551 void SetWindowStyle(long style);
2552
2553 /**
2554 Sets the style of the window. Please note that some styles cannot be changed
e25cd775
FM
2555 after the window creation and that Refresh() might need to be be called
2556 after changing the others for the change to take place immediately.
2557
23324ae1 2558 See @ref overview_windowstyles "Window styles" for more information about flags.
3c4f71cc 2559
4cc4bfaf 2560 @see GetWindowStyleFlag()
23324ae1
FM
2561 */
2562 virtual void SetWindowStyleFlag(long style);
2563
2564 /**
2565 This function can be called under all platforms but only does anything under
2566 Mac OS X 10.3+ currently. Under this system, each of the standard control can
e25cd775 2567 exist in several sizes which correspond to the elements of wxWindowVariant enum.
3c4f71cc 2568
23324ae1
FM
2569 By default the controls use the normal size, of course, but this function can
2570 be used to change this.
2571 */
2572 void SetWindowVariant(wxWindowVariant variant);
2573
2574 /**
2575 Return @true from here to allow the colours of this window to be changed by
e25cd775
FM
2576 InheritAttributes(), returning @false forbids inheriting them from the parent window.
2577
23324ae1
FM
2578 The base class version returns @false, but this method is overridden in
2579 wxControl where it returns @true.
2580 */
2581 virtual bool ShouldInheritColours();
2582
2583 /**
2584 Shows or hides the window. You may need to call Raise()
2585 for a top level window if you want to bring it to top, although this is not
2586 needed if Show() is called immediately after the frame creation.
3c4f71cc 2587
7c913512 2588 @param show
4cc4bfaf 2589 If @true displays the window. Otherwise, hides it.
3c4f71cc 2590
d29a9a8a 2591 @return @true if the window has been shown or hidden or @false if nothing
4cc4bfaf 2592 was done because it already was in the requested state.
3c4f71cc 2593
d317fdeb 2594 @see IsShown(), Hide(), wxRadioBox::Show, wxShowEvent.
23324ae1 2595 */
4cc4bfaf 2596 virtual bool Show(bool show = true);
23324ae1
FM
2597
2598 /**
eed04c99
VS
2599 This function shows a window, like Show(), but using a special visual
2600 effect if possible.
3c4f71cc 2601
eed04c99
VS
2602 @param effect
2603 The effect to use.
3c4f71cc 2604
eed04c99
VS
2605 @param timeout
2606 The @a timeout parameter specifies the time of the animation, in
2607 milliseconds. If the default value of 0 is used, the default
2608 animation time for the current platform is used.
3c4f71cc 2609
eed04c99
VS
2610 @note Currently this function is only implemented in wxMSW and does the
2611 same thing as Show() in the other ports.
3c4f71cc 2612
1e24c2af 2613 @since 2.9.0
3c4f71cc 2614
4cc4bfaf 2615 @see HideWithEffect()
23324ae1
FM
2616 */
2617 virtual bool ShowWithEffect(wxShowEffect effect,
eed04c99 2618 unsigned timeout = 0);
23324ae1
FM
2619
2620 /**
a7c01bb1
VS
2621 Reenables window updating after a previous call to Freeze().
2622
2623 To really thaw the control, it must be called exactly the same number
2624 of times as Freeze().
2625
2626 If the window has any children, they are recursively thawn too.
3c4f71cc 2627
a7c01bb1 2628 @see wxWindowUpdateLocker, Freeze(), IsFrozen()
23324ae1
FM
2629 */
2630 virtual void Thaw();
2631
2632 /**
4cc4bfaf 2633 Turns the given @a flag on if it's currently turned off and vice versa.
23324ae1
FM
2634 This function cannot be used if the value of the flag is 0 (which is often
2635 the case for default flags).
e25cd775 2636
23324ae1
FM
2637 Also, please notice that not all styles can be changed after the control
2638 creation.
3c4f71cc 2639
d29a9a8a 2640 @return Returns @true if the style was turned on by this function, @false
4cc4bfaf 2641 if it was switched off.
3c4f71cc 2642
4cc4bfaf 2643 @see SetWindowStyleFlag(), HasFlag()
23324ae1
FM
2644 */
2645 bool ToggleWindowStyle(int flag);
2646
2647 /**
2648 Transfers values from child controls to data areas specified by their
e25cd775
FM
2649 validators. Returns @false if a transfer failed.
2650
23324ae1
FM
2651 If the window has @c wxWS_EX_VALIDATE_RECURSIVELY extra style flag set,
2652 the method will also call TransferDataFromWindow() of all child windows.
3c4f71cc 2653
4cc4bfaf 2654 @see TransferDataToWindow(), wxValidator, Validate()
23324ae1
FM
2655 */
2656 virtual bool TransferDataFromWindow();
2657
2658 /**
2659 Transfers values to child controls from data areas specified by their
2660 validators.
e25cd775 2661
23324ae1
FM
2662 If the window has @c wxWS_EX_VALIDATE_RECURSIVELY extra style flag set,
2663 the method will also call TransferDataToWindow() of all child windows.
3c4f71cc 2664
d29a9a8a 2665 @return Returns @false if a transfer failed.
3c4f71cc 2666
4cc4bfaf 2667 @see TransferDataFromWindow(), wxValidator, Validate()
23324ae1
FM
2668 */
2669 virtual bool TransferDataToWindow();
2670
2671 /**
2672 Unregisters a system wide hotkey.
3c4f71cc 2673
7c913512 2674 @param hotkeyId
4cc4bfaf 2675 Numeric identifier of the hotkey. Must be the same id that was passed to
e25cd775 2676 RegisterHotKey().
3c4f71cc 2677
d29a9a8a 2678 @return @true if the hotkey was unregistered successfully, @false if the
e25cd775 2679 id was invalid.
3c4f71cc 2680
23324ae1 2681 @remarks This function is currently only implemented under MSW.
3c4f71cc 2682
4cc4bfaf 2683 @see RegisterHotKey()
23324ae1
FM
2684 */
2685 bool UnregisterHotKey(int hotkeyId);
2686
2687 /**
2688 Unreserve an ID or range of IDs that was reserved by NewControlId().
e25cd775 2689 See @ref overview_windowids for more information.
3c4f71cc 2690
7c913512 2691 @param id
4cc4bfaf 2692 The starting ID of the range of IDs to unreserve.
7c913512 2693 @param count
4cc4bfaf 2694 The number of sequential IDs to unreserve.
3c4f71cc 2695
75b00cf8 2696 @see NewControlId(), wxIdManager, @ref overview_windowids
23324ae1
FM
2697 */
2698 static void UnreserveControlId(wxWindowID id, int count = 1);
2699
410201d9
VZ
2700 /**
2701 Unset any existing tooltip.
2702
2703 @since 2.9.0
2704
2705 @see SetToolTip()
2706 */
2707 void UnsetToolTip();
2708
23324ae1
FM
2709 /**
2710 Calling this method immediately repaints the invalidated area of the window and
2711 all of its children recursively while this would usually only happen when the
7c913512 2712 flow of control returns to the event loop.
e25cd775 2713
23324ae1
FM
2714 Notice that this function doesn't invalidate any area of the window so
2715 nothing happens if nothing has been invalidated (i.e. marked as requiring
e25cd775
FM
2716 a redraw). Use Refresh() first if you want to immediately redraw the
2717 window unconditionally.
23324ae1
FM
2718 */
2719 virtual void Update();
2720
2721 /**
e25cd775
FM
2722 This function sends one or more wxUpdateUIEvent to the window.
2723 The particular implementation depends on the window; for example a
2724 wxToolBar will send an update UI event for each toolbar button,
23324ae1 2725 and a wxFrame will send an update UI event for each menubar menu item.
e25cd775 2726
23324ae1
FM
2727 You can call this function from your application to ensure that your
2728 UI is up-to-date at this point (as far as your wxUpdateUIEvent handlers
2729 are concerned). This may be necessary if you have called
e25cd775
FM
2730 wxUpdateUIEvent::SetMode() or wxUpdateUIEvent::SetUpdateInterval() to limit
2731 the overhead that wxWidgets incurs by sending update UI events in idle time.
2732 @a flags should be a bitlist of one or more of the wxUpdateUI enumeration.
3c4f71cc 2733
23324ae1
FM
2734 If you are calling this function from an OnInternalIdle or OnIdle
2735 function, make sure you pass the wxUPDATE_UI_FROMIDLE flag, since
2736 this tells the window to only update the UI elements that need
2737 to be updated in idle time. Some windows update their elements
2738 only when necessary, for example when a menu is about to be shown.
2739 The following is an example of how to call UpdateWindowUI from
2740 an idle function.
3c4f71cc 2741
e25cd775
FM
2742 @code
2743 void MyWindow::OnInternalIdle()
2744 {
2745 if (wxUpdateUIEvent::CanUpdate(this))
2746 UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
2747 }
2748 @endcode
2749
4cc4bfaf 2750 @see wxUpdateUIEvent, DoUpdateWindowUI(), OnInternalIdle()
23324ae1
FM
2751 */
2752 virtual void UpdateWindowUI(long flags = wxUPDATE_UI_NONE);
2753
2754 /**
2755 Validates the current values of the child controls using their validators.
23324ae1
FM
2756 If the window has @c wxWS_EX_VALIDATE_RECURSIVELY extra style flag set,
2757 the method will also call Validate() of all child windows.
3c4f71cc 2758
d29a9a8a 2759 @return Returns @false if any of the validations failed.
3c4f71cc 2760
4cc4bfaf
FM
2761 @see TransferDataFromWindow(), TransferDataToWindow(),
2762 wxValidator
23324ae1
FM
2763 */
2764 virtual bool Validate();
2765
2766 /**
2767 Moves the pointer to the given position on the window.
e25cd775 2768
1f1d2182 2769 @note This function is not supported under Mac because Apple Human
e25cd775 2770 Interface Guidelines forbid moving the mouse cursor programmatically.
3c4f71cc 2771
7c913512 2772 @param x
4cc4bfaf 2773 The new x position for the cursor.
7c913512 2774 @param y
4cc4bfaf 2775 The new y position for the cursor.
23324ae1
FM
2776 */
2777 void WarpPointer(int x, int y);
2778};
2779
2780
e54c96f1 2781
23324ae1
FM
2782// ============================================================================
2783// Global functions/macros
2784// ============================================================================
2785
7fa7088e
BP
2786/** @ingroup group_funcmacro_misc */
2787//@{
23324ae1
FM
2788
2789/**
2790 Find the deepest window at the mouse pointer position, returning the window
2791 and current pointer position in screen coordinates.
7fa7088e
BP
2792
2793 @header{wx/window.h}
23324ae1 2794*/
4cc4bfaf 2795wxWindow* wxFindWindowAtPointer(wxPoint& pt);
23324ae1
FM
2796
2797/**
7fa7088e
BP
2798 Gets the currently active window (implemented for MSW and GTK only
2799 currently, always returns @NULL in the other ports).
2800
2801 @header{wx/window.h}
23324ae1 2802*/
4cc4bfaf 2803wxWindow* wxGetActiveWindow();
23324ae1
FM
2804
2805/**
7fa7088e
BP
2806 Returns the first top level parent of the given window, or in other words,
2807 the frame or dialog containing it, or @NULL.
2808
2809 @header{wx/window.h}
23324ae1 2810*/
7fa7088e
BP
2811wxWindow* wxGetTopLevelParent(wxWindow* window);
2812
2813//@}
23324ae1 2814