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