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