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