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