]>
Commit | Line | Data |
---|---|---|
a660d684 KB |
1 | \section{\class{wxWindow}}\label{wxwindow} |
2 | ||
2cdac558 | 3 | wxWindow is the base class for all windows. Any children of the window will be deleted |
4130b487 RR |
4 | automatically by the destructor before the window itself is deleted. |
5 | ||
2cdac558 RD |
6 | Please note that we documented a number of handler functions (OnChar(), OnMouse() etc.) in this |
7 | help text. These must not be called by a user program and are documented only for illustration. | |
4130b487 RR |
8 | On several platforms, only a few of these handlers are actually written (they are not always |
9 | needed) and if you are uncertain on how to add a certain behaviour to a window class, intercept | |
10 | the respective event as usual and call \helpref{wxEvent::Skip}{wxeventskip} so that the native | |
11 | platform can implement its native behaviour or just ignore the event if nothing needs to be | |
12 | done. | |
a660d684 KB |
13 | |
14 | \wxheading{Derived from} | |
15 | ||
16 | \helpref{wxEvtHandler}{wxevthandler}\\ | |
17 | \helpref{wxObject}{wxobject} | |
18 | ||
954b8ae6 JS |
19 | \wxheading{Include files} |
20 | ||
21 | <wx/window.h> | |
22 | ||
a660d684 KB |
23 | \wxheading{Window styles} |
24 | ||
25 | The following styles can apply to all windows, although they will not always make sense for a particular | |
4130b487 | 26 | window class or on all platforms. |
a660d684 KB |
27 | |
28 | \twocolwidtha{5cm}% | |
29 | \begin{twocollist}\itemsep=0pt | |
30 | \twocolitem{\windowstyle{wxSIMPLE\_BORDER}}{Displays a thin border around the window. wxBORDER is the old name | |
27d029c7 | 31 | for this style. } |
a660d684 KB |
32 | \twocolitem{\windowstyle{wxDOUBLE\_BORDER}}{Displays a double border. Windows only.} |
33 | \twocolitem{\windowstyle{wxSUNKEN\_BORDER}}{Displays a sunken border.} | |
27d029c7 | 34 | \twocolitem{\windowstyle{wxRAISED\_BORDER}}{Displays a raised border. GTK only. } |
6453876e | 35 | \twocolitem{\windowstyle{wxSTATIC\_BORDER}}{Displays a border suitable for a static control. Windows only. } |
a660d684 KB |
36 | \twocolitem{\windowstyle{wxTRANSPARENT\_WINDOW}}{The window is transparent, that is, it will not receive paint |
37 | events. Windows only.} | |
38 | \twocolitem{\windowstyle{wxNO\_3D}}{Prevents the children of this window taking on 3D styles, even though | |
39 | the application-wide policy is for 3D controls. Windows only.} | |
40 | \twocolitem{\windowstyle{wxTAB\_TRAVERSAL}}{Use this to enable tab traversal for non-dialog windows.} | |
895fc9cb VZ |
41 | \twocolitem{\windowstyle{wxWANTS\_CHARS}}{Use this to indicate that the window |
42 | wants to get all char events - even for keys like TAB or ENTER which are | |
43 | usually used for dialog navigation and which wouldn't be generated without | |
44 | this style} | |
45 | \twocolitem{\windowstyle{wxNO\_FULLREPAINT\_ON\_RESIZE}}{Disables repainting | |
46 | the window completely when its size is changed - you will have to repaint the | |
47 | new window area manually if you use style. Currently only has effect for | |
4130b487 | 48 | Windows.} |
6453876e RR |
49 | \twocolitem{\windowstyle{wxVSCROLL}}{Use this style to enable a vertical scrollbar. (Still used?) } |
50 | \twocolitem{\windowstyle{wxHSCROLL}}{Use this style to enable a horizontal scrollbar. (Still used?) } | |
884360bc | 51 | \twocolitem{\windowstyle{wxCLIP\_CHILDREN}}{Use this style to eliminate flicker caused by the background being |
6453876e | 52 | repainted, then children being painted over them. Windows only.} |
a660d684 KB |
53 | \end{twocollist} |
54 | ||
55 | See also \helpref{window styles overview}{windowstyles}. | |
56 | ||
57 | \wxheading{See also} | |
58 | ||
59 | \helpref{Event handling overview}{eventhandlingoverview} | |
60 | ||
61 | \latexignore{\rtfignore{\wxheading{Members}}} | |
62 | ||
63 | \membersection{wxWindow::wxWindow} | |
64 | ||
65 | \func{}{wxWindow}{\void} | |
66 | ||
67 | Default constructor. | |
68 | ||
eaaa6a06 | 69 | \func{}{wxWindow}{\param{wxWindow*}{ parent}, \param{wxWindowID }{id}, |
a660d684 KB |
70 | \param{const wxPoint\& }{pos = wxDefaultPosition}, |
71 | \param{const wxSize\& }{size = wxDefaultSize}, | |
eaaa6a06 | 72 | \param{long }{style = 0}, |
a660d684 KB |
73 | \param{const wxString\& }{name = wxPanelNameStr}} |
74 | ||
75 | Constructs a window, which can be a child of a frame, dialog or any other non-control window. | |
76 | ||
77 | \wxheading{Parameters} | |
78 | ||
79 | \docparam{parent}{Pointer to a parent window.} | |
80 | ||
81 | \docparam{id}{Window identifier. If -1, will automatically create an identifier.} | |
82 | ||
83 | \docparam{pos}{Window position. wxDefaultPosition is (-1, -1) which indicates that wxWindows | |
84 | should generate a default position for the window. If using the wxWindow class directly, supply | |
85 | an actual position.} | |
86 | ||
87 | \docparam{size}{Window size. wxDefaultSize is (-1, -1) which indicates that wxWindows | |
6453876e RR |
88 | should generate a default size for the window. If no suitable size can be found, the |
89 | window will be sized to 20x20 pixels so that the window is visible but obviously not | |
90 | correctly sized. } | |
a660d684 KB |
91 | |
92 | \docparam{style}{Window style. For generic window styles, please see \helpref{wxWindow}{wxwindow}.} | |
93 | ||
94 | \docparam{name}{Window name.} | |
95 | ||
96 | \membersection{wxWindow::\destruct{wxWindow}} | |
97 | ||
98 | \func{}{\destruct{wxWindow}}{\void} | |
99 | ||
100 | Destructor. Deletes all subwindows, then deletes itself. Instead of using | |
101 | the {\bf delete} operator explicitly, you should normally | |
102 | use \helpref{wxWindow::Destroy}{wxwindowdestroy} so that wxWindows | |
103 | can delete a window only when it is safe to do so, in idle time. | |
104 | ||
105 | \wxheading{See also} | |
106 | ||
107 | \helpref{Window deletion overview}{windowdeletionoverview},\rtfsp | |
108 | \helpref{wxWindow::OnCloseWindow}{wxwindowonclosewindow},\rtfsp | |
109 | \helpref{wxWindow::Destroy}{wxwindowdestroy},\rtfsp | |
110 | \helpref{wxCloseEvent}{wxcloseevent} | |
111 | ||
112 | \membersection{wxWindow::AddChild} | |
113 | ||
114 | \func{virtual void}{AddChild}{\param{wxWindow* }{child}} | |
115 | ||
116 | Adds a child window. This is called automatically by window creation | |
117 | functions so should not be required by the application programmer. | |
118 | ||
119 | \wxheading{Parameters} | |
120 | ||
121 | \docparam{child}{Child window to add.} | |
122 | ||
123 | \membersection{wxWindow::CaptureMouse}\label{wxwindowcapturemouse} | |
124 | ||
125 | \func{virtual void}{CaptureMouse}{\void} | |
126 | ||
127 | Directs all mouse input to this window. Call \helpref{wxWindow::ReleaseMouse}{wxwindowreleasemouse} to | |
128 | release the capture. | |
129 | ||
130 | \wxheading{See also} | |
131 | ||
132 | \helpref{wxWindow::ReleaseMouse}{wxwindowreleasemouse} | |
133 | ||
134 | \membersection{wxWindow::Center}\label{wxwindowcenter} | |
135 | ||
eaaa6a06 | 136 | \func{void}{Center}{\param{int}{ direction}} |
a660d684 KB |
137 | |
138 | A synonym for \helpref{Centre}{wxwindowcentre}. | |
139 | ||
7631a292 RD |
140 | \membersection{wxWindow::CenterOnParent}\label{wxwindowcenteronparent} |
141 | ||
142 | \func{void}{CenterOnParent}{\param{int}{ direction}} | |
143 | ||
144 | A synonym for \helpref{CentreOnParent}{wxwindowcentreonparent}. | |
145 | ||
a660d684 KB |
146 | \membersection{wxWindow::Centre}\label{wxwindowcentre} |
147 | ||
7631a292 | 148 | \func{void}{Centre}{\param{int}{ direction = wxHORIZONTAL}} |
a660d684 KB |
149 | |
150 | Centres the window. | |
151 | ||
152 | \wxheading{Parameters} | |
153 | ||
154 | \docparam{direction}{Specifies the direction for the centering. May be {\tt wxHORIZONTAL}, {\tt wxVERTICAL}\rtfsp | |
18ac8d69 RD |
155 | or {\tt wxBOTH}. It may also include {\tt wxCENTRE\_ON\_SCREEN} flag |
156 | if you want to center the window on the entire screen and not on its | |
157 | parent window.} | |
d22699b5 VZ |
158 | |
159 | The flag {\tt wxCENTRE\_FRAME} is obsolete and should not be used any longer. | |
a660d684 KB |
160 | |
161 | \wxheading{Remarks} | |
162 | ||
d22699b5 VZ |
163 | If the window is a top level one (i.e. doesn't have a parent), it will be |
164 | centered relative to the screen anyhow. | |
a660d684 KB |
165 | |
166 | \wxheading{See also} | |
167 | ||
168 | \helpref{wxWindow::Center}{wxwindowcenter} | |
169 | ||
7631a292 RD |
170 | \membersection{wxWindow::CentreOnParent}\label{wxwindowcentreonparent} |
171 | ||
172 | \func{void}{CentreOnParent}{\param{int}{ direction = wxHORIZONTAL}} | |
173 | ||
174 | Centres the window. | |
175 | ||
176 | \wxheading{Parameters} | |
177 | ||
178 | \docparam{direction}{Specifies the direction for the centering. May be {\tt wxHORIZONTAL}, {\tt wxVERTICAL}\rtfsp | |
179 | or {\tt wxBOTH}.} | |
180 | ||
181 | \wxheading{Remarks} | |
182 | ||
183 | This methods provides for a way to center top level windows over their | |
184 | parents instead of the entire screen. If there is no parent or if the | |
185 | window is not a top level window, then behaviour is the same as | |
186 | \helpref{wxWindow::Centre}{wxwindowcentre}. | |
187 | ||
188 | \wxheading{See also} | |
189 | ||
190 | \helpref{wxWindow::CenterOnParent}{wxwindowcenteronparent} | |
191 | ||
a660d684 KB |
192 | \membersection{wxWindow::Clear}\label{wxwindowclear} |
193 | ||
194 | \func{void}{Clear}{\void} | |
195 | ||
5b6aa0ff JS |
196 | Clears the window by filling it with the current background colour. Does not |
197 | cause an erase background event to be generated. | |
a660d684 KB |
198 | |
199 | \membersection{wxWindow::ClientToScreen} | |
200 | ||
201 | \constfunc{virtual void}{ClientToScreen}{\param{int* }{x}, \param{int* }{y}} | |
202 | ||
a974387a JS |
203 | \constfunc{virtual wxPoint}{ClientToScreen}{\param{const wxPoint\&}{ pt}} |
204 | ||
a660d684 KB |
205 | Converts to screen coordinates from coordinates relative to this window. |
206 | ||
207 | \docparam{x}{A pointer to a integer value for the x coordinate. Pass the client coordinate in, and | |
208 | a screen coordinate will be passed out.} | |
209 | ||
210 | \docparam{y}{A pointer to a integer value for the y coordinate. Pass the client coordinate in, and | |
211 | a screen coordinate will be passed out.} | |
212 | ||
a974387a JS |
213 | \docparam{pt}{The client position for the second form of the function.} |
214 | ||
06d20283 RD |
215 | \pythonnote{In place of a single overloaded method name, wxPython |
216 | implements the following methods:\par | |
217 | \indented{2cm}{\begin{twocollist} | |
c9110876 VS |
218 | \twocolitem{{\bf ClientToScreen(point)}}{Accepts and returns a wxPoint} |
219 | \twocolitem{{\bf ClientToScreenXY(x, y)}}{Returns a 2-tuple, (x, y)} | |
06d20283 RD |
220 | \end{twocollist}} |
221 | } | |
222 | ||
223 | ||
a660d684 KB |
224 | \membersection{wxWindow::Close}\label{wxwindowclose} |
225 | ||
8a293590 | 226 | \func{virtual bool}{Close}{\param{bool}{ force = FALSE}} |
a660d684 KB |
227 | |
228 | The purpose of this call is to provide a safer way of destroying a window than using | |
229 | the {\it delete} operator. | |
230 | ||
231 | \wxheading{Parameters} | |
232 | ||
233 | \docparam{force}{FALSE if the window's close handler should be able to veto the destruction | |
234 | of this window, TRUE if it cannot.} | |
235 | ||
236 | \wxheading{Remarks} | |
237 | ||
238 | Close calls the \helpref{close handler}{wxcloseevent} for the window, providing an opportunity for the window to | |
239 | choose whether to destroy the window. | |
240 | ||
241 | The close handler should check whether the window is being deleted forcibly, | |
242 | using \helpref{wxCloseEvent::GetForce}{wxcloseeventgetforce}, in which case it should | |
243 | destroy the window using \helpref{wxWindow::Destroy}{wxwindowdestroy}. | |
244 | ||
245 | Applies to managed windows (wxFrame and wxDialog classes) only. | |
246 | ||
532372a3 JS |
247 | {\it Note} that calling Close does not guarantee that the window will be destroyed; but it |
248 | provides a way to simulate a manual close of a window, which may or may not be implemented by | |
249 | destroying the window. The default implementation of wxDialog::OnCloseWindow does not | |
250 | necessarily delete the dialog, since it will simply simulate an wxID\_CANCEL event which | |
251 | itself only hides the dialog. | |
252 | ||
253 | To guarantee that the window will be destroyed, call \helpref{wxWindow::Destroy}{wxwindowdestroy} instead. | |
254 | ||
a660d684 KB |
255 | \wxheading{See also} |
256 | ||
257 | \helpref{Window deletion overview}{windowdeletionoverview},\rtfsp | |
258 | \helpref{wxWindow::OnCloseWindow}{wxwindowonclosewindow},\rtfsp | |
259 | \helpref{wxWindow::Destroy}{wxwindowdestroy},\rtfsp | |
260 | \helpref{wxCloseEvent}{wxcloseevent} | |
261 | ||
387a3b02 JS |
262 | \membersection{wxWindow::ConvertDialogToPixels}\label{wxwindowconvertdialogtopixels} |
263 | ||
264 | \func{wxPoint}{ConvertDialogToPixels}{\param{const wxPoint\&}{ pt}} | |
265 | ||
266 | \func{wxSize}{ConvertDialogToPixels}{\param{const wxSize\&}{ sz}} | |
267 | ||
268 | Converts a point or size from dialog units to pixels. | |
269 | ||
270 | For the x dimension, the dialog units are multiplied by the average character width | |
271 | and then divided by 4. | |
272 | ||
273 | For the y dimension, the dialog units are multiplied by the average character height | |
274 | and then divided by 8. | |
275 | ||
276 | \wxheading{Remarks} | |
277 | ||
278 | Dialog units are used for maintaining a dialog's proportions even if the font changes. | |
279 | Dialogs created using Dialog Editor optionally use dialog units. | |
280 | ||
281 | You can also use these functions programmatically. A convenience macro is defined: | |
282 | ||
283 | {\small | |
284 | \begin{verbatim} | |
285 | #define wxDLG_UNIT(parent, pt) parent->ConvertDialogToPixels(pt) | |
286 | \end{verbatim} | |
287 | } | |
288 | ||
289 | \wxheading{See also} | |
290 | ||
291 | \helpref{wxWindow::ConvertPixelsToDialog}{wxwindowconvertpixelstodialog} | |
292 | ||
06d20283 RD |
293 | \pythonnote{In place of a single overloaded method name, wxPython |
294 | implements the following methods:\par | |
295 | \indented{2cm}{\begin{twocollist} | |
c9110876 VS |
296 | \twocolitem{{\bf ConvertDialogPointToPixels(point)}}{Accepts and returns a wxPoint} |
297 | \twocolitem{{\bf ConvertDialogSizeToPixels(size)}}{Accepts and returns a wxSize} | |
06d20283 RD |
298 | \end{twocollist}} |
299 | ||
300 | Additionally, the following helper functions are defined:\par | |
301 | \indented{2cm}{\begin{twocollist} | |
c9110876 | 302 | \twocolitem{{\bf wxDLG\_PNT(win, point)}}{Converts a wxPoint from dialog |
06d20283 | 303 | units to pixels} |
c9110876 | 304 | \twocolitem{{\bf wxDLG\_SZE(win, size)}}{Converts a wxSize from dialog |
06d20283 RD |
305 | units to pixels} |
306 | \end{twocollist}} | |
307 | } | |
308 | ||
309 | ||
387a3b02 JS |
310 | \membersection{wxWindow::ConvertPixelsToDialog}\label{wxwindowconvertpixelstodialog} |
311 | ||
312 | \func{wxPoint}{ConvertPixelsToDialog}{\param{const wxPoint\&}{ pt}} | |
313 | ||
314 | \func{wxSize}{ConvertPixelsToDialog}{\param{const wxSize\&}{ sz}} | |
315 | ||
316 | Converts a point or size from pixels to dialog units. | |
317 | ||
318 | For the x dimension, the pixels are multiplied by 4 and then divided by the average | |
319 | character width. | |
320 | ||
321 | For the y dimension, the pixels are multipled by 8 and then divided by the average | |
322 | character height. | |
323 | ||
324 | \wxheading{Remarks} | |
325 | ||
326 | Dialog units are used for maintaining a dialog's proportions even if the font changes. | |
327 | Dialogs created using Dialog Editor optionally use dialog units. | |
328 | ||
329 | \wxheading{See also} | |
330 | ||
331 | \helpref{wxWindow::ConvertDialogToPixels}{wxwindowconvertdialogtopixels} | |
332 | ||
06d20283 RD |
333 | |
334 | \pythonnote{In place of a single overloaded method name, wxPython | |
335 | implements the following methods:\par | |
336 | \indented{2cm}{\begin{twocollist} | |
c9110876 VS |
337 | \twocolitem{{\bf ConvertDialogPointToPixels(point)}}{Accepts and returns a wxPoint} |
338 | \twocolitem{{\bf ConvertDialogSizeToPixels(size)}}{Accepts and returns a wxSize} | |
06d20283 RD |
339 | \end{twocollist}} |
340 | } | |
341 | ||
a660d684 KB |
342 | \membersection{wxWindow::Destroy}\label{wxwindowdestroy} |
343 | ||
344 | \func{virtual bool}{Destroy}{\void} | |
345 | ||
346 | Destroys the window safely. Use this function instead of the delete operator, since | |
347 | different window classes can be destroyed differently. Frames and dialogs | |
348 | are not destroyed immediately when this function is called - they are added | |
349 | to a list of windows to be deleted on idle time, when all the window's events | |
350 | have been processed. This prevents problems with events being sent to non-existant | |
351 | windows. | |
352 | ||
353 | \wxheading{Return value} | |
354 | ||
355 | TRUE if the window has either been successfully deleted, or it has been added | |
356 | to the list of windows pending real deletion. | |
357 | ||
358 | \membersection{wxWindow::DestroyChildren} | |
359 | ||
360 | \func{virtual void}{DestroyChildren}{\void} | |
361 | ||
362 | Destroys all children of a window. Called automatically by the destructor. | |
363 | ||
364 | \membersection{wxWindow::DragAcceptFiles}\label{wxwindowdragacceptfiles} | |
365 | ||
8a293590 | 366 | \func{virtual void}{DragAcceptFiles}{\param{bool}{ accept}} |
a660d684 KB |
367 | |
368 | Enables or disables elibility for drop file events (OnDropFiles). | |
369 | ||
370 | \wxheading{Parameters} | |
371 | ||
372 | \docparam{accept}{If TRUE, the window is eligible for drop file events. If FALSE, the window | |
373 | will not accept drop file events.} | |
374 | ||
375 | \wxheading{Remarks} | |
376 | ||
377 | Windows only. | |
378 | ||
379 | \wxheading{See also} | |
380 | ||
381 | \helpref{wxWindow::OnDropFiles}{wxwindowondropfiles} | |
382 | ||
383 | \membersection{wxWindow::Enable}\label{wxwindowenable} | |
384 | ||
8a293590 | 385 | \func{virtual void}{Enable}{\param{bool}{ enable}} |
a660d684 KB |
386 | |
387 | Enable or disable the window for user input. | |
388 | ||
389 | \wxheading{Parameters} | |
390 | ||
391 | \docparam{enable}{If TRUE, enables the window for input. If FALSE, disables the window.} | |
392 | ||
393 | \wxheading{See also} | |
394 | ||
395 | \helpref{wxWindow::IsEnabled}{wxwindowisenabled} | |
396 | ||
a660d684 KB |
397 | \membersection{wxWindow::FindFocus}\label{wxwindowfindfocus} |
398 | ||
399 | \func{static wxWindow*}{FindFocus}{\void} | |
400 | ||
401 | Finds the window or control which currently has the keyboard focus. | |
402 | ||
403 | \wxheading{Remarks} | |
404 | ||
405 | Note that this is a static function, so it can be called without needing a wxWindow pointer. | |
406 | ||
407 | \wxheading{See also} | |
408 | ||
409 | \helpref{wxWindow::SetFocus}{wxwindowsetfocus} | |
410 | ||
dfad0599 JS |
411 | \membersection{wxWindow::FindWindow}\label{wxwindowfindwindow} |
412 | ||
413 | \func{wxWindow*}{FindWindow}{\param{long}{ id}} | |
414 | ||
415 | Find a child of this window, by identifier. | |
416 | ||
417 | \func{wxWindow*}{FindWindow}{\param{const wxString\&}{ name}} | |
418 | ||
419 | Find a child of this window, by name. | |
420 | ||
06d20283 RD |
421 | \pythonnote{In place of a single overloaded method name, wxPython |
422 | implements the following methods:\par | |
423 | \indented{2cm}{\begin{twocollist} | |
c9110876 VS |
424 | \twocolitem{{\bf FindWindowById(id)}}{Accepts an integer} |
425 | \twocolitem{{\bf FindWindowByName(name)}}{Accepts a string} | |
06d20283 RD |
426 | \end{twocollist}} |
427 | } | |
428 | ||
a660d684 KB |
429 | \membersection{wxWindow::Fit}\label{wxwindowfit} |
430 | ||
431 | \func{virtual void}{Fit}{\void} | |
432 | ||
f68586e5 VZ |
433 | Sizes the window so that it fits around its subwindows. This function won't do |
434 | anything if there are no subwindows. | |
a660d684 KB |
435 | |
436 | \membersection{wxWindow::GetBackgroundColour}\label{wxwindowgetbackgroundcolour} | |
437 | ||
438 | \constfunc{virtual wxColour}{GetBackgroundColour}{\void} | |
439 | ||
440 | Returns the background colour of the window. | |
441 | ||
442 | \wxheading{See also} | |
443 | ||
444 | \helpref{wxWindow::SetBackgroundColour}{wxwindowsetbackgroundcolour},\rtfsp | |
445 | \helpref{wxWindow::SetForegroundColour}{wxwindowsetforegroundcolour},\rtfsp | |
446 | \helpref{wxWindow::GetForegroundColour}{wxwindowgetforegroundcolour},\rtfsp | |
447 | \helpref{wxWindow::OnEraseBackground}{wxwindowonerasebackground} | |
448 | ||
f68586e5 VZ |
449 | \membersection{wxWindow::GetBestSize}{wxwindowgetbestsize} |
450 | ||
451 | \constfunc{virtual wxSize}{GetBestSize}{\void} | |
452 | ||
453 | This functions returns the best acceptable minimal size for the window. For | |
454 | example, for a static control, it will be the minimal size such that the | |
455 | control label is not truncated. For windows containing subwindows (typically | |
456 | \helpref{wxPanel}wxpanel}), the size returned by this function will be the | |
457 | same as the size the window would have had after calling | |
458 | \helpref{Fit}{wxwindowfit}. | |
459 | ||
a660d684 KB |
460 | \membersection{wxWindow::GetCharHeight} |
461 | ||
462 | \constfunc{virtual int}{GetCharHeight}{\void} | |
463 | ||
464 | Returns the character height for this window. | |
465 | ||
466 | \membersection{wxWindow::GetCharWidth} | |
467 | ||
468 | \constfunc{virtual int}{GetCharWidth}{\void} | |
469 | ||
470 | Returns the average character width for this window. | |
471 | ||
472 | \membersection{wxWindow::GetChildren} | |
473 | ||
c0ed460c | 474 | \func{wxList\&}{GetChildren}{\void} |
a660d684 | 475 | |
c0ed460c | 476 | Returns a reference to the list of the window's children. |
a660d684 KB |
477 | |
478 | \membersection{wxWindow::GetClientSize}\label{wxwindowgetclientsize} | |
479 | ||
480 | \constfunc{virtual void}{GetClientSize}{\param{int* }{width}, \param{int* }{height}} | |
481 | ||
a974387a JS |
482 | \constfunc{virtual wxSize}{GetClientSize}{\void} |
483 | ||
a660d684 KB |
484 | This gets the size of the window `client area' in pixels. The client area is the |
485 | area which may be drawn on by the programmer, excluding title bar, border etc. | |
486 | ||
487 | \wxheading{Parameters} | |
488 | ||
489 | \docparam{width}{Receives the client width in pixels.} | |
490 | ||
491 | \docparam{height}{Receives the client height in pixels.} | |
492 | ||
06d20283 RD |
493 | \pythonnote{In place of a single overloaded method name, wxPython |
494 | implements the following methods:\par | |
495 | \indented{2cm}{\begin{twocollist} | |
c9110876 VS |
496 | \twocolitem{{\bf wxGetClientSizeTuple()}}{Returns a 2-tuple of (width, height)} |
497 | \twocolitem{{\bf wxGetClientSize()}}{Returns a wxSize object} | |
06d20283 RD |
498 | \end{twocollist}} |
499 | } | |
500 | ||
a660d684 KB |
501 | \membersection{wxWindow::GetConstraints}\label{wxwindowgetconstraints} |
502 | ||
503 | \constfunc{wxLayoutConstraints*}{GetConstraints}{\void} | |
504 | ||
505 | Returns a pointer to the window's layout constraints, or NULL if there are none. | |
506 | ||
507 | \membersection{wxWindow::GetDefaultItem}\label{wxwindowgetdefaultitem} | |
508 | ||
509 | \constfunc{wxButton*}{GetDefaultItem}{\void} | |
510 | ||
511 | Returns a pointer to the button which is the default for this window, or NULL. | |
512 | ||
dface61c JS |
513 | \membersection{wxWindow::GetDropTarget}\label{wxwindowgetdroptarget} |
514 | ||
515 | \constfunc{wxDropTarget*}{GetDropTarget}{\void} | |
516 | ||
517 | Returns the associated drop target, which may be NULL. | |
518 | ||
519 | \wxheading{See also} | |
520 | ||
06d20283 | 521 | \helpref{wxWindow::SetDropTarget}{wxwindowsetdroptarget}, |
dface61c JS |
522 | \helpref{Drag and drop overview}{wxdndoverview} |
523 | ||
a660d684 KB |
524 | \membersection{wxWindow::GetEventHandler}\label{wxwindowgeteventhandler} |
525 | ||
526 | \constfunc{wxEvtHandler*}{GetEventHandler}{\void} | |
527 | ||
528 | Returns the event handler for this window. By default, the window is its | |
529 | own event handler. | |
530 | ||
531 | \wxheading{See also} | |
532 | ||
533 | \helpref{wxWindow::SetEventHandler}{wxwindowseteventhandler},\rtfsp | |
534 | \helpref{wxWindow::PushEventHandler}{wxwindowpusheventhandler},\rtfsp | |
535 | \helpref{wxWindow::PopEventHandler}{wxwindowpusheventhandler},\rtfsp | |
536 | \helpref{wxEvtHandler::ProcessEvent}{wxevthandlerprocessevent},\rtfsp | |
537 | \helpref{wxEvtHandler}{wxevthandler}\rtfsp | |
538 | ||
539 | \membersection{wxWindow::GetFont}\label{wxwindowgetfont} | |
540 | ||
c0ed460c | 541 | \constfunc{wxFont\&}{GetFont}{\void} |
a660d684 | 542 | |
c0ed460c | 543 | Returns a reference to the font for this window. |
a660d684 KB |
544 | |
545 | \wxheading{See also} | |
546 | ||
547 | \helpref{wxWindow::SetFont}{wxwindowsetfont} | |
548 | ||
549 | \membersection{wxWindow::GetForegroundColour}\label{wxwindowgetforegroundcolour} | |
550 | ||
551 | \func{virtual wxColour}{GetForegroundColour}{\void} | |
552 | ||
553 | Returns the foreground colour of the window. | |
554 | ||
555 | \wxheading{Remarks} | |
556 | ||
557 | The interpretation of foreground colour is open to interpretation according | |
558 | to the window class; it may be the text colour or other colour, or it may not | |
559 | be used at all. | |
560 | ||
561 | \wxheading{See also} | |
562 | ||
563 | \helpref{wxWindow::SetForegroundColour}{wxwindowsetforegroundcolour},\rtfsp | |
564 | \helpref{wxWindow::SetBackgroundColour}{wxwindowsetbackgroundcolour},\rtfsp | |
565 | \helpref{wxWindow::GetBackgroundColour}{wxwindowgetbackgroundcolour} | |
566 | ||
567 | \membersection{wxWindow::GetGrandParent} | |
568 | ||
569 | \constfunc{wxWindow*}{GetGrandParent}{\void} | |
570 | ||
571 | Returns the grandparent of a window, or NULL if there isn't one. | |
572 | ||
573 | \membersection{wxWindow::GetHandle} | |
574 | ||
575 | \constfunc{void*}{GetHandle}{\void} | |
576 | ||
577 | Returns the platform-specific handle of the physical window. Cast it to an appropriate | |
6453876e | 578 | handle, such as {\bf HWND} for Windows, {\bf Widget} for Motif or {\bf GtkWidget} for GTK. |
a660d684 | 579 | |
b32c6ff0 RD |
580 | \pythonnote{This method will return an integer in wxPython.} |
581 | ||
a660d684 KB |
582 | \membersection{wxWindow::GetId}\label{wxwindowgetid} |
583 | ||
584 | \constfunc{int}{GetId}{\void} | |
585 | ||
586 | Returns the identifier of the window. | |
587 | ||
588 | \wxheading{Remarks} | |
589 | ||
6453876e RR |
590 | Each window has an integer identifier. If the application has not provided one |
591 | (or the default Id -1) an unique identifier with a negative value will be generated. | |
a660d684 | 592 | |
a660d684 KB |
593 | \wxheading{See also} |
594 | ||
5b6aa0ff JS |
595 | \helpref{wxWindow::SetId}{wxwindowsetid}\rtfsp |
596 | \helpref{Window identifiers}{windowids} | |
a660d684 KB |
597 | |
598 | \membersection{wxWindow::GetPosition} | |
599 | ||
600 | \constfunc{virtual void}{GetPosition}{\param{int* }{x}, \param{int* }{y}} | |
601 | ||
602 | This gets the position of the window in pixels, relative to the parent window or | |
603 | if no parent, relative to the whole display. | |
604 | ||
605 | \wxheading{Parameters} | |
606 | ||
607 | \docparam{x}{Receives the x position of the window.} | |
608 | ||
609 | \docparam{y}{Receives the y position of the window.} | |
610 | ||
06d20283 RD |
611 | \pythonnote{In place of a single overloaded method name, wxPython |
612 | implements the following methods:\par | |
613 | \indented{2cm}{\begin{twocollist} | |
c9110876 VS |
614 | \twocolitem{{\bf GetPosition()}}{Returns a wxPoint} |
615 | \twocolitem{{\bf GetPositionTuple()}}{Returns a tuple (x, y)} | |
06d20283 RD |
616 | \end{twocollist}} |
617 | } | |
618 | ||
a660d684 KB |
619 | \membersection{wxWindow::GetLabel} |
620 | ||
6453876e | 621 | \constfunc{virtual wxString }{GetLabel}{\void} |
a660d684 KB |
622 | |
623 | Generic way of getting a label from any window, for | |
624 | identification purposes. | |
625 | ||
626 | \wxheading{Remarks} | |
627 | ||
628 | The interpretation of this function differs from class to class. | |
629 | For frames and dialogs, the value returned is the title. For buttons or static text controls, it is | |
630 | the button text. This function can be useful for meta-programs (such as testing | |
631 | tools or special-needs access programs) which need to identify windows | |
632 | by name. | |
633 | ||
634 | \membersection{wxWindow::GetName}\label{wxwindowgetname} | |
635 | ||
6453876e | 636 | \constfunc{virtual wxString }{GetName}{\void} |
a660d684 KB |
637 | |
638 | Returns the window's name. | |
639 | ||
640 | \wxheading{Remarks} | |
641 | ||
642 | This name is not guaranteed to be unique; it is up to the programmer to supply an appropriate | |
643 | name in the window constructor or via \helpref{wxWindow::SetName}{wxwindowsetname}. | |
644 | ||
645 | \wxheading{See also} | |
646 | ||
647 | \helpref{wxWindow::SetName}{wxwindowsetname} | |
648 | ||
649 | \membersection{wxWindow::GetParent} | |
650 | ||
651 | \constfunc{virtual wxWindow*}{GetParent}{\void} | |
652 | ||
653 | Returns the parent of the window, or NULL if there is no parent. | |
654 | ||
a974387a JS |
655 | \membersection{wxWindow::GetRect}\label{wxwindowgetrect} |
656 | ||
657 | \constfunc{virtual wxRect}{GetRect}{\void} | |
658 | ||
659 | Returns the size and position of the window as a \helpref{wxRect}{wxrect} object. | |
660 | ||
a660d684 KB |
661 | \membersection{wxWindow::GetScrollThumb}\label{wxwindowgetscrollthumb} |
662 | ||
eaaa6a06 | 663 | \func{virtual int}{GetScrollThumb}{\param{int }{orientation}} |
a660d684 KB |
664 | |
665 | Returns the built-in scrollbar thumb size. | |
666 | ||
667 | \wxheading{See also} | |
668 | ||
669 | \helpref{wxWindow::SetScrollbar}{wxwindowsetscrollbar} | |
670 | ||
671 | \membersection{wxWindow::GetScrollPos}\label{wxwindowgetscrollpos} | |
672 | ||
eaaa6a06 | 673 | \func{virtual int}{GetScrollPos}{\param{int }{orientation}} |
a660d684 KB |
674 | |
675 | Returns the built-in scrollbar position. | |
676 | ||
677 | \wxheading{See also} | |
678 | ||
679 | See \helpref{wxWindow::SetScrollbar}{wxwindowsetscrollbar} | |
680 | ||
681 | \membersection{wxWindow::GetScrollRange}\label{wxwindowgetscrollrange} | |
682 | ||
eaaa6a06 | 683 | \func{virtual int}{GetScrollRange}{\param{int }{orientation}} |
a660d684 KB |
684 | |
685 | Returns the built-in scrollbar range. | |
686 | ||
687 | \wxheading{See also} | |
688 | ||
689 | \helpref{wxWindow::SetScrollbar}{wxwindowsetscrollbar} | |
690 | ||
a974387a | 691 | \membersection{wxWindow::GetSize}\label{wxwindowgetsize} |
a660d684 KB |
692 | |
693 | \constfunc{virtual void}{GetSize}{\param{int* }{width}, \param{int* }{height}} | |
694 | ||
a974387a JS |
695 | \constfunc{virtual wxSize}{GetSize}{\void} |
696 | ||
a660d684 KB |
697 | This gets the size of the entire window in pixels. |
698 | ||
699 | \wxheading{Parameters} | |
700 | ||
701 | \docparam{width}{Receives the window width.} | |
702 | ||
703 | \docparam{height}{Receives the window height.} | |
704 | ||
06d20283 RD |
705 | \pythonnote{In place of a single overloaded method name, wxPython |
706 | implements the following methods:\par | |
707 | \indented{2cm}{\begin{twocollist} | |
c9110876 VS |
708 | \twocolitem{{\bf GetSize()}}{Returns a wxSize} |
709 | \twocolitem{{\bf GetSizeTuple()}}{Returns a 2-tuple (width, height)} | |
06d20283 RD |
710 | \end{twocollist}} |
711 | } | |
712 | ||
a660d684 KB |
713 | \membersection{wxWindow::GetTextExtent} |
714 | ||
715 | \constfunc{virtual void}{GetTextExtent}{\param{const wxString\& }{string}, \param{int* }{x}, \param{int* }{y}, | |
716 | \param{int* }{descent = NULL}, \param{int* }{externalLeading = NULL}, | |
8a293590 | 717 | \param{const wxFont* }{font = NULL}, \param{bool}{ use16 = FALSE}} |
a660d684 KB |
718 | |
719 | Gets the dimensions of the string as it would be drawn on the | |
720 | window with the currently selected font. | |
721 | ||
722 | \wxheading{Parameters} | |
723 | ||
724 | \docparam{string}{String whose extent is to be measured.} | |
725 | ||
726 | \docparam{x}{Return value for width.} | |
727 | ||
728 | \docparam{y}{Return value for height.} | |
729 | ||
730 | \docparam{descent}{Return value for descent (optional).} | |
731 | ||
732 | \docparam{externalLeading}{Return value for external leading (optional).} | |
733 | ||
734 | \docparam{font}{Font to use instead of the current window font (optional).} | |
735 | ||
736 | \docparam{use16}{If TRUE, {\it string} contains 16-bit characters. The default is FALSE.} | |
737 | ||
06d20283 RD |
738 | |
739 | \pythonnote{In place of a single overloaded method name, wxPython | |
740 | implements the following methods:\par | |
741 | \indented{2cm}{\begin{twocollist} | |
c9110876 VS |
742 | \twocolitem{{\bf GetTextExtent(string)}}{Returns a 2-tuple, (width, height)} |
743 | \twocolitem{{\bf GetFullTextExtent(string, font=NULL)}}{Returns a | |
06d20283 RD |
744 | 4-tuple, (width, height, descent, externalLeading) } |
745 | \end{twocollist}} | |
746 | } | |
747 | ||
748 | ||
a660d684 KB |
749 | \membersection{wxWindow::GetTitle}\label{wxwindowgettitle} |
750 | ||
751 | \func{virtual wxString}{GetTitle}{\void} | |
752 | ||
753 | Gets the window's title. Applicable only to frames and dialogs. | |
754 | ||
755 | \wxheading{See also} | |
756 | ||
757 | \helpref{wxWindow::SetTitle}{wxwindowsettitle} | |
758 | ||
76c5df24 JS |
759 | \membersection{wxWindow::GetUpdateRegion}\label{wxwindowgetupdateregion} |
760 | ||
761 | \constfunc{virtual wxRegion}{GetUpdateRegion}{\void} | |
762 | ||
763 | Returns the region specifying which parts of the window have been damaged. Should | |
764 | only be called within an \helpref{OnPaint}{wxwindowonpaint} event handler. | |
765 | ||
766 | \wxheading{See also} | |
767 | ||
768 | \helpref{wxRegion}{wxregion}, \helpref{wxRegionIterator}{wxregioniterator}, \helpref{wxWindow::OnPaint}{wxwindowonpaint} | |
769 | ||
aeab10d0 JS |
770 | \membersection{wxWindow::GetValidator}\label{wxwindowgetvalidator} |
771 | ||
772 | \constfunc{wxValidator*}{GetValidator}{\void} | |
773 | ||
774 | Returns a pointer to the current validator for the window, or NULL if there is none. | |
775 | ||
a660d684 KB |
776 | \membersection{wxWindow::GetWindowStyleFlag} |
777 | ||
778 | \constfunc{long}{GetWindowStyleFlag}{\void} | |
779 | ||
7631a292 | 780 | Gets the window style that was passed to the consructor or {\bf Create} member. |
6453876e | 781 | {\bf GetWindowStyle} is synonymous. |
a660d684 KB |
782 | |
783 | \membersection{wxWindow::InitDialog}\label{wxwindowinitdialog} | |
784 | ||
785 | \func{void}{InitDialog}{\void} | |
786 | ||
787 | Sends an \helpref{wxWindow::OnInitDialog}{wxwindowoninitdialog} event, which | |
788 | in turn transfers data to the dialog via validators. | |
789 | ||
790 | \wxheading{See also} | |
791 | ||
792 | \helpref{wxWindow::OnInitDialog}{wxwindowoninitdialog} | |
793 | ||
794 | \membersection{wxWindow::IsEnabled}\label{wxwindowisenabled} | |
795 | ||
796 | \constfunc{virtual bool}{IsEnabled}{\void} | |
797 | ||
798 | Returns TRUE if the window is enabled for input, FALSE otherwise. | |
799 | ||
800 | \wxheading{See also} | |
801 | ||
802 | \helpref{wxWindow::Enable}{wxwindowenable} | |
803 | ||
515da557 | 804 | \membersection{wxWindow:IsExposed}\label{wxwindowisexposed} |
ad9edf45 RR |
805 | |
806 | \constfunc{bool}{IsExposed}{\param{int }{x}, \param{int }{y}} | |
807 | ||
605d715d | 808 | \constfunc{bool}{IsExposed}{\param{wxPoint }{\&pt}} |
515da557 | 809 | |
ad9edf45 RR |
810 | \constfunc{bool}{IsExposed}{\param{int }{x}, \param{int }{y}, \param{int }{w}, \param{int }{h}} |
811 | ||
605d715d | 812 | \constfunc{bool}{IsExposed}{\param{wxRect }{\&rect}} |
515da557 | 813 | |
ad9edf45 RR |
814 | Returns TRUE if the given point or rectange area has been exposed since the |
815 | last repaint. Call this in an paint event handler to optimize redrawing by | |
4130b487 | 816 | only redrawing those areas, which have been exposed. |
ad9edf45 | 817 | |
a660d684 KB |
818 | \membersection{wxWindow::IsRetained}\label{wxwindowisretained} |
819 | ||
820 | \constfunc{virtual bool}{IsRetained}{\void} | |
821 | ||
822 | Returns TRUE if the window is retained, FALSE otherwise. | |
823 | ||
824 | \wxheading{Remarks} | |
825 | ||
826 | Retained windows are only available on X platforms. | |
827 | ||
828 | \membersection{wxWindow::IsShown}\label{wxwindowisshown} | |
829 | ||
830 | \constfunc{virtual bool}{IsShown}{\void} | |
831 | ||
832 | Returns TRUE if the window is shown, FALSE if it has been hidden. | |
833 | ||
34636400 VZ |
834 | \membersection{wxWindow::IsTopLevel}\label{wxwindowistoplevel} |
835 | ||
836 | \constfunc{bool}{IsTopLevel}{\void} | |
837 | ||
838 | Returns TRUE if the given window is a top-level one. Currently all frames and | |
839 | dialogs are considered to be top-level windows (even if they have a parent | |
840 | window). | |
841 | ||
a660d684 KB |
842 | \membersection{wxWindow::Layout}\label{wxwindowlayout} |
843 | ||
844 | \func{void}{Layout}{\void} | |
845 | ||
515da557 RR |
846 | Invokes the constraint-based layout algorithm or the sizer-based algorithm |
847 | for this window. | |
6453876e RR |
848 | |
849 | See \helpref{wxWindow::SetAutoLayout}{wxwindowsetautolayout} on when | |
850 | this function gets called automatically using auto layout. | |
a660d684 KB |
851 | |
852 | \membersection{wxWindow::LoadFromResource}\label{wxwindowloadfromresource} | |
853 | ||
854 | \func{virtual bool}{LoadFromResource}{\param{wxWindow* }{parent},\rtfsp | |
855 | \param{const wxString\& }{resourceName}, \param{const wxResourceTable* }{resourceTable = NULL}} | |
856 | ||
857 | Loads a panel or dialog from a resource file. | |
858 | ||
859 | \wxheading{Parameters} | |
860 | ||
861 | \docparam{parent}{Parent window.} | |
862 | ||
863 | \docparam{resourceName}{The name of the resource to load.} | |
864 | ||
865 | \docparam{resourceTable}{The resource table to load it from. If this is NULL, the | |
866 | default resource table will be used.} | |
867 | ||
868 | \wxheading{Return value} | |
869 | ||
870 | TRUE if the operation succeeded, otherwise FALSE. | |
871 | ||
a660d684 KB |
872 | \membersection{wxWindow::Lower}\label{wxwindowlower} |
873 | ||
874 | \func{void}{Lower}{\void} | |
875 | ||
876 | Lowers the window to the bottom of the window hierarchy if it is a managed window (dialog | |
877 | or frame). | |
878 | ||
879 | \membersection{wxWindow::MakeModal}\label{wxwindowmakemodal} | |
880 | ||
8a293590 | 881 | \func{virtual void}{MakeModal}{\param{bool }{flag}} |
a660d684 KB |
882 | |
883 | Disables all other windows in the application so that | |
6453876e RR |
884 | the user can only interact with this window. (This function |
885 | is not implemented anywhere). | |
a660d684 KB |
886 | |
887 | \wxheading{Parameters} | |
888 | ||
889 | \docparam{flag}{If TRUE, this call disables all other windows in the application so that | |
890 | the user can only interact with this window. If FALSE, the effect is reversed.} | |
891 | ||
892 | \membersection{wxWindow::Move}\label{wxwindowmove} | |
893 | ||
eaaa6a06 | 894 | \func{void}{Move}{\param{int}{ x}, \param{int}{ y}} |
a660d684 | 895 | |
a974387a JS |
896 | \func{void}{Move}{\param{const wxPoint\&}{ pt}} |
897 | ||
a660d684 KB |
898 | Moves the window to the given position. |
899 | ||
900 | \wxheading{Parameters} | |
901 | ||
902 | \docparam{x}{Required x position.} | |
903 | ||
904 | \docparam{y}{Required y position.} | |
905 | ||
a974387a JS |
906 | \docparam{pt}{\helpref{wxPoint}{wxpoint} object representing the position.} |
907 | ||
a660d684 KB |
908 | \wxheading{Remarks} |
909 | ||
910 | Implementations of SetSize can also implicitly implement the | |
911 | wxWindow::Move function, which is defined in the base wxWindow class | |
912 | as the call: | |
913 | ||
914 | \begin{verbatim} | |
915 | SetSize(x, y, -1, -1, wxSIZE_USE_EXISTING); | |
916 | \end{verbatim} | |
917 | ||
918 | \wxheading{See also} | |
919 | ||
920 | \helpref{wxWindow::SetSize}{wxwindowsetsize} | |
921 | ||
06d20283 RD |
922 | \pythonnote{In place of a single overloaded method name, wxPython |
923 | implements the following methods:\par | |
924 | \indented{2cm}{\begin{twocollist} | |
c9110876 VS |
925 | \twocolitem{{\bf Move(point)}}{Accepts a wxPoint} |
926 | \twocolitem{{\bf MoveXY(x, y)}}{Accepts a pair of integers} | |
06d20283 RD |
927 | \end{twocollist}} |
928 | } | |
929 | ||
a660d684 KB |
930 | \membersection{wxWindow::OnActivate}\label{wxwindowonactivate} |
931 | ||
932 | \func{void}{OnActivate}{\param{wxActivateEvent\&}{ event}} | |
933 | ||
934 | Called when a window is activated or deactivated. | |
935 | ||
936 | \wxheading{Parameters} | |
937 | ||
938 | \docparam{event}{Object containing activation information.} | |
939 | ||
940 | \wxheading{Remarks} | |
941 | ||
942 | If the window is being activated, \helpref{wxActivateEvent::GetActive}{wxactivateeventgetactive} returns TRUE, | |
943 | otherwise it returns FALSE (it is being deactivated). | |
944 | ||
945 | \wxheading{See also} | |
946 | ||
947 | \helpref{wxActivateEvent}{wxactivateevent},\rtfsp | |
948 | \helpref{Event handling overview}{eventhandlingoverview} | |
949 | ||
950 | \membersection{wxWindow::OnChar}\label{wxwindowonchar} | |
951 | ||
952 | \func{void}{OnChar}{\param{wxKeyEvent\&}{ event}} | |
953 | ||
818e52c2 | 954 | Called when the user has pressed a key that is not a modifier (SHIFT, CONTROL or ALT). |
a660d684 KB |
955 | |
956 | \wxheading{Parameters} | |
957 | ||
958 | \docparam{event}{Object containing keypress information. See \helpref{wxKeyEvent}{wxkeyevent} for | |
959 | details about this class.} | |
960 | ||
961 | \wxheading{Remarks} | |
962 | ||
963 | This member function is called in response to a keypress. To intercept this event, | |
964 | use the EVT\_CHAR macro in an event table definition. Your {\bf OnChar} handler may call this | |
965 | default function to achieve default keypress functionality. | |
966 | ||
967 | Note that the ASCII values do not have explicit key codes: they are passed as ASCII | |
968 | values. | |
969 | ||
818e52c2 | 970 | Note that not all keypresses can be intercepted this way. If you wish to intercept modifier |
06d20283 | 971 | keypresses, then you will need to use \helpref{wxWindow::OnKeyDown}{wxwindowonkeydown} or |
4ce81a75 JS |
972 | \helpref{wxWindow::OnKeyUp}{wxwindowonkeyup}. |
973 | ||
a660d684 KB |
974 | Most, but not all, windows allow keypresses to be intercepted. |
975 | ||
976 | \wxheading{See also} | |
977 | ||
4ce81a75 | 978 | \helpref{wxWindow::OnKeyDown}{wxwindowonkeydown}, \helpref{wxWindow::OnKeyUp}{wxwindowonkeyup},\rtfsp |
a660d684 KB |
979 | \helpref{wxKeyEvent}{wxkeyevent}, \helpref{wxWindow::OnCharHook}{wxwindowoncharhook},\rtfsp |
980 | \helpref{Event handling overview}{eventhandlingoverview} | |
981 | ||
982 | \membersection{wxWindow::OnCharHook}\label{wxwindowoncharhook} | |
983 | ||
984 | \func{void}{OnCharHook}{\param{wxKeyEvent\&}{ event}} | |
985 | ||
986 | This member is called to allow the window to intercept keyboard events | |
987 | before they are processed by child windows. | |
988 | ||
989 | \wxheading{Parameters} | |
990 | ||
991 | \docparam{event}{Object containing keypress information. See \helpref{wxKeyEvent}{wxkeyevent} for | |
992 | details about this class.} | |
993 | ||
994 | \wxheading{Remarks} | |
995 | ||
996 | This member function is called in response to a keypress, if the window is active. To intercept this event, | |
997 | use the EVT\_CHAR\_HOOK macro in an event table definition. If you do not process a particular | |
998 | keypress, call \helpref{wxEvent::Skip}{wxeventskip} to allow default processing. | |
999 | ||
1000 | An example of using this function is in the implementation of escape-character processing for wxDialog, | |
1001 | where pressing ESC dismisses the dialog by {\bf OnCharHook} 'forging' a cancel button press event. | |
1002 | ||
1003 | Note that the ASCII values do not have explicit key codes: they are passed as ASCII | |
1004 | values. | |
1005 | ||
1006 | This function is only relevant to top-level windows (frames and dialogs), and under | |
6453876e RR |
1007 | Windows only. Under GTK the normal EVT\_CHAR\_ event has the functionality, i.e. |
1008 | you can intercepts it and if you don't call \helpref{wxEvent::Skip}{wxeventskip} | |
1009 | the window won't get the event. | |
a660d684 KB |
1010 | |
1011 | \wxheading{See also} | |
1012 | ||
1013 | \helpref{wxKeyEvent}{wxkeyevent}, \helpref{wxWindow::OnCharHook}{wxwindowoncharhook},\rtfsp | |
1014 | \helpref{wxApp::OnCharHook}{wxapponcharhook},\rtfsp | |
1015 | \helpref{Event handling overview}{eventhandlingoverview} | |
1016 | ||
1017 | \membersection{wxWindow::OnCommand}\label{wxwindowoncommand} | |
1018 | ||
1019 | \func{virtual void}{OnCommand}{\param{wxEvtHandler\& }{object}, \param{wxCommandEvent\& }{event}} | |
1020 | ||
1021 | This virtual member function is called if the control does not handle the command event. | |
1022 | ||
1023 | \wxheading{Parameters} | |
1024 | ||
1025 | \docparam{object}{Object receiving the command event.} | |
1026 | ||
1027 | \docparam{event}{Command event} | |
1028 | ||
1029 | \wxheading{Remarks} | |
1030 | ||
1031 | This virtual function is provided mainly for backward compatibility. You can also intercept commands | |
1032 | from child controls by using an event table, with identifiers or identifier ranges to identify | |
1033 | the control(s) in question. | |
1034 | ||
1035 | \wxheading{See also} | |
1036 | ||
1037 | \helpref{wxCommandEvent}{wxcommandevent},\rtfsp | |
1038 | \helpref{Event handling overview}{eventhandlingoverview} | |
1039 | ||
1040 | \membersection{wxWindow::OnClose}\label{wxwindowonclose} | |
1041 | ||
1042 | \func{virtual bool}{OnClose}{\void} | |
1043 | ||
1044 | Called when the user has tried to close a a frame | |
1045 | or dialog box using the window manager (X) or system menu (Windows). | |
1046 | ||
e3065973 | 1047 | {\bf Note:} This is an obsolete function. |
a660d684 KB |
1048 | It is superceded by the \helpref{wxWindow::OnCloseWindow}{wxwindowonclosewindow} event |
1049 | handler. | |
1050 | ||
1051 | \wxheading{Return value} | |
1052 | ||
1053 | If TRUE is returned by OnClose, the window will be deleted by the system, otherwise the | |
1054 | attempt will be ignored. Do not delete the window from within this handler, although | |
1055 | you may delete other windows. | |
1056 | ||
a660d684 KB |
1057 | \wxheading{See also} |
1058 | ||
1059 | \helpref{Window deletion overview}{windowdeletionoverview},\rtfsp | |
1060 | \helpref{wxWindow::Close}{wxwindowclose},\rtfsp | |
1061 | \helpref{wxWindow::OnCloseWindow}{wxwindowonclosewindow},\rtfsp | |
1062 | \helpref{wxCloseEvent}{wxcloseevent} | |
1063 | ||
1064 | \membersection{wxWindow::OnCloseWindow}\label{wxwindowonclosewindow} | |
1065 | ||
1066 | \func{void}{OnCloseWindow}{\param{wxCloseEvent\& }{event}} | |
1067 | ||
1068 | This is an event handler function called when the user has tried to close a a frame | |
1069 | or dialog box using the window manager (X) or system menu (Windows). It is | |
1070 | called via the \helpref{wxWindow::Close}{wxwindowclose} function, so | |
1071 | that the application can also invoke the handler programmatically. | |
1072 | ||
1073 | Use the EVT\_CLOSE event table macro to handle close events. | |
1074 | ||
1075 | You should check whether the application is forcing the deletion of the window | |
1076 | using \helpref{wxCloseEvent::GetForce}{wxcloseeventgetforce}. If this is TRUE, | |
1077 | destroy the window using \helpref{wxWindow::Destroy}{wxwindowdestroy}. | |
1078 | If not, it is up to you whether you respond by destroying the window. | |
1079 | ||
387a3b02 JS |
1080 | (Note: GetForce is now superceded by CanVeto. So to test whether forced destruction of |
1081 | the window is required, test for the negative of CanVeto. If CanVeto returns FALSE, | |
1082 | it is not possible to skip window deletion.) | |
1083 | ||
1084 | If you don't destroy the window, you should call \helpref{wxCloseEvent::Veto}{wxcloseeventveto} to | |
1085 | let the calling code know that you did not destroy the window. This allows the \helpref{wxWindow::Close}{wxwindowclose} function | |
1086 | to return TRUE or FALSE depending on whether the close instruction was honoured or not. | |
1087 | ||
a660d684 KB |
1088 | \wxheading{Remarks} |
1089 | ||
1090 | The \helpref{wxWindow::OnClose}{wxwindowonclose} virtual function remains | |
1091 | for backward compatibility with earlier versions of wxWindows. The | |
1092 | default {\bf OnCloseWindow} handler for wxFrame and wxDialog will call {\bf OnClose}, | |
1093 | destroying the window if it returns TRUE or if the close is being forced. | |
1094 | ||
1095 | \wxheading{See also} | |
1096 | ||
1097 | \helpref{Window deletion overview}{windowdeletionoverview},\rtfsp | |
1098 | \helpref{wxWindow::Close}{wxwindowclose},\rtfsp | |
1099 | \helpref{wxWindow::OnClose}{wxwindowonclose},\rtfsp | |
1100 | \helpref{wxWindow::Destroy}{wxwindowdestroy},\rtfsp | |
387a3b02 JS |
1101 | \helpref{wxCloseEvent}{wxcloseevent},\rtfsp |
1102 | \helpref{wxApp::OnQueryEndSession}{wxapponqueryendsession},\rtfsp | |
1103 | \helpref{wxApp::OnEndSession}{wxapponendsession} | |
a660d684 | 1104 | |
a660d684 KB |
1105 | \membersection{wxWindow::OnDropFiles}\label{wxwindowondropfiles} |
1106 | ||
1107 | \func{void}{OnDropFiles}{\param{wxDropFilesEvent\&}{ event}} | |
1108 | ||
1109 | Called when files have been dragged from the file manager to the window. | |
1110 | ||
1111 | \wxheading{Parameters} | |
1112 | ||
1113 | \docparam{event}{Drop files event. For more information, see \helpref{wxDropFilesEvent}{wxdropfilesevent}.} | |
1114 | ||
1115 | \wxheading{Remarks} | |
1116 | ||
1117 | The window must have previously been enabled for dropping by calling | |
1118 | \rtfsp\helpref{wxWindow::DragAcceptFiles}{wxwindowdragacceptfiles}. | |
1119 | ||
1120 | This event is only generated under Windows. | |
1121 | ||
1122 | To intercept this event, use the EVT\_DROP\_FILES macro in an event table definition. | |
1123 | ||
1124 | \wxheading{See also} | |
1125 | ||
1126 | \helpref{wxDropFilesEvent}{wxdropfilesevent}, \helpref{wxWindow::DragAcceptFiles}{wxwindowdragacceptfiles},\rtfsp | |
1127 | \helpref{Event handling overview}{eventhandlingoverview} | |
1128 | ||
1129 | \membersection{wxWindow::OnEraseBackground}\label{wxwindowonerasebackground} | |
1130 | ||
1131 | \func{void}{OnEraseBackground}{\param{wxEraseEvent\&}{ event}} | |
1132 | ||
1133 | Called when the background of the window needs to be erased. | |
1134 | ||
1135 | \wxheading{Parameters} | |
1136 | ||
1137 | \docparam{event}{Erase background event. For more information, see \helpref{wxEraseEvent}{wxeraseevent}.} | |
1138 | ||
1139 | \wxheading{Remarks} | |
1140 | ||
6453876e RR |
1141 | This event is only generated under Windows. It is therefore recommended that |
1142 | you set the text background colour explicitly in order to prevent flicker. | |
1143 | The default background colour under GTK is grey. | |
a660d684 KB |
1144 | |
1145 | To intercept this event, use the EVT\_ERASE\_BACKGROUND macro in an event table definition. | |
1146 | ||
1147 | \wxheading{See also} | |
1148 | ||
1149 | \helpref{wxEraseEvent}{wxeraseevent}, \helpref{Event handling overview}{eventhandlingoverview} | |
1150 | ||
4ce81a75 JS |
1151 | \membersection{wxWindow::OnKeyDown}\label{wxwindowonkeydown} |
1152 | ||
1153 | \func{void}{OnKeyDown}{\param{wxKeyEvent\&}{ event}} | |
1154 | ||
1155 | Called when the user has pressed a key, before it is translated into an ASCII value using other | |
1156 | modifier keys that might be pressed at the same time. | |
1157 | ||
1158 | \wxheading{Parameters} | |
1159 | ||
1160 | \docparam{event}{Object containing keypress information. See \helpref{wxKeyEvent}{wxkeyevent} for | |
1161 | details about this class.} | |
1162 | ||
1163 | \wxheading{Remarks} | |
1164 | ||
1165 | This member function is called in response to a key down event. To intercept this event, | |
1166 | use the EVT\_KEY\_DOWN macro in an event table definition. Your {\bf OnKeyDown} handler may call this | |
1167 | default function to achieve default keypress functionality. | |
1168 | ||
1169 | Note that not all keypresses can be intercepted this way. If you wish to intercept special | |
06d20283 | 1170 | keys, such as shift, control, and function keys, then you will need to use \helpref{wxWindow::OnKeyDown}{wxwindowonkeydown} or |
4ce81a75 JS |
1171 | \helpref{wxWindow::OnKeyUp}{wxwindowonkeyup}. |
1172 | ||
1173 | Most, but not all, windows allow keypresses to be intercepted. | |
1174 | ||
1175 | \wxheading{See also} | |
1176 | ||
1177 | \helpref{wxWindow::OnChar}{wxwindowonchar}, \helpref{wxWindow::OnKeyUp}{wxwindowonkeyup},\rtfsp | |
1178 | \helpref{wxKeyEvent}{wxkeyevent}, \helpref{wxWindow::OnCharHook}{wxwindowoncharhook},\rtfsp | |
1179 | \helpref{Event handling overview}{eventhandlingoverview} | |
1180 | ||
1181 | \membersection{wxWindow::OnKeyUp}\label{wxwindowonkeyup} | |
1182 | ||
1183 | \func{void}{OnKeyUp}{\param{wxKeyEvent\&}{ event}} | |
1184 | ||
1185 | Called when the user has released a key. | |
1186 | ||
1187 | \wxheading{Parameters} | |
1188 | ||
1189 | \docparam{event}{Object containing keypress information. See \helpref{wxKeyEvent}{wxkeyevent} for | |
1190 | details about this class.} | |
1191 | ||
1192 | \wxheading{Remarks} | |
1193 | ||
1194 | This member function is called in response to a key up event. To intercept this event, | |
1195 | use the EVT\_KEY\_UP macro in an event table definition. Your {\bf OnKeyUp} handler may call this | |
1196 | default function to achieve default keypress functionality. | |
1197 | ||
1198 | Note that not all keypresses can be intercepted this way. If you wish to intercept special | |
06d20283 | 1199 | keys, such as shift, control, and function keys, then you will need to use \helpref{wxWindow::OnKeyDown}{wxwindowonkeydown} or |
4ce81a75 JS |
1200 | \helpref{wxWindow::OnKeyUp}{wxwindowonkeyup}. |
1201 | ||
1202 | Most, but not all, windows allow key up events to be intercepted. | |
1203 | ||
1204 | \wxheading{See also} | |
1205 | ||
1206 | \helpref{wxWindow::OnChar}{wxwindowonchar}, \helpref{wxWindow::OnKeyDown}{wxwindowonkeydown},\rtfsp | |
1207 | \helpref{wxKeyEvent}{wxkeyevent}, \helpref{wxWindow::OnCharHook}{wxwindowoncharhook},\rtfsp | |
1208 | \helpref{Event handling overview}{eventhandlingoverview} | |
1209 | ||
a660d684 KB |
1210 | \membersection{wxWindow::OnKillFocus}\label{wxwindowonkillfocus} |
1211 | ||
1212 | \func{void}{OnKillFocus}{\param{wxFocusEvent\& }{event}} | |
1213 | ||
1214 | Called when a window's focus is being killed. | |
1215 | ||
1216 | \wxheading{Parameters} | |
1217 | ||
1218 | \docparam{event}{The focus event. For more information, see \helpref{wxFocusEvent}{wxfocusevent}.} | |
1219 | ||
1220 | \wxheading{Remarks} | |
1221 | ||
1222 | To intercept this event, use the macro EVT\_KILL\_FOCUS in an event table definition. | |
1223 | ||
1224 | Most, but not all, windows respond to this event. | |
1225 | ||
1226 | \wxheading{See also} | |
1227 | ||
1228 | \helpref{wxFocusEvent}{wxfocusevent}, \helpref{wxWindow::OnSetFocus}{wxwindowonsetfocus},\rtfsp | |
1229 | \helpref{Event handling overview}{eventhandlingoverview} | |
1230 | ||
1231 | \membersection{wxWindow::OnIdle}\label{wxwindowonidle} | |
1232 | ||
6e6110ee | 1233 | \func{void}{OnIdle}{\param{wxIdleEvent\& }{event}} |
a660d684 KB |
1234 | |
1235 | Provide this member function for any processing which needs to be done | |
1236 | when the application is idle. | |
1237 | ||
1238 | \wxheading{See also} | |
1239 | ||
1240 | \helpref{wxApp::OnIdle}{wxapponidle}, \helpref{wxIdleEvent}{wxidleevent} | |
1241 | ||
1242 | \membersection{wxWindow::OnInitDialog}\label{wxwindowoninitdialog} | |
1243 | ||
1244 | \func{void}{OnInitDialog}{\param{wxInitDialogEvent\&}{ event}} | |
1245 | ||
1246 | Default handler for the wxEVT\_INIT\_DIALOG event. Calls \helpref{wxWindow::TransferDataToWindow}{wxwindowtransferdatatowindow}. | |
1247 | ||
1248 | \wxheading{Parameters} | |
1249 | ||
1250 | \docparam{event}{Dialog initialisation event.} | |
1251 | ||
1252 | \wxheading{Remarks} | |
1253 | ||
1254 | Gives the window the default behaviour of transferring data to child controls via | |
1255 | the validator that each control has. | |
1256 | ||
1257 | \wxheading{See also} | |
1258 | ||
1259 | \helpref{wxValidator}{wxvalidator}, \helpref{wxWindow::TransferDataToWindow}{wxwindowtransferdatatowindow} | |
1260 | ||
1261 | \membersection{wxWindow::OnMenuCommand}\label{wxwindowonmenucommand} | |
1262 | ||
1263 | \func{void}{OnMenuCommand}{\param{wxCommandEvent\& }{event}} | |
1264 | ||
1265 | Called when a menu command is received from a menu bar. | |
1266 | ||
1267 | \wxheading{Parameters} | |
1268 | ||
1269 | \docparam{event}{The menu command event. For more information, see \helpref{wxCommandEvent}{wxcommandevent}.} | |
1270 | ||
1271 | \wxheading{Remarks} | |
1272 | ||
1273 | A function with this name doesn't actually exist; you can choose any member function to receive | |
1274 | menu command events, using the EVT\_COMMAND macro for individual commands or EVT\_COMMAND\_RANGE for | |
1275 | a range of commands. | |
1276 | ||
1277 | \wxheading{See also} | |
1278 | ||
1279 | \helpref{wxCommandEvent}{wxcommandevent},\rtfsp | |
1280 | \helpref{wxWindow::OnMenuHighlight}{wxwindowonmenuhighlight},\rtfsp | |
1281 | \helpref{Event handling overview}{eventhandlingoverview} | |
1282 | ||
1283 | \membersection{wxWindow::OnMenuHighlight}\label{wxwindowonmenuhighlight} | |
1284 | ||
1285 | \func{void}{OnMenuHighlight}{\param{wxMenuEvent\& }{event}} | |
1286 | ||
1287 | Called when a menu select is received from a menu bar: that is, the | |
1288 | mouse cursor is over a menu item, but the left mouse button has not been | |
1289 | pressed. | |
1290 | ||
1291 | \wxheading{Parameters} | |
1292 | ||
1293 | \docparam{event}{The menu highlight event. For more information, see \helpref{wxMenuEvent}{wxmenuevent}.} | |
1294 | ||
1295 | \wxheading{Remarks} | |
1296 | ||
1297 | You can choose any member function to receive | |
1298 | menu select events, using the EVT\_MENU\_HIGHLIGHT macro for individual menu items or EVT\_MENU\_HIGHLIGHT\_ALL macro | |
1299 | for all menu items. | |
1300 | ||
1301 | The default implementation for \helpref{wxFrame::OnMenuHighlight}{wxframeonmenuhighlight} displays help | |
1302 | text in the first field of the status bar. | |
1303 | ||
1304 | This function was known as {\bf OnMenuSelect} in earlier versions of wxWindows, but this was confusing | |
1305 | since a selection is normally a left-click action. | |
1306 | ||
1307 | \wxheading{See also} | |
1308 | ||
1309 | \helpref{wxMenuEvent}{wxmenuevent},\rtfsp | |
1310 | \helpref{wxWindow::OnMenuCommand}{wxwindowonmenucommand},\rtfsp | |
1311 | \helpref{Event handling overview}{eventhandlingoverview} | |
1312 | ||
1313 | ||
1314 | \membersection{wxWindow::OnMouseEvent}\label{wxwindowonmouseevent} | |
1315 | ||
1316 | \func{void}{OnMouseEvent}{\param{wxMouseEvent\&}{ event}} | |
1317 | ||
1318 | Called when the user has initiated an event with the | |
1319 | mouse. | |
1320 | ||
1321 | \wxheading{Parameters} | |
1322 | ||
1323 | \docparam{event}{The mouse event. See \helpref{wxMouseEvent}{wxmouseevent} for | |
1324 | more details.} | |
1325 | ||
1326 | \wxheading{Remarks} | |
1327 | ||
1328 | Most, but not all, windows respond to this event. | |
1329 | ||
1330 | To intercept this event, use the EVT\_MOUSE\_EVENTS macro in an event table definition, or individual | |
1331 | mouse event macros such as EVT\_LEFT\_DOWN. | |
1332 | ||
1333 | \wxheading{See also} | |
1334 | ||
1335 | \helpref{wxMouseEvent}{wxmouseevent},\rtfsp | |
1336 | \helpref{Event handling overview}{eventhandlingoverview} | |
1337 | ||
1338 | \membersection{wxWindow::OnMove}\label{wxwindowonmove} | |
1339 | ||
1340 | \func{void}{OnMove}{\param{wxMoveEvent\& }{event}} | |
1341 | ||
1342 | Called when a window is moved. | |
1343 | ||
1344 | \wxheading{Parameters} | |
1345 | ||
1346 | \docparam{event}{The move event. For more information, see \helpref{wxMoveEvent}{wxmoveevent}.} | |
1347 | ||
1348 | \wxheading{Remarks} | |
1349 | ||
1350 | Use the EVT\_MOVE macro to intercept move events. | |
1351 | ||
1352 | \wxheading{Remarks} | |
1353 | ||
1354 | Not currently implemented. | |
1355 | ||
1356 | \wxheading{See also} | |
1357 | ||
1358 | \helpref{wxMoveEvent}{wxmoveevent},\rtfsp | |
1359 | \helpref{wxFrame::OnSize}{wxframeonsize},\rtfsp | |
1360 | \helpref{Event handling overview}{eventhandlingoverview} | |
1361 | ||
1362 | \membersection{wxWindow::OnPaint}\label{wxwindowonpaint} | |
1363 | ||
1364 | \func{void}{OnPaint}{\param{wxPaintEvent\& }{event}} | |
1365 | ||
1366 | Sent to the event handler when the window must be refreshed. | |
1367 | ||
1368 | \wxheading{Parameters} | |
1369 | ||
1370 | \docparam{event}{Paint event. For more information, see \helpref{wxPaintEvent}{wxpaintevent}.} | |
1371 | ||
1372 | \wxheading{Remarks} | |
1373 | ||
1374 | Use the EVT\_PAINT macro in an event table definition to intercept paint events. | |
1375 | ||
1376 | In a paint event handler, the application should always create a \helpref{wxPaintDC}{wxpaintdc} object. | |
1377 | ||
1378 | For example: | |
1379 | ||
1380 | \small{% | |
1381 | \begin{verbatim} | |
605d715d | 1382 | void MyWindow::OnPaint(wxPaintEvent\& event) |
a660d684 KB |
1383 | { |
1384 | wxPaintDC dc(this); | |
1385 | ||
1386 | DrawMyDocument(dc); | |
1387 | } | |
1388 | \end{verbatim} | |
1389 | }% | |
1390 | ||
1391 | You can optimize painting by retrieving the rectangles | |
1392 | that have been damaged and only repainting these. The rectangles are in | |
1393 | terms of the client area, and are unscrolled, so you will need to do | |
1394 | some calculations using the current view position to obtain logical, | |
1395 | scrolled units. | |
1396 | ||
76c5df24 | 1397 | Here is an example of using the \helpref{wxRegionIterator}{wxregioniterator} class: |
a660d684 KB |
1398 | |
1399 | {\small% | |
1400 | \begin{verbatim} | |
1401 | // Called when window needs to be repainted. | |
605d715d | 1402 | void MyWindow::OnPaint(wxPaintEvent\& event) |
a660d684 KB |
1403 | { |
1404 | wxPaintDC dc(this); | |
1405 | ||
1406 | // Find Out where the window is scrolled to | |
1407 | int vbX,vbY; // Top left corner of client | |
1408 | ViewStart(&vbX,&vbY); | |
1409 | ||
1410 | int vX,vY,vW,vH; // Dimensions of client area in pixels | |
76c5df24 | 1411 | wxRegionIterator upd(GetUpdateRegion()); // get the update rect list |
a660d684 KB |
1412 | |
1413 | while (upd) | |
1414 | { | |
1415 | vX = upd.GetX(); | |
1416 | vY = upd.GetY(); | |
1417 | vW = upd.GetW(); | |
1418 | vH = upd.GetH(); | |
1419 | ||
1420 | // Alternatively we can do this: | |
1421 | // wxRect rect; | |
1422 | // upd.GetRect(&rect); | |
1423 | ||
1424 | // Repaint this rectangle | |
1425 | ...some code... | |
1426 | ||
1427 | upd ++ ; | |
1428 | } | |
1429 | } | |
1430 | \end{verbatim} | |
1431 | }% | |
1432 | ||
1433 | \wxheading{See also} | |
1434 | ||
1435 | \helpref{wxPaintEvent}{wxpaintevent},\rtfsp | |
1436 | \helpref{wxPaintDC}{wxpaintdc},\rtfsp | |
1437 | \helpref{Event handling overview}{eventhandlingoverview} | |
1438 | ||
b82827dd JS |
1439 | \membersection{wxWindow::OnScroll}\label{wxwindowonscroll} |
1440 | ||
5f1ea0ee | 1441 | \func{void}{OnScroll}{\param{wxScrollWinEvent\& }{event}} |
a660d684 | 1442 | |
5f1ea0ee | 1443 | Called when a scroll window event is received from one of the window's built-in scrollbars. |
a660d684 KB |
1444 | |
1445 | \wxheading{Parameters} | |
1446 | ||
1447 | \docparam{event}{Command event. Retrieve the new scroll position by | |
1448 | calling \helpref{wxScrollEvent::GetPosition}{wxscrolleventgetposition}, and the | |
1449 | scrollbar orientation by calling \helpref{wxScrollEvent::GetOrientation}{wxscrolleventgetorientation}.} | |
1450 | ||
1451 | \wxheading{Remarks} | |
1452 | ||
1453 | Note that it is not possible to distinguish between horizontal and vertical scrollbars | |
1454 | until the function is executing (you can't have one function for vertical, another | |
1455 | for horizontal events). | |
1456 | ||
1457 | \wxheading{See also} | |
1458 | ||
5f1ea0ee | 1459 | \helpref{wxScrollWinEvent}{wxscrollwinevent},\rtfsp |
a660d684 KB |
1460 | \helpref{Event handling overview}{eventhandlingoverview} |
1461 | ||
1462 | \membersection{wxWindow::OnSetFocus}\label{wxwindowonsetfocus} | |
1463 | ||
1464 | \func{void}{OnSetFocus}{\param{wxFocusEvent\& }{event}} | |
1465 | ||
1466 | Called when a window's focus is being set. | |
1467 | ||
1468 | \wxheading{Parameters} | |
1469 | ||
1470 | \docparam{event}{The focus event. For more information, see \helpref{wxFocusEvent}{wxfocusevent}.} | |
1471 | ||
1472 | \wxheading{Remarks} | |
1473 | ||
1474 | To intercept this event, use the macro EVT\_SET\_FOCUS in an event table definition. | |
1475 | ||
1476 | Most, but not all, windows respond to this event. | |
1477 | ||
1478 | \wxheading{See also} | |
1479 | ||
1480 | \helpref{wxFocusEvent}{wxfocusevent}, \helpref{wxWindow::OnKillFocus}{wxwindowonkillfocus},\rtfsp | |
1481 | \helpref{Event handling overview}{eventhandlingoverview} | |
1482 | ||
1483 | \membersection{wxWindow::OnSize}\label{wxwindowonsize} | |
1484 | ||
1485 | \func{void}{OnSize}{\param{wxSizeEvent\& }{event}} | |
1486 | ||
1487 | Called when the window has been resized. | |
1488 | ||
1489 | \wxheading{Parameters} | |
1490 | ||
1491 | \docparam{event}{Size event. For more information, see \helpref{wxSizeEvent}{wxsizeevent}.} | |
1492 | ||
1493 | \wxheading{Remarks} | |
1494 | ||
1495 | You may wish to use this for frames to resize their child windows as appropriate. | |
1496 | ||
1497 | Note that the size passed is of | |
1498 | the whole window: call \helpref{wxWindow::GetClientSize}{wxwindowgetclientsize} for the area which may be | |
1499 | used by the application. | |
1500 | ||
1501 | \wxheading{See also} | |
1502 | ||
1503 | \helpref{wxSizeEvent}{wxsizeevent},\rtfsp | |
1504 | \helpref{Event handling overview}{eventhandlingoverview} | |
1505 | ||
1506 | \membersection{wxWindow::OnSysColourChanged}\label{wxwindowonsyscolourchanged} | |
1507 | ||
1508 | \func{void}{OnSysColourChanged}{\param{wxOnSysColourChangedEvent\& }{event}} | |
1509 | ||
6453876e | 1510 | Called when the user has changed the system colours. Windows only. |
a660d684 KB |
1511 | |
1512 | \wxheading{Parameters} | |
1513 | ||
1514 | \docparam{event}{System colour change event. For more information, see \helpref{wxSysColourChangedEvent}{wxsyscolourchangedevent}.} | |
1515 | ||
1516 | \wxheading{See also} | |
1517 | ||
1518 | \helpref{wxSysColourChangedEvent}{wxsyscolourchangedevent},\rtfsp | |
1519 | \helpref{Event handling overview}{eventhandlingoverview} | |
1520 | ||
1521 | \membersection{wxWindow::PopEventHandler}\label{wxwindowpopeventhandler} | |
1522 | ||
1523 | \constfunc{wxEvtHandler*}{PopEventHandler}{\param{bool }{deleteHandler = FALSE}} | |
1524 | ||
1525 | Removes and returns the top-most event handler on the event handler stack. | |
1526 | ||
1527 | \wxheading{Parameters} | |
1528 | ||
1529 | \docparam{deleteHandler}{If this is TRUE, the handler will be deleted after it is removed. The | |
1530 | default value is FALSE.} | |
1531 | ||
1532 | \wxheading{See also} | |
1533 | ||
1534 | \helpref{wxWindow::SetEventHandler}{wxwindowseteventhandler},\rtfsp | |
1535 | \helpref{wxWindow::GetEventHandler}{wxwindowgeteventhandler},\rtfsp | |
1536 | \helpref{wxWindow::PushEventHandler}{wxwindowpusheventhandler},\rtfsp | |
1537 | \helpref{wxEvtHandler::ProcessEvent}{wxevthandlerprocessevent},\rtfsp | |
1538 | \helpref{wxEvtHandler}{wxevthandler}\rtfsp | |
1539 | ||
1540 | \membersection{wxWindow::PopupMenu}\label{wxwindowpopupmenu} | |
1541 | ||
605d715d | 1542 | \func{bool}{PopupMenu}{\param{wxMenu* }{menu}, \param{const wxPoint\& }{pos}} |
a1665b22 VZ |
1543 | |
1544 | \func{bool}{PopupMenu}{\param{wxMenu* }{menu}, \param{int }{x}, \param{int }{y}} | |
a660d684 KB |
1545 | |
1546 | Pops up the given menu at the specified coordinates, relative to this | |
1547 | window, and returns control when the user has dismissed the menu. If a | |
a1665b22 VZ |
1548 | menu item is selected, the corresponding menu event is generated and will be |
1549 | processed as usually. | |
a660d684 KB |
1550 | |
1551 | \wxheading{Parameters} | |
1552 | ||
1553 | \docparam{menu}{Menu to pop up.} | |
1554 | ||
a1665b22 VZ |
1555 | \docparam{pos}{The position where the menu will appear.} |
1556 | ||
a660d684 KB |
1557 | \docparam{x}{Required x position for the menu to appear.} |
1558 | ||
1559 | \docparam{y}{Required y position for the menu to appear.} | |
1560 | ||
a660d684 KB |
1561 | \wxheading{See also} |
1562 | ||
631f1bfe JS |
1563 | \helpref{wxMenu}{wxmenu} |
1564 | ||
1565 | \wxheading{Remarks} | |
1566 | ||
1567 | Just before the menu is popped up, \helpref{wxMenu::UpdateUI}{wxmenuupdateui} is called | |
2259e007 RR |
1568 | to ensure that the menu items are in the correct state. The menu does not get deleted |
1569 | by the window. | |
a660d684 | 1570 | |
dfa13ec8 RD |
1571 | \pythonnote{In place of a single overloaded method name, wxPython |
1572 | implements the following methods:\par | |
1573 | \indented{2cm}{\begin{twocollist} | |
c9110876 VS |
1574 | \twocolitem{{\bf PopupMenu(menu, point)}}{Specifies position with a wxPoint} |
1575 | \twocolitem{{\bf PopupMenuXY(menu, x, y)}}{Specifies position with two integers (x, y)} | |
dfa13ec8 RD |
1576 | \end{twocollist}} |
1577 | } | |
1578 | ||
a660d684 KB |
1579 | \membersection{wxWindow::PushEventHandler}\label{wxwindowpusheventhandler} |
1580 | ||
1581 | \func{void}{PushEventHandler}{\param{wxEvtHandler* }{handler}} | |
1582 | ||
1583 | Pushes this event handler onto the event stack for the window. | |
1584 | ||
1585 | \wxheading{Parameters} | |
1586 | ||
1587 | \docparam{handler}{Specifies the handler to be pushed.} | |
1588 | ||
1589 | \wxheading{Remarks} | |
1590 | ||
1591 | An event handler is an object that is capable of processing the events | |
1592 | sent to a window. By default, the window is its own event handler, but | |
1593 | an application may wish to substitute another, for example to allow | |
1594 | central implementation of event-handling for a variety of different | |
1595 | window classes. | |
1596 | ||
1597 | \helpref{wxWindow::PushEventHandler}{wxwindowpusheventhandler} allows | |
1598 | an application to set up a chain of event handlers, where an event not handled by one event handler is | |
1599 | handed to the next one in the chain. Use \helpref{wxWindow::PopEventHandler}{wxwindowpopeventhandler} to | |
1600 | remove the event handler. | |
1601 | ||
1602 | \wxheading{See also} | |
1603 | ||
1604 | \helpref{wxWindow::SetEventHandler}{wxwindowseteventhandler},\rtfsp | |
1605 | \helpref{wxWindow::GetEventHandler}{wxwindowgeteventhandler},\rtfsp | |
1606 | \helpref{wxWindow::PopEventHandler}{wxwindowpusheventhandler},\rtfsp | |
1607 | \helpref{wxEvtHandler::ProcessEvent}{wxevthandlerprocessevent},\rtfsp | |
1608 | \helpref{wxEvtHandler}{wxevthandler} | |
1609 | ||
1610 | \membersection{wxWindow::Raise}\label{wxwindowraise} | |
1611 | ||
1612 | \func{void}{Raise}{\void} | |
1613 | ||
1614 | Raises the window to the top of the window hierarchy if it is a managed window (dialog | |
1615 | or frame). | |
1616 | ||
1617 | \membersection{wxWindow::Refresh}\label{wxwindowrefresh} | |
1618 | ||
8a293590 | 1619 | \func{virtual void}{Refresh}{\param{bool}{ eraseBackground = TRUE}, \param{const wxRect* }{rect |
a660d684 KB |
1620 | = NULL}} |
1621 | ||
1622 | Causes a message or event to be generated to repaint the | |
1623 | window. | |
1624 | ||
1625 | \wxheading{Parameters} | |
1626 | ||
1627 | \docparam{eraseBackground}{If TRUE, the background will be | |
1628 | erased.} | |
1629 | ||
1630 | \docparam{rect}{If non-NULL, only the given rectangle will | |
1631 | be treated as damaged.} | |
1632 | ||
1633 | \membersection{wxWindow::ReleaseMouse}\label{wxwindowreleasemouse} | |
1634 | ||
1635 | \func{virtual void}{ReleaseMouse}{\void} | |
1636 | ||
1637 | Releases mouse input captured with \helpref{wxWindow::CaptureMouse}{wxwindowcapturemouse}. | |
1638 | ||
1639 | \wxheading{See also} | |
1640 | ||
1641 | \helpref{wxWindow::CaptureMouse}{wxwindowcapturemouse} | |
1642 | ||
1643 | \membersection{wxWindow::RemoveChild}\label{wxwindowremovechild} | |
1644 | ||
1645 | \func{virtual void}{RemoveChild}{\param{wxWindow* }{child}} | |
1646 | ||
1647 | Removes a child window. This is called automatically by window deletion | |
1648 | functions so should not be required by the application programmer. | |
1649 | ||
1650 | \wxheading{Parameters} | |
1651 | ||
1652 | \docparam{child}{Child window to remove.} | |
1653 | ||
2259e007 RR |
1654 | \membersection{wxWindow::Reparent}\label{wxwindowreparent} |
1655 | ||
1656 | \func{virtual bool}{Reparent}{\param{wxWindow* }{newParent}} | |
1657 | ||
1658 | Reparents the window, i.e the window will be removed from its | |
18ac8d69 | 1659 | current parent window (e.g. a non-standard toolbar in a wxFrame) |
2259e007 RR |
1660 | and then re-inserted into another (e.g. a wxMiniFrame for a |
1661 | floating toolbar). Available on Windows and GTK+. | |
1662 | ||
1663 | \wxheading{Parameters} | |
1664 | ||
1665 | \docparam{newParent}{New parent.} | |
1666 | ||
a974387a | 1667 | \membersection{wxWindow::ScreenToClient}\label{wxwindowscreentoclient} |
a660d684 KB |
1668 | |
1669 | \constfunc{virtual void}{ScreenToClient}{\param{int* }{x}, \param{int* }{y}} | |
1670 | ||
a974387a JS |
1671 | \constfunc{virtual wxPoint}{ScreenToClient}{\param{const wxPoint\& }{pt}} |
1672 | ||
a660d684 KB |
1673 | Converts from screen to client window coordinates. |
1674 | ||
1675 | \wxheading{Parameters} | |
1676 | ||
1677 | \docparam{x}{Stores the screen x coordinate and receives the client x coordinate.} | |
1678 | ||
1679 | \docparam{y}{Stores the screen x coordinate and receives the client x coordinate.} | |
1680 | ||
a974387a JS |
1681 | \docparam{pt}{The screen position for the second form of the function.} |
1682 | ||
06d20283 RD |
1683 | \pythonnote{In place of a single overloaded method name, wxPython |
1684 | implements the following methods:\par | |
1685 | \indented{2cm}{\begin{twocollist} | |
c9110876 VS |
1686 | \twocolitem{{\bf ScreenToClient(point)}}{Accepts and returns a wxPoint} |
1687 | \twocolitem{{\bf ScreenToClientXY(x, y)}}{Returns a 2-tuple, (x, y)} | |
06d20283 RD |
1688 | \end{twocollist}} |
1689 | } | |
1690 | ||
1691 | ||
a660d684 KB |
1692 | \membersection{wxWindow::ScrollWindow}\label{wxwindowscrollwindow} |
1693 | ||
eaaa6a06 | 1694 | \func{virtual void}{ScrollWindow}{\param{int }{dx}, \param{int }{dy}, \param{const wxRect*}{ rect = NULL}} |
a660d684 | 1695 | |
6453876e | 1696 | Physically scrolls the pixels in the window and move child windows accordingly. |
a660d684 KB |
1697 | |
1698 | \wxheading{Parameters} | |
1699 | ||
1700 | \docparam{dx}{Amount to scroll horizontally.} | |
1701 | ||
1702 | \docparam{dy}{Amount to scroll vertically.} | |
1703 | ||
1704 | \docparam{rect}{Rectangle to invalidate. If this is NULL, the whole window is invalidated. If you | |
1705 | pass a rectangle corresponding to the area of the window exposed by the scroll, your painting handler | |
6453876e RR |
1706 | can optimise painting by checking for the invalidated region. This paramter is ignored under GTK, |
1707 | instead the regions to be invalidated are calculated automatically. } | |
a660d684 KB |
1708 | |
1709 | \wxheading{Remarks} | |
1710 | ||
a660d684 | 1711 | Use this function to optimise your scrolling implementations, to minimise the area that must be |
6453876e | 1712 | redrawn. Note that it is rarely required to call this function from a user program. |
a660d684 | 1713 | |
3972fb49 JS |
1714 | \membersection{wxWindow::SetAcceleratorTable}\label{wxwindowsetacceleratortable} |
1715 | ||
1716 | \func{virtual void}{SetAcceleratorTable}{\param{const wxAcceleratorTable\&}{ accel}} | |
1717 | ||
1718 | Sets the accelerator table for this window. See \helpref{wxAcceleratorTable}{wxacceleratortable}. | |
1719 | ||
a660d684 KB |
1720 | \membersection{wxWindow::SetAutoLayout}\label{wxwindowsetautolayout} |
1721 | ||
8a293590 | 1722 | \func{void}{SetAutoLayout}{\param{bool}{ autoLayout}} |
a660d684 KB |
1723 | |
1724 | Determines whether the \helpref{wxWindow::Layout}{wxwindowlayout} function will | |
515da557 | 1725 | be called automatically when the window is resized. Use in connection with |
2cdac558 | 1726 | \helpref{wxWindow::SetSizer}{wxwindowsetsizer} and |
515da557 | 1727 | \helpref{wxWindow::SetConstraints}{wxwindowsetconstraints} for layouting subwindows. |
a660d684 KB |
1728 | |
1729 | \wxheading{Parameters} | |
1730 | ||
1731 | \docparam{autoLayout}{Set this to TRUE if you wish the Layout function to be called | |
1732 | from within wxWindow::OnSize functions.} | |
1733 | ||
6453876e RR |
1734 | \wxheading{Remarks} |
1735 | ||
2cdac558 | 1736 | Note that this function is actually disabled for wxWindow. It has |
a6aa9b1e RD |
1737 | effect for wxDialog, wxFrame, wxPanel and wxScrolledWindow. Windows |
1738 | of other types that need to invoke the Layout algorithm should provide | |
605d715d | 1739 | an EVT\_SIZE handler and call |
a6aa9b1e | 1740 | \helpref{wxWindow::Layout}{wxwindowlayout} from within it. |
6453876e | 1741 | |
a660d684 KB |
1742 | \wxheading{See also} |
1743 | ||
1744 | \helpref{wxWindow::SetConstraints}{wxwindowsetconstraints} | |
1745 | ||
1746 | \membersection{wxWindow::SetBackgroundColour}\label{wxwindowsetbackgroundcolour} | |
1747 | ||
1748 | \func{virtual void}{SetBackgroundColour}{\param{const wxColour\& }{colour}} | |
1749 | ||
1750 | Sets the background colour of the window. | |
1751 | ||
1752 | \wxheading{Parameters} | |
1753 | ||
1754 | \docparam{colour}{The colour to be used as the background colour.} | |
1755 | ||
1756 | \wxheading{Remarks} | |
1757 | ||
1758 | The background colour is usually painted by the default\rtfsp | |
6453876e RR |
1759 | \helpref{wxWindow::OnEraseBackground}{wxwindowonerasebackground} event handler function |
1760 | under Windows and automatically under GTK. | |
a660d684 | 1761 | |
5b6aa0ff JS |
1762 | Note that setting the background colour does not cause an immediate refresh, so you |
1763 | may wish to call \helpref{wxWindow::Clear}{wxwindowclear} or \helpref{wxWindow::Refresh}{wxwindowrefresh} after | |
1764 | calling this function. | |
1765 | ||
6453876e RR |
1766 | Note that when using this functions under GTK, you will disable the so called "themes", |
1767 | i.e. the user chosen apperance of windows and controls, including the themes of | |
1768 | their parent windows. | |
1769 | ||
a660d684 KB |
1770 | \wxheading{See also} |
1771 | ||
1772 | \helpref{wxWindow::GetBackgroundColour}{wxwindowgetbackgroundcolour},\rtfsp | |
1773 | \helpref{wxWindow::SetForegroundColour}{wxwindowsetforegroundcolour},\rtfsp | |
1774 | \helpref{wxWindow::GetForegroundColour}{wxwindowgetforegroundcolour},\rtfsp | |
5b6aa0ff JS |
1775 | \helpref{wxWindow::Clear}{wxwindowclear},\rtfsp |
1776 | \helpref{wxWindow::Refresh}{wxwindowrefresh},\rtfsp | |
a660d684 KB |
1777 | \helpref{wxWindow::OnEraseBackground}{wxwindowonerasebackground} |
1778 | ||
dbdb39b2 JS |
1779 | \membersection{wxWindow::SetClientSize}\label{wxwindowsetclientsize} |
1780 | ||
1781 | \func{virtual void}{SetClientSize}{\param{int}{ width}, \param{int}{ height}} | |
1782 | ||
1783 | \func{virtual void}{SetClientSize}{\param{const wxSize\&}{ size}} | |
1784 | ||
1785 | This sets the size of the window client area in pixels. Using this function to size a window | |
1786 | tends to be more device-independent than \helpref{wxWindow::SetSize}{wxwindowsetsize}, since the application need not | |
1787 | worry about what dimensions the border or title bar have when trying to fit the window | |
1788 | around panel items, for example. | |
1789 | ||
1790 | \wxheading{Parameters} | |
1791 | ||
1792 | \docparam{width}{The required client area width.} | |
1793 | ||
1794 | \docparam{height}{The required client area height.} | |
1795 | ||
1796 | \docparam{size}{The required client size.} | |
1797 | ||
06d20283 RD |
1798 | \pythonnote{In place of a single overloaded method name, wxPython |
1799 | implements the following methods:\par | |
1800 | \indented{2cm}{\begin{twocollist} | |
c9110876 VS |
1801 | \twocolitem{{\bf SetClientSize(size)}}{Accepts a wxSize} |
1802 | \twocolitem{{\bf SetClientSizeWH(width, height)}}{} | |
06d20283 RD |
1803 | \end{twocollist}} |
1804 | } | |
1805 | ||
dbdb39b2 JS |
1806 | \membersection{wxWindow::SetCursor}\label{wxwindowsetcursor} |
1807 | ||
1808 | \func{virtual void}{SetCursor}{\param{const wxCursor\&}{cursor}} | |
1809 | ||
3eddf563 VZ |
1810 | Sets the window's cursor. Notice that setting the cursor for this window does |
1811 | not set it for its children so you'll need to explicitly call SetCursor() for | |
1812 | them too if you need it. | |
dbdb39b2 JS |
1813 | |
1814 | \wxheading{Parameters} | |
1815 | ||
1816 | \docparam{cursor}{Specifies the cursor that the window should normally display.} | |
1817 | ||
dbdb39b2 JS |
1818 | \wxheading{See also} |
1819 | ||
1820 | \helpref{::wxSetCursor}{wxsetcursor}, \helpref{wxCursor}{wxcursor} | |
1821 | ||
1822 | \membersection{wxWindow::SetEventHandler}\label{wxwindowseteventhandler} | |
1823 | ||
1824 | \func{void}{SetEventHandler}{\param{wxEvtHandler* }{handler}} | |
1825 | ||
1826 | Sets the event handler for this window. | |
1827 | ||
1828 | \wxheading{Parameters} | |
1829 | ||
1830 | \docparam{handler}{Specifies the handler to be set.} | |
1831 | ||
1832 | \wxheading{Remarks} | |
1833 | ||
1834 | An event handler is an object that is capable of processing the events | |
1835 | sent to a window. By default, the window is its own event handler, but | |
1836 | an application may wish to substitute another, for example to allow | |
1837 | central implementation of event-handling for a variety of different | |
1838 | window classes. | |
1839 | ||
1840 | It is usually better to use \helpref{wxWindow::PushEventHandler}{wxwindowpusheventhandler} since | |
1841 | this sets up a chain of event handlers, where an event not handled by one event handler is | |
1842 | handed to the next one in the chain. | |
1843 | ||
1844 | \wxheading{See also} | |
1845 | ||
1846 | \helpref{wxWindow::GetEventHandler}{wxwindowgeteventhandler},\rtfsp | |
1847 | \helpref{wxWindow::PushEventHandler}{wxwindowpusheventhandler},\rtfsp | |
1848 | \helpref{wxWindow::PopEventHandler}{wxwindowpusheventhandler},\rtfsp | |
1849 | \helpref{wxEvtHandler::ProcessEvent}{wxevthandlerprocessevent},\rtfsp | |
1850 | \helpref{wxEvtHandler}{wxevthandler} | |
1851 | ||
a660d684 KB |
1852 | \membersection{wxWindow::SetConstraints}\label{wxwindowsetconstraints} |
1853 | ||
1854 | \func{void}{SetConstraints}{\param{wxLayoutConstraints* }{constraints}} | |
1855 | ||
1856 | Sets the window to have the given layout constraints. The window | |
1857 | will then own the object, and will take care of its deletion. | |
1858 | If an existing layout constraints object is already owned by the | |
1859 | window, it will be deleted. | |
1860 | ||
1861 | \wxheading{Parameters} | |
1862 | ||
1863 | \docparam{constraints}{The constraints to set. Pass NULL to disassociate and delete the window's | |
1864 | constraints.} | |
1865 | ||
1866 | \wxheading{Remarks} | |
1867 | ||
1868 | You must call \helpref{wxWindow::SetAutoLayout}{wxwindowsetautolayout} to tell a window to use | |
2cdac558 | 1869 | the constraints automatically in OnSize; otherwise, you must override OnSize and call Layout() |
515da557 RR |
1870 | explicitly. When setting both a wxLayoutConstraints and a \helpref{wxSizer}{wxsizer}, only the |
1871 | sizer will have effect. | |
a660d684 | 1872 | |
dface61c JS |
1873 | \membersection{wxWindow::SetDropTarget}\label{wxwindowsetdroptarget} |
1874 | ||
1875 | \func{void}{SetDropTarget}{\param{wxDropTarget*}{ target}} | |
1876 | ||
1877 | Associates a drop target with this window. | |
1878 | ||
1879 | If the window already has a drop target, it is deleted. | |
1880 | ||
1881 | \wxheading{See also} | |
1882 | ||
06d20283 | 1883 | \helpref{wxWindow::GetDropTarget}{wxwindowgetdroptarget}, |
dface61c JS |
1884 | \helpref{Drag and drop overview}{wxdndoverview} |
1885 | ||
a660d684 KB |
1886 | \membersection{wxWindow::SetFocus}\label{wxwindowsetfocus} |
1887 | ||
1888 | \func{virtual void}{SetFocus}{\void} | |
1889 | ||
1890 | This sets the window to receive keyboard input. | |
1891 | ||
1892 | \membersection{wxWindow::SetFont}\label{wxwindowsetfont} | |
1893 | ||
1894 | \func{void}{SetFont}{\param{const wxFont\& }{font}} | |
1895 | ||
1896 | Sets the font for this window. | |
1897 | ||
1898 | \wxheading{Parameters} | |
1899 | ||
1900 | \docparam{font}{Font to associate with this window.} | |
1901 | ||
1902 | \wxheading{See also} | |
1903 | ||
1904 | \helpref{wxWindow::GetFont}{wxwindowgetfont} | |
1905 | ||
1906 | \membersection{wxWindow::SetForegroundColour}\label{wxwindowsetforegroundcolour} | |
1907 | ||
1908 | \func{virtual void}{SetForegroundColour}{\param{const wxColour\& }{colour}} | |
1909 | ||
1910 | Sets the foreground colour of the window. | |
1911 | ||
1912 | \wxheading{Parameters} | |
1913 | ||
1914 | \docparam{colour}{The colour to be used as the foreground colour.} | |
1915 | ||
1916 | \wxheading{Remarks} | |
1917 | ||
1918 | The interpretation of foreground colour is open to interpretation according | |
1919 | to the window class; it may be the text colour or other colour, or it may not | |
1920 | be used at all. | |
1921 | ||
6453876e RR |
1922 | Note that when using this functions under GTK, you will disable the so called "themes", |
1923 | i.e. the user chosen apperance of windows and controls, including the themes of | |
1924 | their parent windows. | |
1925 | ||
a660d684 KB |
1926 | \wxheading{See also} |
1927 | ||
1928 | \helpref{wxWindow::GetForegroundColour}{wxwindowgetforegroundcolour},\rtfsp | |
1929 | \helpref{wxWindow::SetBackgroundColour}{wxwindowsetbackgroundcolour},\rtfsp | |
1930 | \helpref{wxWindow::GetBackgroundColour}{wxwindowgetbackgroundcolour} | |
1931 | ||
1932 | \membersection{wxWindow::SetId}\label{wxwindowsetid} | |
1933 | ||
1934 | \func{void}{SetId}{\param{int}{ id}} | |
1935 | ||
1936 | Sets the identifier of the window. | |
1937 | ||
1938 | \wxheading{Remarks} | |
1939 | ||
1940 | Each window has an integer identifier. If the application has not provided one, | |
1941 | an identifier will be generated. Normally, the identifier should be provided | |
1942 | on creation and should not be modified subsequently. | |
1943 | ||
a660d684 KB |
1944 | \wxheading{See also} |
1945 | ||
5b6aa0ff JS |
1946 | \helpref{wxWindow::GetId}{wxwindowgetid},\rtfsp |
1947 | \helpref{Window identifiers}{windowids} | |
a660d684 KB |
1948 | |
1949 | \membersection{wxWindow::SetName}\label{wxwindowsetname} | |
1950 | ||
1951 | \func{virtual void}{SetName}{\param{const wxString\& }{name}} | |
1952 | ||
1953 | Sets the window's name. | |
1954 | ||
1955 | \wxheading{Parameters} | |
1956 | ||
1957 | \docparam{name}{A name to set for the window.} | |
1958 | ||
1959 | \wxheading{See also} | |
1960 | ||
1961 | \helpref{wxWindow::GetName}{wxwindowgetname} | |
1962 | ||
dbdb39b2 JS |
1963 | \membersection{wxWindow::SetPalette}\label{wxwindowsetpalette} |
1964 | ||
1965 | \func{virtual void}{SetPalette}{\param{wxPalette* }{palette}} | |
1966 | ||
1967 | Obsolete - use \helpref{wxDC::SetPalette}{wxdcsetpalette} instead. | |
1968 | ||
a660d684 KB |
1969 | \membersection{wxWindow::SetScrollbar}\label{wxwindowsetscrollbar} |
1970 | ||
eaaa6a06 JS |
1971 | \func{virtual void}{SetScrollbar}{\param{int }{orientation}, \param{int }{position},\rtfsp |
1972 | \param{int }{thumbSize}, \param{int }{range},\rtfsp | |
8a293590 | 1973 | \param{bool }{refresh = TRUE}} |
a660d684 KB |
1974 | |
1975 | Sets the scrollbar properties of a built-in scrollbar. | |
1976 | ||
1977 | \wxheading{Parameters} | |
1978 | ||
1979 | \docparam{orientation}{Determines the scrollbar whose page size is to be set. May be wxHORIZONTAL or wxVERTICAL.} | |
1980 | ||
1981 | \docparam{position}{The position of the scrollbar in scroll units.} | |
1982 | ||
1983 | \docparam{thumbSize}{The size of the thumb, or visible portion of the scrollbar, in scroll units.} | |
1984 | ||
1985 | \docparam{range}{The maximum position of the scrollbar.} | |
1986 | ||
1987 | \docparam{refresh}{TRUE to redraw the scrollbar, FALSE otherwise.} | |
1988 | ||
1989 | \wxheading{Remarks} | |
1990 | ||
1991 | Let's say you wish to display 50 lines of text, using the same font. | |
1992 | The window is sized so that you can only see 16 lines at a time. | |
1993 | ||
1994 | You would use: | |
1995 | ||
1996 | {\small% | |
1997 | \begin{verbatim} | |
1998 | SetScrollbar(wxVERTICAL, 0, 16, 50); | |
1999 | \end{verbatim} | |
2000 | } | |
2001 | ||
2002 | Note that with the window at this size, the thumb position can never go | |
2003 | above 50 minus 16, or 34. | |
2004 | ||
2005 | You can determine how many lines are currently visible by dividing the current view | |
2006 | size by the character height in pixels. | |
2007 | ||
2008 | When defining your own scrollbar behaviour, you will always need to recalculate | |
2009 | the scrollbar settings when the window size changes. You could therefore put your | |
2010 | scrollbar calculations and SetScrollbar | |
2011 | call into a function named AdjustScrollbars, which can be called initially and also | |
2012 | from your \helpref{wxWindow::OnSize}{wxwindowonsize} event handler function. | |
2013 | ||
2014 | \wxheading{See also} | |
2015 | ||
2016 | \helpref{Scrolling overview}{scrollingoverview},\rtfsp | |
2017 | \helpref{wxScrollBar}{wxscrollbar}, \helpref{wxScrolledWindow}{wxscrolledwindow} | |
2018 | ||
2019 | \begin{comment} | |
2020 | \membersection{wxWindow::SetScrollPage}\label{wxwindowsetscrollpage} | |
2021 | ||
8a293590 | 2022 | \func{virtual void}{SetScrollPage}{\param{int }{orientation}, \param{int }{pageSize}, \param{bool }{refresh = TRUE}} |
a660d684 KB |
2023 | |
2024 | Sets the page size of one of the built-in scrollbars. | |
2025 | ||
2026 | \wxheading{Parameters} | |
2027 | ||
2028 | \docparam{orientation}{Determines the scrollbar whose page size is to be set. May be wxHORIZONTAL or wxVERTICAL.} | |
2029 | ||
2030 | \docparam{pageSize}{Page size in scroll units.} | |
2031 | ||
2032 | \docparam{refresh}{TRUE to redraw the scrollbar, FALSE otherwise.} | |
2033 | ||
2034 | \wxheading{Remarks} | |
2035 | ||
2036 | The page size of a scrollbar is the number of scroll units that the scroll thumb travels when you | |
2037 | click on the area above/left of or below/right of the thumb. Normally you will want a whole visible | |
2038 | page to be scrolled, i.e. the size of the current view (perhaps the window client size). This | |
2039 | value has to be adjusted when the window is resized, since the page size will have changed. | |
2040 | ||
2041 | In addition to specifying how far the scroll thumb travels when paging, in Motif and some versions of Windows | |
2042 | the thumb changes size to reflect the page size relative to the length of the document. When the | |
2043 | document size is only slightly bigger than the current view (window) size, almost all of the scrollbar | |
2044 | will be taken up by the thumb. When the two values become the same, the scrollbar will (on some systems) | |
2045 | disappear. | |
2046 | ||
2047 | Currently, this function should be called before SetPageRange, because of a quirk in the Windows | |
2048 | handling of pages and ranges. | |
2049 | ||
2050 | \wxheading{See also} | |
2051 | ||
2052 | \helpref{wxWindow::SetScrollPos}{wxwindowsetscrollpos},\rtfsp | |
a660d684 | 2053 | \helpref{wxWindow::GetScrollPos}{wxwindowsetscrollpos},\rtfsp |
f7bd2698 | 2054 | \helpref{wxWindow::GetScrollPage}{wxwindowsetscrollpage},\rtfsp |
a660d684 KB |
2055 | \helpref{wxScrollBar}{wxscrollbar}, \helpref{wxScrolledWindow}{wxscrolledwindow} |
2056 | \end{comment} | |
2057 | ||
2058 | \membersection{wxWindow::SetScrollPos}\label{wxwindowsetscrollpos} | |
2059 | ||
8a293590 | 2060 | \func{virtual void}{SetScrollPos}{\param{int }{orientation}, \param{int }{pos}, \param{bool }{refresh = TRUE}} |
a660d684 KB |
2061 | |
2062 | Sets the position of one of the built-in scrollbars. | |
2063 | ||
2064 | \wxheading{Parameters} | |
2065 | ||
2066 | \docparam{orientation}{Determines the scrollbar whose position is to be set. May be wxHORIZONTAL or wxVERTICAL.} | |
2067 | ||
2068 | \docparam{pos}{Position in scroll units.} | |
2069 | ||
2070 | \docparam{refresh}{TRUE to redraw the scrollbar, FALSE otherwise.} | |
2071 | ||
2072 | \wxheading{Remarks} | |
2073 | ||
2074 | This function does not directly affect the contents of the window: it is up to the | |
2075 | application to take note of scrollbar attributes and redraw contents accordingly. | |
2076 | ||
2077 | \wxheading{See also} | |
2078 | ||
2079 | \helpref{wxWindow::SetScrollbar}{wxwindowsetscrollbar},\rtfsp | |
2080 | \helpref{wxWindow::GetScrollPos}{wxwindowsetscrollpos},\rtfsp | |
f7bd2698 | 2081 | \helpref{wxWindow::GetScrollThumb}{wxwindowgetscrollthumb},\rtfsp |
a660d684 KB |
2082 | \helpref{wxScrollBar}{wxscrollbar}, \helpref{wxScrolledWindow}{wxscrolledwindow} |
2083 | ||
2084 | \begin{comment} | |
2085 | \membersection{wxWindow::SetScrollRange}\label{wxwindowsetscrollrange} | |
2086 | ||
8a293590 | 2087 | \func{virtual void}{SetScrollRange}{\param{int }{orientation}, \param{int }{range}, \param{bool }{refresh = TRUE}} |
a660d684 KB |
2088 | |
2089 | Sets the range of one of the built-in scrollbars. | |
2090 | ||
2091 | \wxheading{Parameters} | |
2092 | ||
2093 | \docparam{orientation}{Determines the scrollbar whose range is to be set. May be wxHORIZONTAL or wxVERTICAL.} | |
2094 | ||
2095 | \docparam{range}{Scroll range.} | |
2096 | ||
2097 | \docparam{refresh}{TRUE to redraw the scrollbar, FALSE otherwise.} | |
2098 | ||
2099 | \wxheading{Remarks} | |
2100 | ||
2101 | The range of a scrollbar is the number of steps that the thumb may travel, rather than the total | |
fe604ccd JS |
2102 | object length of the scrollbar. If you are implementing a scrolling window, for example, you |
2103 | would adjust the scroll range when the window is resized, by subtracting the window view size from the | |
2104 | total virtual window size. When the two sizes are the same (all the window is visible), the range goes to zero | |
a660d684 KB |
2105 | and usually the scrollbar will be automatically hidden. |
2106 | ||
2107 | \wxheading{See also} | |
2108 | ||
2109 | \helpref{wxWindow::SetScrollPos}{wxwindowsetscrollpos},\rtfsp | |
2110 | \helpref{wxWindow::SetScrollPage}{wxwindowsetscrollpage},\rtfsp | |
2111 | \helpref{wxWindow::GetScrollPos}{wxwindowsetscrollpos},\rtfsp | |
f7bd2698 | 2112 | \helpref{wxWindow::GetScrollPage}{wxwindowsetscrollpage},\rtfsp |
a660d684 KB |
2113 | \helpref{wxScrollBar}{wxscrollbar}, \helpref{wxScrolledWindow}{wxscrolledwindow} |
2114 | \end{comment} | |
2115 | ||
2116 | \membersection{wxWindow::SetSize}\label{wxwindowsetsize} | |
2117 | ||
eaaa6a06 JS |
2118 | \func{virtual void}{SetSize}{\param{int}{ x}, \param{int}{ y}, \param{int}{ width}, \param{int}{ height}, |
2119 | \param{int}{ sizeFlags = wxSIZE\_AUTO}} | |
a660d684 | 2120 | |
a974387a JS |
2121 | \func{virtual void}{SetSize}{\param{const wxRect\&}{ rect}} |
2122 | ||
a660d684 KB |
2123 | Sets the size and position of the window in pixels. |
2124 | ||
eaaa6a06 | 2125 | \func{virtual void}{SetSize}{\param{int}{ width}, \param{int}{ height}} |
a660d684 | 2126 | |
a974387a JS |
2127 | \func{virtual void}{SetSize}{\param{const wxSize\&}{ size}} |
2128 | ||
a660d684 KB |
2129 | Sets the size of the window in pixels. |
2130 | ||
2131 | \wxheading{Parameters} | |
2132 | ||
2133 | \docparam{x}{Required x position in pixels, or -1 to indicate that the existing | |
2134 | value should be used.} | |
2135 | ||
2136 | \docparam{y}{Required y position in pixels, or -1 to indicate that the existing | |
2137 | value should be used.} | |
2138 | ||
2139 | \docparam{width}{Required width in pixels, or -1 to indicate that the existing | |
2140 | value should be used.} | |
2141 | ||
2142 | \docparam{height}{Required height position in pixels, or -1 to indicate that the existing | |
2143 | value should be used.} | |
2144 | ||
a974387a JS |
2145 | \docparam{size}{\helpref{wxSize}{wxsize} object for setting the size.} |
2146 | ||
2147 | \docparam{rect}{\helpref{wxRect}{wxrect} object for setting the position and size.} | |
2148 | ||
a660d684 KB |
2149 | \docparam{sizeFlags}{Indicates the interpretation of other parameters. It is a bit list of the following: |
2150 | ||
2151 | {\bf wxSIZE\_AUTO\_WIDTH}: a -1 width value is taken to indicate | |
2152 | a wxWindows-supplied default width.\\ | |
2153 | {\bf wxSIZE\_AUTO\_HEIGHT}: a -1 height value is taken to indicate | |
2154 | a wxWindows-supplied default width.\\ | |
2155 | {\bf wxSIZE\_AUTO}: -1 size values are taken to indicate | |
2156 | a wxWindows-supplied default size.\\ | |
2157 | {\bf wxSIZE\_USE\_EXISTING}: existing dimensions should be used | |
2158 | if -1 values are supplied.\\ | |
2159 | {\bf wxSIZE\_ALLOW\_MINUS\_ONE}: allow dimensions of -1 and less to be interpreted | |
2160 | as real dimensions, not default values. | |
2161 | } | |
2162 | ||
2163 | \wxheading{Remarks} | |
2164 | ||
2165 | The second form is a convenience for calling the first form with default | |
2166 | x and y parameters, and must be used with non-default width and height values. | |
2167 | ||
2168 | The first form sets the position and optionally size, of the window. | |
2169 | Parameters may be -1 to indicate either that a default should be supplied | |
2170 | by wxWindows, or that the current value of the dimension should be used. | |
2171 | ||
2172 | \wxheading{See also} | |
2173 | ||
2174 | \helpref{wxWindow::Move}{wxwindowmove} | |
2175 | ||
06d20283 RD |
2176 | \pythonnote{In place of a single overloaded method name, wxPython |
2177 | implements the following methods:\par | |
2178 | \indented{2cm}{\begin{twocollist} | |
c9110876 VS |
2179 | \twocolitem{{\bf SetDimensions(x, y, width, height, sizeFlags=wxSIZE\_AUTO)}}{} |
2180 | \twocolitem{{\bf SetSize(size)}}{} | |
2181 | \twocolitem{{\bf SetPosition(point)}}{} | |
06d20283 RD |
2182 | \end{twocollist}} |
2183 | } | |
2184 | ||
a660d684 KB |
2185 | \membersection{wxWindow::SetSizeHints}\label{wxwindowsetsizehints} |
2186 | ||
eaaa6a06 JS |
2187 | \func{virtual void}{SetSizeHints}{\param{int}{ minW=-1}, \param{int}{ minH=-1}, \param{int}{ maxW=-1}, \param{int}{ maxH=-1}, |
2188 | \param{int}{ incW=-1}, \param{int}{ incH=-1}} | |
a660d684 KB |
2189 | |
2190 | Allows specification of minimum and maximum window sizes, and window size increments. | |
2191 | If a pair of values is not set (or set to -1), the default values will be used. | |
2192 | ||
2193 | \wxheading{Parameters} | |
2194 | ||
2195 | \docparam{minW}{Specifies the minimum width allowable.} | |
2196 | ||
2197 | \docparam{minH}{Specifies the minimum height allowable.} | |
2198 | ||
2199 | \docparam{maxW}{Specifies the maximum width allowable.} | |
2200 | ||
2201 | \docparam{maxH}{Specifies the maximum height allowable.} | |
2202 | ||
2203 | \docparam{incW}{Specifies the increment for sizing the width (Motif/Xt only).} | |
2204 | ||
2205 | \docparam{incH}{Specifies the increment for sizing the height (Motif/Xt only).} | |
2206 | ||
2207 | \wxheading{Remarks} | |
2208 | ||
2209 | If this function is called, the user will not be able to size the window outside the | |
2210 | given bounds. | |
2211 | ||
2212 | The resizing increments are only significant under Motif or Xt. | |
2213 | ||
515da557 RR |
2214 | \membersection{wxWindow::SetSizer}\label{wxwindowsetsizer} |
2215 | ||
2216 | \func{void}{SetSizer}{\param{wxSizer* }{sizer}} | |
2217 | ||
2218 | Sets the window to have the given layout sizer. The window | |
2219 | will then own the object, and will take care of its deletion. | |
2220 | If an existing layout constraints object is already owned by the | |
2221 | window, it will be deleted. | |
2222 | ||
2223 | \wxheading{Parameters} | |
2224 | ||
2225 | \docparam{sizer}{The sizer to set. Pass NULL to disassociate and delete the window's | |
2226 | sizer.} | |
2227 | ||
2228 | \wxheading{Remarks} | |
2229 | ||
2230 | You must call \helpref{wxWindow::SetAutoLayout}{wxwindowsetautolayout} to tell a window to use | |
2cdac558 RD |
2231 | the sizer automatically in OnSize; otherwise, you must override OnSize and call Layout() |
2232 | explicitly. When setting both a wxSizer and a \helpref{wxLayoutConstraints}{wxlayoutconstraints}, | |
515da557 RR |
2233 | only the sizer will have effect. |
2234 | ||
a660d684 KB |
2235 | \membersection{wxWindow::SetTitle}\label{wxwindowsettitle} |
2236 | ||
2237 | \func{virtual void}{SetTitle}{\param{const wxString\& }{title}} | |
2238 | ||
2239 | Sets the window's title. Applicable only to frames and dialogs. | |
2240 | ||
2241 | \wxheading{Parameters} | |
2242 | ||
2243 | \docparam{title}{The window's title.} | |
2244 | ||
2245 | \wxheading{See also} | |
2246 | ||
2247 | \helpref{wxWindow::GetTitle}{wxwindowgettitle} | |
2248 | ||
aeab10d0 JS |
2249 | \membersection{wxWindow::SetValidator}\label{wxwindowsetvalidator} |
2250 | ||
2251 | \func{virtual void}{SetValidator}{\param{const wxValidator\&}{ validator}} | |
2252 | ||
2253 | Deletes the current validator (if any) and sets the window validator, having called wxValidator::Clone to | |
2254 | create a new validator of this type. | |
2255 | ||
2256 | \membersection{wxWindow::Show}\label{wxwindowshow} | |
a660d684 | 2257 | |
8a293590 | 2258 | \func{virtual bool}{Show}{\param{bool}{ show}} |
a660d684 KB |
2259 | |
2260 | Shows or hides the window. | |
2261 | ||
2262 | \wxheading{Parameters} | |
2263 | ||
2264 | \docparam{show}{If TRUE, displays the window and brings it to the front. Otherwise, | |
2265 | hides the window.} | |
2266 | ||
2267 | \wxheading{See also} | |
2268 | ||
2269 | \helpref{wxWindow::IsShown}{wxwindowisshown} | |
2270 | ||
2271 | \membersection{wxWindow::TransferDataFromWindow}\label{wxwindowtransferdatafromwindow} | |
2272 | ||
2273 | \func{virtual bool}{TransferDataFromWindow}{\void} | |
2274 | ||
2275 | Transfers values from child controls to data areas specified by their validators. Returns | |
2276 | FALSE if a transfer failed. | |
2277 | ||
2278 | \wxheading{See also} | |
2279 | ||
2280 | \helpref{wxWindow::TransferDataToWindow}{wxwindowtransferdatatowindow},\rtfsp | |
2281 | \helpref{wxValidator}{wxvalidator}, \helpref{wxWindow::Validate}{wxwindowvalidate} | |
2282 | ||
2283 | \membersection{wxWindow::TransferDataToWindow}\label{wxwindowtransferdatatowindow} | |
2284 | ||
2285 | \func{virtual bool}{TransferDataToWindow}{\void} | |
2286 | ||
2287 | Transfers values to child controls from data areas specified by their validators. | |
2288 | ||
2289 | \wxheading{Return value} | |
2290 | ||
2291 | Returns FALSE if a transfer failed. | |
2292 | ||
2293 | \wxheading{See also} | |
2294 | ||
2295 | \helpref{wxWindow::TransferDataFromWindow}{wxwindowtransferdatafromwindow},\rtfsp | |
2296 | \helpref{wxValidator}{wxvalidator}, \helpref{wxWindow::Validate}{wxwindowvalidate} | |
2297 | ||
2298 | \membersection{wxWindow::Validate}\label{wxwindowvalidate} | |
2299 | ||
2300 | \func{virtual bool}{Validate}{\void} | |
2301 | ||
2302 | Validates the current values of the child controls using their validators. | |
2303 | ||
2304 | \wxheading{Return value} | |
2305 | ||
2306 | Returns FALSE if any of the validations failed. | |
2307 | ||
2308 | \wxheading{See also} | |
2309 | ||
2310 | \helpref{wxWindow::TransferDataFromWindow}{wxwindowtransferdatafromwindow},\rtfsp | |
2311 | \helpref{wxWindow::TransferDataFromWindow}{wxwindowtransferdatafromwindow},\rtfsp | |
2312 | \helpref{wxValidator}{wxvalidator} | |
2313 | ||
2314 | \membersection{wxWindow::WarpPointer}\label{wxwindowwarppointer} | |
2315 | ||
2316 | \func{void}{WarpPointer}{\param{int}{ x}, \param{int}{ y}} | |
2317 | ||
2318 | Moves the pointer to the given position on the window. | |
2319 | ||
2320 | \wxheading{Parameters} | |
2321 | ||
2322 | \docparam{x}{The new x position for the cursor.} | |
2323 | ||
2324 | \docparam{y}{The new y position for the cursor.} | |
2325 |