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