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