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