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