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