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