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