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