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