]>
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 | ||
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.} | |
884360bc JS |
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.} | |
a660d684 KB |
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 | ||
eaaa6a06 | 50 | \func{}{wxWindow}{\param{wxWindow*}{ parent}, \param{wxWindowID }{id}, |
a660d684 KB |
51 | \param{const wxPoint\& }{pos = wxDefaultPosition}, |
52 | \param{const wxSize\& }{size = wxDefaultSize}, | |
eaaa6a06 | 53 | \param{long }{style = 0}, |
a660d684 KB |
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 | ||
eaaa6a06 | 115 | \func{void}{Center}{\param{int}{ direction}} |
a660d684 KB |
116 | |
117 | A synonym for \helpref{Centre}{wxwindowcentre}. | |
118 | ||
119 | \membersection{wxWindow::Centre}\label{wxwindowcentre} | |
120 | ||
eaaa6a06 | 121 | \func{virtual void}{Centre}{\param{int}{ direction = wxHORIZONTAL}} |
a660d684 KB |
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 | ||
387a3b02 JS |
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 | ||
a660d684 KB |
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 | ||
eaaa6a06 | 299 | \func{virtual bool}{FakePopupMenu}{\param{wxMenu* }{menu}, \param{int }{x}, \param{int }{y}} |
a660d684 KB |
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 | ||
dfad0599 JS |
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 | ||
a660d684 KB |
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 | ||
eaaa6a06 | 548 | \func{virtual int}{GetScrollThumb}{\param{int }{orientation}} |
a660d684 KB |
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 | ||
eaaa6a06 | 558 | \func{virtual int}{GetScrollPos}{\param{int }{orientation}} |
a660d684 KB |
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 | ||
eaaa6a06 | 568 | \func{virtual int}{GetScrollRange}{\param{int }{orientation}} |
a660d684 KB |
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::GetWindowStyleFlag} | |
624 | ||
625 | \constfunc{long}{GetWindowStyleFlag}{\void} | |
626 | ||
627 | Gets the window style that was passed to the consructor or {\bf Create} member. | |
628 | ||
629 | \membersection{wxWindow::InitDialog}\label{wxwindowinitdialog} | |
630 | ||
631 | \func{void}{InitDialog}{\void} | |
632 | ||
633 | Sends an \helpref{wxWindow::OnInitDialog}{wxwindowoninitdialog} event, which | |
634 | in turn transfers data to the dialog via validators. | |
635 | ||
636 | \wxheading{See also} | |
637 | ||
638 | \helpref{wxWindow::OnInitDialog}{wxwindowoninitdialog} | |
639 | ||
640 | \membersection{wxWindow::IsEnabled}\label{wxwindowisenabled} | |
641 | ||
642 | \constfunc{virtual bool}{IsEnabled}{\void} | |
643 | ||
644 | Returns TRUE if the window is enabled for input, FALSE otherwise. | |
645 | ||
646 | \wxheading{See also} | |
647 | ||
648 | \helpref{wxWindow::Enable}{wxwindowenable} | |
649 | ||
650 | \membersection{wxWindow::IsRetained}\label{wxwindowisretained} | |
651 | ||
652 | \constfunc{virtual bool}{IsRetained}{\void} | |
653 | ||
654 | Returns TRUE if the window is retained, FALSE otherwise. | |
655 | ||
656 | \wxheading{Remarks} | |
657 | ||
658 | Retained windows are only available on X platforms. | |
659 | ||
660 | \membersection{wxWindow::IsShown}\label{wxwindowisshown} | |
661 | ||
662 | \constfunc{virtual bool}{IsShown}{\void} | |
663 | ||
664 | Returns TRUE if the window is shown, FALSE if it has been hidden. | |
665 | ||
666 | \membersection{wxWindow::Layout}\label{wxwindowlayout} | |
667 | ||
668 | \func{void}{Layout}{\void} | |
669 | ||
670 | Invokes the constraint-based layout algorithm for this window. It is called | |
671 | automatically by the default {\bf wxWindow::OnSize} member. | |
672 | ||
673 | \membersection{wxWindow::LoadFromResource}\label{wxwindowloadfromresource} | |
674 | ||
675 | \func{virtual bool}{LoadFromResource}{\param{wxWindow* }{parent},\rtfsp | |
676 | \param{const wxString\& }{resourceName}, \param{const wxResourceTable* }{resourceTable = NULL}} | |
677 | ||
678 | Loads a panel or dialog from a resource file. | |
679 | ||
680 | \wxheading{Parameters} | |
681 | ||
682 | \docparam{parent}{Parent window.} | |
683 | ||
684 | \docparam{resourceName}{The name of the resource to load.} | |
685 | ||
686 | \docparam{resourceTable}{The resource table to load it from. If this is NULL, the | |
687 | default resource table will be used.} | |
688 | ||
689 | \wxheading{Return value} | |
690 | ||
691 | TRUE if the operation succeeded, otherwise FALSE. | |
692 | ||
693 | \wxheading{Remarks} | |
694 | ||
695 | TODO | |
696 | ||
697 | \wxheading{See also} | |
698 | ||
699 | TODO | |
700 | ||
701 | \membersection{wxWindow::Lower}\label{wxwindowlower} | |
702 | ||
703 | \func{void}{Lower}{\void} | |
704 | ||
705 | Lowers the window to the bottom of the window hierarchy if it is a managed window (dialog | |
706 | or frame). | |
707 | ||
708 | \membersection{wxWindow::MakeModal}\label{wxwindowmakemodal} | |
709 | ||
710 | \func{virtual void}{MakeModal}{\param{const bool }{flag}} | |
711 | ||
712 | Disables all other windows in the application so that | |
713 | the user can only interact with this window. | |
714 | ||
715 | \wxheading{Parameters} | |
716 | ||
717 | \docparam{flag}{If TRUE, this call disables all other windows in the application so that | |
718 | the user can only interact with this window. If FALSE, the effect is reversed.} | |
719 | ||
720 | \membersection{wxWindow::Move}\label{wxwindowmove} | |
721 | ||
eaaa6a06 | 722 | \func{void}{Move}{\param{int}{ x}, \param{int}{ y}} |
a660d684 KB |
723 | |
724 | Moves the window to the given position. | |
725 | ||
726 | \wxheading{Parameters} | |
727 | ||
728 | \docparam{x}{Required x position.} | |
729 | ||
730 | \docparam{y}{Required y position.} | |
731 | ||
732 | \wxheading{Remarks} | |
733 | ||
734 | Implementations of SetSize can also implicitly implement the | |
735 | wxWindow::Move function, which is defined in the base wxWindow class | |
736 | as the call: | |
737 | ||
738 | \begin{verbatim} | |
739 | SetSize(x, y, -1, -1, wxSIZE_USE_EXISTING); | |
740 | \end{verbatim} | |
741 | ||
742 | \wxheading{See also} | |
743 | ||
744 | \helpref{wxWindow::SetSize}{wxwindowsetsize} | |
745 | ||
746 | \membersection{wxWindow::OnActivate}\label{wxwindowonactivate} | |
747 | ||
748 | \func{void}{OnActivate}{\param{wxActivateEvent\&}{ event}} | |
749 | ||
750 | Called when a window is activated or deactivated. | |
751 | ||
752 | \wxheading{Parameters} | |
753 | ||
754 | \docparam{event}{Object containing activation information.} | |
755 | ||
756 | \wxheading{Remarks} | |
757 | ||
758 | If the window is being activated, \helpref{wxActivateEvent::GetActive}{wxactivateeventgetactive} returns TRUE, | |
759 | otherwise it returns FALSE (it is being deactivated). | |
760 | ||
761 | \wxheading{See also} | |
762 | ||
763 | \helpref{wxActivateEvent}{wxactivateevent},\rtfsp | |
764 | \helpref{Event handling overview}{eventhandlingoverview} | |
765 | ||
766 | \membersection{wxWindow::OnChar}\label{wxwindowonchar} | |
767 | ||
768 | \func{void}{OnChar}{\param{wxKeyEvent\&}{ event}} | |
769 | ||
770 | Called when the user has pressed a key. | |
771 | ||
772 | \wxheading{Parameters} | |
773 | ||
774 | \docparam{event}{Object containing keypress information. See \helpref{wxKeyEvent}{wxkeyevent} for | |
775 | details about this class.} | |
776 | ||
777 | \wxheading{Remarks} | |
778 | ||
779 | This member function is called in response to a keypress. To intercept this event, | |
780 | use the EVT\_CHAR macro in an event table definition. Your {\bf OnChar} handler may call this | |
781 | default function to achieve default keypress functionality. | |
782 | ||
783 | Note that the ASCII values do not have explicit key codes: they are passed as ASCII | |
784 | values. | |
785 | ||
786 | Most, but not all, windows allow keypresses to be intercepted. | |
787 | ||
788 | \wxheading{See also} | |
789 | ||
790 | \helpref{wxKeyEvent}{wxkeyevent}, \helpref{wxWindow::OnCharHook}{wxwindowoncharhook},\rtfsp | |
791 | \helpref{Event handling overview}{eventhandlingoverview} | |
792 | ||
793 | \membersection{wxWindow::OnCharHook}\label{wxwindowoncharhook} | |
794 | ||
795 | \func{void}{OnCharHook}{\param{wxKeyEvent\&}{ event}} | |
796 | ||
797 | This member is called to allow the window to intercept keyboard events | |
798 | before they are processed by child windows. | |
799 | ||
800 | \wxheading{Parameters} | |
801 | ||
802 | \docparam{event}{Object containing keypress information. See \helpref{wxKeyEvent}{wxkeyevent} for | |
803 | details about this class.} | |
804 | ||
805 | \wxheading{Remarks} | |
806 | ||
807 | This member function is called in response to a keypress, if the window is active. To intercept this event, | |
808 | use the EVT\_CHAR\_HOOK macro in an event table definition. If you do not process a particular | |
809 | keypress, call \helpref{wxEvent::Skip}{wxeventskip} to allow default processing. | |
810 | ||
811 | An example of using this function is in the implementation of escape-character processing for wxDialog, | |
812 | where pressing ESC dismisses the dialog by {\bf OnCharHook} 'forging' a cancel button press event. | |
813 | ||
814 | Note that the ASCII values do not have explicit key codes: they are passed as ASCII | |
815 | values. | |
816 | ||
817 | This function is only relevant to top-level windows (frames and dialogs), and under | |
818 | Windows only. | |
819 | ||
820 | \wxheading{See also} | |
821 | ||
822 | \helpref{wxKeyEvent}{wxkeyevent}, \helpref{wxWindow::OnCharHook}{wxwindowoncharhook},\rtfsp | |
823 | \helpref{wxApp::OnCharHook}{wxapponcharhook},\rtfsp | |
824 | \helpref{Event handling overview}{eventhandlingoverview} | |
825 | ||
826 | \membersection{wxWindow::OnCommand}\label{wxwindowoncommand} | |
827 | ||
828 | \func{virtual void}{OnCommand}{\param{wxEvtHandler\& }{object}, \param{wxCommandEvent\& }{event}} | |
829 | ||
830 | This virtual member function is called if the control does not handle the command event. | |
831 | ||
832 | \wxheading{Parameters} | |
833 | ||
834 | \docparam{object}{Object receiving the command event.} | |
835 | ||
836 | \docparam{event}{Command event} | |
837 | ||
838 | \wxheading{Remarks} | |
839 | ||
840 | This virtual function is provided mainly for backward compatibility. You can also intercept commands | |
841 | from child controls by using an event table, with identifiers or identifier ranges to identify | |
842 | the control(s) in question. | |
843 | ||
844 | \wxheading{See also} | |
845 | ||
846 | \helpref{wxCommandEvent}{wxcommandevent},\rtfsp | |
847 | \helpref{Event handling overview}{eventhandlingoverview} | |
848 | ||
849 | \membersection{wxWindow::OnClose}\label{wxwindowonclose} | |
850 | ||
851 | \func{virtual bool}{OnClose}{\void} | |
852 | ||
853 | Called when the user has tried to close a a frame | |
854 | or dialog box using the window manager (X) or system menu (Windows). | |
855 | ||
856 | {\bf Note:} This is an obsolete function retained for backward compatibility. | |
857 | It is superceded by the \helpref{wxWindow::OnCloseWindow}{wxwindowonclosewindow} event | |
858 | handler. | |
859 | ||
860 | \wxheading{Return value} | |
861 | ||
862 | If TRUE is returned by OnClose, the window will be deleted by the system, otherwise the | |
863 | attempt will be ignored. Do not delete the window from within this handler, although | |
864 | you may delete other windows. | |
865 | ||
866 | \wxheading{Remarks} | |
867 | ||
387a3b02 | 868 | Derive your own class to handle this message. The default handler returns TRUE. |
a660d684 KB |
869 | |
870 | \wxheading{See also} | |
871 | ||
872 | \helpref{Window deletion overview}{windowdeletionoverview},\rtfsp | |
873 | \helpref{wxWindow::Close}{wxwindowclose},\rtfsp | |
874 | \helpref{wxWindow::OnCloseWindow}{wxwindowonclosewindow},\rtfsp | |
875 | \helpref{wxCloseEvent}{wxcloseevent} | |
876 | ||
877 | \membersection{wxWindow::OnCloseWindow}\label{wxwindowonclosewindow} | |
878 | ||
879 | \func{void}{OnCloseWindow}{\param{wxCloseEvent\& }{event}} | |
880 | ||
881 | This is an event handler function called when the user has tried to close a a frame | |
882 | or dialog box using the window manager (X) or system menu (Windows). It is | |
883 | called via the \helpref{wxWindow::Close}{wxwindowclose} function, so | |
884 | that the application can also invoke the handler programmatically. | |
885 | ||
886 | Use the EVT\_CLOSE event table macro to handle close events. | |
887 | ||
888 | You should check whether the application is forcing the deletion of the window | |
889 | using \helpref{wxCloseEvent::GetForce}{wxcloseeventgetforce}. If this is TRUE, | |
890 | destroy the window using \helpref{wxWindow::Destroy}{wxwindowdestroy}. | |
891 | If not, it is up to you whether you respond by destroying the window. | |
892 | ||
387a3b02 JS |
893 | (Note: GetForce is now superceded by CanVeto. So to test whether forced destruction of |
894 | the window is required, test for the negative of CanVeto. If CanVeto returns FALSE, | |
895 | it is not possible to skip window deletion.) | |
896 | ||
897 | If you don't destroy the window, you should call \helpref{wxCloseEvent::Veto}{wxcloseeventveto} to | |
898 | let the calling code know that you did not destroy the window. This allows the \helpref{wxWindow::Close}{wxwindowclose} function | |
899 | to return TRUE or FALSE depending on whether the close instruction was honoured or not. | |
900 | ||
a660d684 KB |
901 | \wxheading{Remarks} |
902 | ||
903 | The \helpref{wxWindow::OnClose}{wxwindowonclose} virtual function remains | |
904 | for backward compatibility with earlier versions of wxWindows. The | |
905 | default {\bf OnCloseWindow} handler for wxFrame and wxDialog will call {\bf OnClose}, | |
906 | destroying the window if it returns TRUE or if the close is being forced. | |
907 | ||
908 | \wxheading{See also} | |
909 | ||
910 | \helpref{Window deletion overview}{windowdeletionoverview},\rtfsp | |
911 | \helpref{wxWindow::Close}{wxwindowclose},\rtfsp | |
912 | \helpref{wxWindow::OnClose}{wxwindowonclose},\rtfsp | |
913 | \helpref{wxWindow::Destroy}{wxwindowdestroy},\rtfsp | |
387a3b02 JS |
914 | \helpref{wxCloseEvent}{wxcloseevent},\rtfsp |
915 | \helpref{wxApp::OnQueryEndSession}{wxapponqueryendsession},\rtfsp | |
916 | \helpref{wxApp::OnEndSession}{wxapponendsession} | |
a660d684 | 917 | |
a660d684 KB |
918 | \membersection{wxWindow::OnDropFiles}\label{wxwindowondropfiles} |
919 | ||
920 | \func{void}{OnDropFiles}{\param{wxDropFilesEvent\&}{ event}} | |
921 | ||
922 | Called when files have been dragged from the file manager to the window. | |
923 | ||
924 | \wxheading{Parameters} | |
925 | ||
926 | \docparam{event}{Drop files event. For more information, see \helpref{wxDropFilesEvent}{wxdropfilesevent}.} | |
927 | ||
928 | \wxheading{Remarks} | |
929 | ||
930 | The window must have previously been enabled for dropping by calling | |
931 | \rtfsp\helpref{wxWindow::DragAcceptFiles}{wxwindowdragacceptfiles}. | |
932 | ||
933 | This event is only generated under Windows. | |
934 | ||
935 | To intercept this event, use the EVT\_DROP\_FILES macro in an event table definition. | |
936 | ||
937 | \wxheading{See also} | |
938 | ||
939 | \helpref{wxDropFilesEvent}{wxdropfilesevent}, \helpref{wxWindow::DragAcceptFiles}{wxwindowdragacceptfiles},\rtfsp | |
940 | \helpref{Event handling overview}{eventhandlingoverview} | |
941 | ||
942 | \membersection{wxWindow::OnEraseBackground}\label{wxwindowonerasebackground} | |
943 | ||
944 | \func{void}{OnEraseBackground}{\param{wxEraseEvent\&}{ event}} | |
945 | ||
946 | Called when the background of the window needs to be erased. | |
947 | ||
948 | \wxheading{Parameters} | |
949 | ||
950 | \docparam{event}{Erase background event. For more information, see \helpref{wxEraseEvent}{wxeraseevent}.} | |
951 | ||
952 | \wxheading{Remarks} | |
953 | ||
954 | This event is only generated under Windows. | |
955 | ||
956 | To intercept this event, use the EVT\_ERASE\_BACKGROUND macro in an event table definition. | |
957 | ||
958 | \wxheading{See also} | |
959 | ||
960 | \helpref{wxEraseEvent}{wxeraseevent}, \helpref{Event handling overview}{eventhandlingoverview} | |
961 | ||
962 | \membersection{wxWindow::OnKillFocus}\label{wxwindowonkillfocus} | |
963 | ||
964 | \func{void}{OnKillFocus}{\param{wxFocusEvent\& }{event}} | |
965 | ||
966 | Called when a window's focus is being killed. | |
967 | ||
968 | \wxheading{Parameters} | |
969 | ||
970 | \docparam{event}{The focus event. For more information, see \helpref{wxFocusEvent}{wxfocusevent}.} | |
971 | ||
972 | \wxheading{Remarks} | |
973 | ||
974 | To intercept this event, use the macro EVT\_KILL\_FOCUS in an event table definition. | |
975 | ||
976 | Most, but not all, windows respond to this event. | |
977 | ||
978 | \wxheading{See also} | |
979 | ||
980 | \helpref{wxFocusEvent}{wxfocusevent}, \helpref{wxWindow::OnSetFocus}{wxwindowonsetfocus},\rtfsp | |
981 | \helpref{Event handling overview}{eventhandlingoverview} | |
982 | ||
983 | \membersection{wxWindow::OnIdle}\label{wxwindowonidle} | |
984 | ||
985 | \func{void}{Onidle}{\param{wxIdleEvent\& }{event}} | |
986 | ||
987 | Provide this member function for any processing which needs to be done | |
988 | when the application is idle. | |
989 | ||
990 | \wxheading{See also} | |
991 | ||
992 | \helpref{wxApp::OnIdle}{wxapponidle}, \helpref{wxIdleEvent}{wxidleevent} | |
993 | ||
994 | \membersection{wxWindow::OnInitDialog}\label{wxwindowoninitdialog} | |
995 | ||
996 | \func{void}{OnInitDialog}{\param{wxInitDialogEvent\&}{ event}} | |
997 | ||
998 | Default handler for the wxEVT\_INIT\_DIALOG event. Calls \helpref{wxWindow::TransferDataToWindow}{wxwindowtransferdatatowindow}. | |
999 | ||
1000 | \wxheading{Parameters} | |
1001 | ||
1002 | \docparam{event}{Dialog initialisation event.} | |
1003 | ||
1004 | \wxheading{Remarks} | |
1005 | ||
1006 | Gives the window the default behaviour of transferring data to child controls via | |
1007 | the validator that each control has. | |
1008 | ||
1009 | \wxheading{See also} | |
1010 | ||
1011 | \helpref{wxValidator}{wxvalidator}, \helpref{wxWindow::TransferDataToWindow}{wxwindowtransferdatatowindow} | |
1012 | ||
1013 | \membersection{wxWindow::OnMenuCommand}\label{wxwindowonmenucommand} | |
1014 | ||
1015 | \func{void}{OnMenuCommand}{\param{wxCommandEvent\& }{event}} | |
1016 | ||
1017 | Called when a menu command is received from a menu bar. | |
1018 | ||
1019 | \wxheading{Parameters} | |
1020 | ||
1021 | \docparam{event}{The menu command event. For more information, see \helpref{wxCommandEvent}{wxcommandevent}.} | |
1022 | ||
1023 | \wxheading{Remarks} | |
1024 | ||
1025 | A function with this name doesn't actually exist; you can choose any member function to receive | |
1026 | menu command events, using the EVT\_COMMAND macro for individual commands or EVT\_COMMAND\_RANGE for | |
1027 | a range of commands. | |
1028 | ||
1029 | \wxheading{See also} | |
1030 | ||
1031 | \helpref{wxCommandEvent}{wxcommandevent},\rtfsp | |
1032 | \helpref{wxWindow::OnMenuHighlight}{wxwindowonmenuhighlight},\rtfsp | |
1033 | \helpref{Event handling overview}{eventhandlingoverview} | |
1034 | ||
1035 | \membersection{wxWindow::OnMenuHighlight}\label{wxwindowonmenuhighlight} | |
1036 | ||
1037 | \func{void}{OnMenuHighlight}{\param{wxMenuEvent\& }{event}} | |
1038 | ||
1039 | Called when a menu select is received from a menu bar: that is, the | |
1040 | mouse cursor is over a menu item, but the left mouse button has not been | |
1041 | pressed. | |
1042 | ||
1043 | \wxheading{Parameters} | |
1044 | ||
1045 | \docparam{event}{The menu highlight event. For more information, see \helpref{wxMenuEvent}{wxmenuevent}.} | |
1046 | ||
1047 | \wxheading{Remarks} | |
1048 | ||
1049 | You can choose any member function to receive | |
1050 | menu select events, using the EVT\_MENU\_HIGHLIGHT macro for individual menu items or EVT\_MENU\_HIGHLIGHT\_ALL macro | |
1051 | for all menu items. | |
1052 | ||
1053 | The default implementation for \helpref{wxFrame::OnMenuHighlight}{wxframeonmenuhighlight} displays help | |
1054 | text in the first field of the status bar. | |
1055 | ||
1056 | This function was known as {\bf OnMenuSelect} in earlier versions of wxWindows, but this was confusing | |
1057 | since a selection is normally a left-click action. | |
1058 | ||
1059 | \wxheading{See also} | |
1060 | ||
1061 | \helpref{wxMenuEvent}{wxmenuevent},\rtfsp | |
1062 | \helpref{wxWindow::OnMenuCommand}{wxwindowonmenucommand},\rtfsp | |
1063 | \helpref{Event handling overview}{eventhandlingoverview} | |
1064 | ||
1065 | ||
1066 | \membersection{wxWindow::OnMouseEvent}\label{wxwindowonmouseevent} | |
1067 | ||
1068 | \func{void}{OnMouseEvent}{\param{wxMouseEvent\&}{ event}} | |
1069 | ||
1070 | Called when the user has initiated an event with the | |
1071 | mouse. | |
1072 | ||
1073 | \wxheading{Parameters} | |
1074 | ||
1075 | \docparam{event}{The mouse event. See \helpref{wxMouseEvent}{wxmouseevent} for | |
1076 | more details.} | |
1077 | ||
1078 | \wxheading{Remarks} | |
1079 | ||
1080 | Most, but not all, windows respond to this event. | |
1081 | ||
1082 | To intercept this event, use the EVT\_MOUSE\_EVENTS macro in an event table definition, or individual | |
1083 | mouse event macros such as EVT\_LEFT\_DOWN. | |
1084 | ||
1085 | \wxheading{See also} | |
1086 | ||
1087 | \helpref{wxMouseEvent}{wxmouseevent},\rtfsp | |
1088 | \helpref{Event handling overview}{eventhandlingoverview} | |
1089 | ||
1090 | \membersection{wxWindow::OnMove}\label{wxwindowonmove} | |
1091 | ||
1092 | \func{void}{OnMove}{\param{wxMoveEvent\& }{event}} | |
1093 | ||
1094 | Called when a window is moved. | |
1095 | ||
1096 | \wxheading{Parameters} | |
1097 | ||
1098 | \docparam{event}{The move event. For more information, see \helpref{wxMoveEvent}{wxmoveevent}.} | |
1099 | ||
1100 | \wxheading{Remarks} | |
1101 | ||
1102 | Use the EVT\_MOVE macro to intercept move events. | |
1103 | ||
1104 | \wxheading{Remarks} | |
1105 | ||
1106 | Not currently implemented. | |
1107 | ||
1108 | \wxheading{See also} | |
1109 | ||
1110 | \helpref{wxMoveEvent}{wxmoveevent},\rtfsp | |
1111 | \helpref{wxFrame::OnSize}{wxframeonsize},\rtfsp | |
1112 | \helpref{Event handling overview}{eventhandlingoverview} | |
1113 | ||
1114 | \membersection{wxWindow::OnPaint}\label{wxwindowonpaint} | |
1115 | ||
1116 | \func{void}{OnPaint}{\param{wxPaintEvent\& }{event}} | |
1117 | ||
1118 | Sent to the event handler when the window must be refreshed. | |
1119 | ||
1120 | \wxheading{Parameters} | |
1121 | ||
1122 | \docparam{event}{Paint event. For more information, see \helpref{wxPaintEvent}{wxpaintevent}.} | |
1123 | ||
1124 | \wxheading{Remarks} | |
1125 | ||
1126 | Use the EVT\_PAINT macro in an event table definition to intercept paint events. | |
1127 | ||
1128 | In a paint event handler, the application should always create a \helpref{wxPaintDC}{wxpaintdc} object. | |
1129 | ||
1130 | For example: | |
1131 | ||
1132 | \small{% | |
1133 | \begin{verbatim} | |
1134 | void MyWindow::OnPaint(wxPaintEvent& event) | |
1135 | { | |
1136 | wxPaintDC dc(this); | |
1137 | ||
1138 | DrawMyDocument(dc); | |
1139 | } | |
1140 | \end{verbatim} | |
1141 | }% | |
1142 | ||
1143 | You can optimize painting by retrieving the rectangles | |
1144 | that have been damaged and only repainting these. The rectangles are in | |
1145 | terms of the client area, and are unscrolled, so you will need to do | |
1146 | some calculations using the current view position to obtain logical, | |
1147 | scrolled units. | |
1148 | ||
1149 | Here is an example of using the \helpref{wxUpdateIterator}{wxupdateiterator} class: | |
1150 | ||
1151 | {\small% | |
1152 | \begin{verbatim} | |
1153 | // Called when window needs to be repainted. | |
1154 | void MyWindow::OnPaint(wxPaintEvent& event) | |
1155 | { | |
1156 | wxPaintDC dc(this); | |
1157 | ||
1158 | // Find Out where the window is scrolled to | |
1159 | int vbX,vbY; // Top left corner of client | |
1160 | ViewStart(&vbX,&vbY); | |
1161 | ||
1162 | int vX,vY,vW,vH; // Dimensions of client area in pixels | |
1163 | wxUpdateIterator upd(this); // get the update rect list | |
1164 | ||
1165 | while (upd) | |
1166 | { | |
1167 | vX = upd.GetX(); | |
1168 | vY = upd.GetY(); | |
1169 | vW = upd.GetW(); | |
1170 | vH = upd.GetH(); | |
1171 | ||
1172 | // Alternatively we can do this: | |
1173 | // wxRect rect; | |
1174 | // upd.GetRect(&rect); | |
1175 | ||
1176 | // Repaint this rectangle | |
1177 | ...some code... | |
1178 | ||
1179 | upd ++ ; | |
1180 | } | |
1181 | } | |
1182 | \end{verbatim} | |
1183 | }% | |
1184 | ||
1185 | \wxheading{See also} | |
1186 | ||
1187 | \helpref{wxPaintEvent}{wxpaintevent},\rtfsp | |
1188 | \helpref{wxPaintDC}{wxpaintdc},\rtfsp | |
1189 | \helpref{Event handling overview}{eventhandlingoverview} | |
1190 | ||
a660d684 KB |
1191 | \func{void}{OnScroll}{\param{wxScrollEvent\& }{event}} |
1192 | ||
1193 | Called when a scroll event is received from one of the window's built-in scrollbars. | |
1194 | ||
1195 | \wxheading{Parameters} | |
1196 | ||
1197 | \docparam{event}{Command event. Retrieve the new scroll position by | |
1198 | calling \helpref{wxScrollEvent::GetPosition}{wxscrolleventgetposition}, and the | |
1199 | scrollbar orientation by calling \helpref{wxScrollEvent::GetOrientation}{wxscrolleventgetorientation}.} | |
1200 | ||
1201 | \wxheading{Remarks} | |
1202 | ||
1203 | Note that it is not possible to distinguish between horizontal and vertical scrollbars | |
1204 | until the function is executing (you can't have one function for vertical, another | |
1205 | for horizontal events). | |
1206 | ||
1207 | \wxheading{See also} | |
1208 | ||
1209 | \helpref{wxScrollEvent}{wxscrollevent},\rtfsp | |
1210 | \helpref{Event handling overview}{eventhandlingoverview} | |
1211 | ||
1212 | \membersection{wxWindow::OnSetFocus}\label{wxwindowonsetfocus} | |
1213 | ||
1214 | \func{void}{OnSetFocus}{\param{wxFocusEvent\& }{event}} | |
1215 | ||
1216 | Called when a window's focus is being set. | |
1217 | ||
1218 | \wxheading{Parameters} | |
1219 | ||
1220 | \docparam{event}{The focus event. For more information, see \helpref{wxFocusEvent}{wxfocusevent}.} | |
1221 | ||
1222 | \wxheading{Remarks} | |
1223 | ||
1224 | To intercept this event, use the macro EVT\_SET\_FOCUS in an event table definition. | |
1225 | ||
1226 | Most, but not all, windows respond to this event. | |
1227 | ||
1228 | \wxheading{See also} | |
1229 | ||
1230 | \helpref{wxFocusEvent}{wxfocusevent}, \helpref{wxWindow::OnKillFocus}{wxwindowonkillfocus},\rtfsp | |
1231 | \helpref{Event handling overview}{eventhandlingoverview} | |
1232 | ||
1233 | \membersection{wxWindow::OnSize}\label{wxwindowonsize} | |
1234 | ||
1235 | \func{void}{OnSize}{\param{wxSizeEvent\& }{event}} | |
1236 | ||
1237 | Called when the window has been resized. | |
1238 | ||
1239 | \wxheading{Parameters} | |
1240 | ||
1241 | \docparam{event}{Size event. For more information, see \helpref{wxSizeEvent}{wxsizeevent}.} | |
1242 | ||
1243 | \wxheading{Remarks} | |
1244 | ||
1245 | You may wish to use this for frames to resize their child windows as appropriate. | |
1246 | ||
1247 | Note that the size passed is of | |
1248 | the whole window: call \helpref{wxWindow::GetClientSize}{wxwindowgetclientsize} for the area which may be | |
1249 | used by the application. | |
1250 | ||
1251 | \wxheading{See also} | |
1252 | ||
1253 | \helpref{wxSizeEvent}{wxsizeevent},\rtfsp | |
1254 | \helpref{Event handling overview}{eventhandlingoverview} | |
1255 | ||
1256 | \membersection{wxWindow::OnSysColourChanged}\label{wxwindowonsyscolourchanged} | |
1257 | ||
1258 | \func{void}{OnSysColourChanged}{\param{wxOnSysColourChangedEvent\& }{event}} | |
1259 | ||
1260 | Called when the user has changed the system colours. | |
1261 | ||
1262 | \wxheading{Parameters} | |
1263 | ||
1264 | \docparam{event}{System colour change event. For more information, see \helpref{wxSysColourChangedEvent}{wxsyscolourchangedevent}.} | |
1265 | ||
1266 | \wxheading{See also} | |
1267 | ||
1268 | \helpref{wxSysColourChangedEvent}{wxsyscolourchangedevent},\rtfsp | |
1269 | \helpref{Event handling overview}{eventhandlingoverview} | |
1270 | ||
1271 | \membersection{wxWindow::PopEventHandler}\label{wxwindowpopeventhandler} | |
1272 | ||
1273 | \constfunc{wxEvtHandler*}{PopEventHandler}{\param{bool }{deleteHandler = FALSE}} | |
1274 | ||
1275 | Removes and returns the top-most event handler on the event handler stack. | |
1276 | ||
1277 | \wxheading{Parameters} | |
1278 | ||
1279 | \docparam{deleteHandler}{If this is TRUE, the handler will be deleted after it is removed. The | |
1280 | default value is FALSE.} | |
1281 | ||
1282 | \wxheading{See also} | |
1283 | ||
1284 | \helpref{wxWindow::SetEventHandler}{wxwindowseteventhandler},\rtfsp | |
1285 | \helpref{wxWindow::GetEventHandler}{wxwindowgeteventhandler},\rtfsp | |
1286 | \helpref{wxWindow::PushEventHandler}{wxwindowpusheventhandler},\rtfsp | |
1287 | \helpref{wxEvtHandler::ProcessEvent}{wxevthandlerprocessevent},\rtfsp | |
1288 | \helpref{wxEvtHandler}{wxevthandler}\rtfsp | |
1289 | ||
1290 | \membersection{wxWindow::PopupMenu}\label{wxwindowpopupmenu} | |
1291 | ||
eaaa6a06 | 1292 | \func{virtual bool}{PopupMenu}{\param{wxMenu* }{menu}, \param{int }{x}, \param{int }{y}} |
a660d684 KB |
1293 | |
1294 | Pops up the given menu at the specified coordinates, relative to this | |
1295 | window, and returns control when the user has dismissed the menu. If a | |
1296 | menu item is selected, the callback defined for the menu is called with | |
1297 | wxMenu and wxCommandEvent reference arguments. The callback should access | |
1298 | the commandInt member of the event to check the selected menu identifier. | |
1299 | ||
1300 | \wxheading{Parameters} | |
1301 | ||
1302 | \docparam{menu}{Menu to pop up.} | |
1303 | ||
1304 | \docparam{x}{Required x position for the menu to appear.} | |
1305 | ||
1306 | \docparam{y}{Required y position for the menu to appear.} | |
1307 | ||
a660d684 KB |
1308 | \wxheading{See also} |
1309 | ||
1310 | \helpref{wxMenu}{wxmenu}, \helpref{wxWindow::FakePopupMenu}{wxwindowfakepopupmenu} | |
1311 | ||
1312 | \membersection{wxWindow::PushEventHandler}\label{wxwindowpusheventhandler} | |
1313 | ||
1314 | \func{void}{PushEventHandler}{\param{wxEvtHandler* }{handler}} | |
1315 | ||
1316 | Pushes this event handler onto the event stack for the window. | |
1317 | ||
1318 | \wxheading{Parameters} | |
1319 | ||
1320 | \docparam{handler}{Specifies the handler to be pushed.} | |
1321 | ||
1322 | \wxheading{Remarks} | |
1323 | ||
1324 | An event handler is an object that is capable of processing the events | |
1325 | sent to a window. By default, the window is its own event handler, but | |
1326 | an application may wish to substitute another, for example to allow | |
1327 | central implementation of event-handling for a variety of different | |
1328 | window classes. | |
1329 | ||
1330 | \helpref{wxWindow::PushEventHandler}{wxwindowpusheventhandler} allows | |
1331 | an application to set up a chain of event handlers, where an event not handled by one event handler is | |
1332 | handed to the next one in the chain. Use \helpref{wxWindow::PopEventHandler}{wxwindowpopeventhandler} to | |
1333 | remove the event handler. | |
1334 | ||
1335 | \wxheading{See also} | |
1336 | ||
1337 | \helpref{wxWindow::SetEventHandler}{wxwindowseteventhandler},\rtfsp | |
1338 | \helpref{wxWindow::GetEventHandler}{wxwindowgeteventhandler},\rtfsp | |
1339 | \helpref{wxWindow::PopEventHandler}{wxwindowpusheventhandler},\rtfsp | |
1340 | \helpref{wxEvtHandler::ProcessEvent}{wxevthandlerprocessevent},\rtfsp | |
1341 | \helpref{wxEvtHandler}{wxevthandler} | |
1342 | ||
1343 | \membersection{wxWindow::Raise}\label{wxwindowraise} | |
1344 | ||
1345 | \func{void}{Raise}{\void} | |
1346 | ||
1347 | Raises the window to the top of the window hierarchy if it is a managed window (dialog | |
1348 | or frame). | |
1349 | ||
1350 | \membersection{wxWindow::Refresh}\label{wxwindowrefresh} | |
1351 | ||
1352 | \func{virtual void}{Refresh}{\param{const bool}{ eraseBackground = TRUE}, \param{const wxRect* }{rect | |
1353 | = NULL}} | |
1354 | ||
1355 | Causes a message or event to be generated to repaint the | |
1356 | window. | |
1357 | ||
1358 | \wxheading{Parameters} | |
1359 | ||
1360 | \docparam{eraseBackground}{If TRUE, the background will be | |
1361 | erased.} | |
1362 | ||
1363 | \docparam{rect}{If non-NULL, only the given rectangle will | |
1364 | be treated as damaged.} | |
1365 | ||
1366 | \membersection{wxWindow::ReleaseMouse}\label{wxwindowreleasemouse} | |
1367 | ||
1368 | \func{virtual void}{ReleaseMouse}{\void} | |
1369 | ||
1370 | Releases mouse input captured with \helpref{wxWindow::CaptureMouse}{wxwindowcapturemouse}. | |
1371 | ||
1372 | \wxheading{See also} | |
1373 | ||
1374 | \helpref{wxWindow::CaptureMouse}{wxwindowcapturemouse} | |
1375 | ||
1376 | \membersection{wxWindow::RemoveChild}\label{wxwindowremovechild} | |
1377 | ||
1378 | \func{virtual void}{RemoveChild}{\param{wxWindow* }{child}} | |
1379 | ||
1380 | Removes a child window. This is called automatically by window deletion | |
1381 | functions so should not be required by the application programmer. | |
1382 | ||
1383 | \wxheading{Parameters} | |
1384 | ||
1385 | \docparam{child}{Child window to remove.} | |
1386 | ||
1387 | \membersection{wxWindow::ScreenToClient} | |
1388 | ||
1389 | \constfunc{virtual void}{ScreenToClient}{\param{int* }{x}, \param{int* }{y}} | |
1390 | ||
1391 | Converts from screen to client window coordinates. | |
1392 | ||
1393 | \wxheading{Parameters} | |
1394 | ||
1395 | \docparam{x}{Stores the screen x coordinate and receives the client x coordinate.} | |
1396 | ||
1397 | \docparam{y}{Stores the screen x coordinate and receives the client x coordinate.} | |
1398 | ||
1399 | \membersection{wxWindow::ScrollWindow}\label{wxwindowscrollwindow} | |
1400 | ||
eaaa6a06 | 1401 | \func{virtual void}{ScrollWindow}{\param{int }{dx}, \param{int }{dy}, \param{const wxRect*}{ rect = NULL}} |
a660d684 KB |
1402 | |
1403 | Physically scrolls the pixels in the window. | |
1404 | ||
1405 | \wxheading{Parameters} | |
1406 | ||
1407 | \docparam{dx}{Amount to scroll horizontally.} | |
1408 | ||
1409 | \docparam{dy}{Amount to scroll vertically.} | |
1410 | ||
1411 | \docparam{rect}{Rectangle to invalidate. If this is NULL, the whole window is invalidated. If you | |
1412 | pass a rectangle corresponding to the area of the window exposed by the scroll, your painting handler | |
1413 | can optimise painting by checking for the invalidated region.} | |
1414 | ||
1415 | \wxheading{Remarks} | |
1416 | ||
1417 | Available only under Windows. | |
1418 | ||
1419 | Use this function to optimise your scrolling implementations, to minimise the area that must be | |
1420 | redrawn. | |
1421 | ||
3972fb49 JS |
1422 | \membersection{wxWindow::SetAcceleratorTable}\label{wxwindowsetacceleratortable} |
1423 | ||
1424 | \func{virtual void}{SetAcceleratorTable}{\param{const wxAcceleratorTable\&}{ accel}} | |
1425 | ||
1426 | Sets the accelerator table for this window. See \helpref{wxAcceleratorTable}{wxacceleratortable}. | |
1427 | ||
a660d684 KB |
1428 | \membersection{wxWindow::SetAutoLayout}\label{wxwindowsetautolayout} |
1429 | ||
1430 | \func{void}{SetAutoLayout}{\param{const bool}{ autoLayout}} | |
1431 | ||
1432 | Determines whether the \helpref{wxWindow::Layout}{wxwindowlayout} function will | |
1433 | be called automatically when the window is resized. | |
1434 | ||
1435 | \wxheading{Parameters} | |
1436 | ||
1437 | \docparam{autoLayout}{Set this to TRUE if you wish the Layout function to be called | |
1438 | from within wxWindow::OnSize functions.} | |
1439 | ||
1440 | \wxheading{See also} | |
1441 | ||
1442 | \helpref{wxWindow::SetConstraints}{wxwindowsetconstraints} | |
1443 | ||
1444 | \membersection{wxWindow::SetBackgroundColour}\label{wxwindowsetbackgroundcolour} | |
1445 | ||
1446 | \func{virtual void}{SetBackgroundColour}{\param{const wxColour\& }{colour}} | |
1447 | ||
1448 | Sets the background colour of the window. | |
1449 | ||
1450 | \wxheading{Parameters} | |
1451 | ||
1452 | \docparam{colour}{The colour to be used as the background colour.} | |
1453 | ||
1454 | \wxheading{Remarks} | |
1455 | ||
1456 | The background colour is usually painted by the default\rtfsp | |
1457 | \helpref{wxWindow::OnEraseBackground}{wxwindowonerasebackground} event handler function. | |
1458 | ||
1459 | \wxheading{See also} | |
1460 | ||
1461 | \helpref{wxWindow::GetBackgroundColour}{wxwindowgetbackgroundcolour},\rtfsp | |
1462 | \helpref{wxWindow::SetForegroundColour}{wxwindowsetforegroundcolour},\rtfsp | |
1463 | \helpref{wxWindow::GetForegroundColour}{wxwindowgetforegroundcolour},\rtfsp | |
1464 | \helpref{wxWindow::OnEraseBackground}{wxwindowonerasebackground} | |
1465 | ||
1466 | \membersection{wxWindow::SetConstraints}\label{wxwindowsetconstraints} | |
1467 | ||
1468 | \func{void}{SetConstraints}{\param{wxLayoutConstraints* }{constraints}} | |
1469 | ||
1470 | Sets the window to have the given layout constraints. The window | |
1471 | will then own the object, and will take care of its deletion. | |
1472 | If an existing layout constraints object is already owned by the | |
1473 | window, it will be deleted. | |
1474 | ||
1475 | \wxheading{Parameters} | |
1476 | ||
1477 | \docparam{constraints}{The constraints to set. Pass NULL to disassociate and delete the window's | |
1478 | constraints.} | |
1479 | ||
1480 | \wxheading{Remarks} | |
1481 | ||
1482 | You must call \helpref{wxWindow::SetAutoLayout}{wxwindowsetautolayout} to tell a window to use | |
1483 | the constraints automatically in OnSize; otherwise, you must | |
1484 | override OnSize and call Layout explicitly. | |
1485 | ||
a660d684 KB |
1486 | \membersection{wxWindow::SetFocus}\label{wxwindowsetfocus} |
1487 | ||
1488 | \func{virtual void}{SetFocus}{\void} | |
1489 | ||
1490 | This sets the window to receive keyboard input. | |
1491 | ||
1492 | \membersection{wxWindow::SetFont}\label{wxwindowsetfont} | |
1493 | ||
1494 | \func{void}{SetFont}{\param{const wxFont\& }{font}} | |
1495 | ||
1496 | Sets the font for this window. | |
1497 | ||
1498 | \wxheading{Parameters} | |
1499 | ||
1500 | \docparam{font}{Font to associate with this window.} | |
1501 | ||
1502 | \wxheading{See also} | |
1503 | ||
1504 | \helpref{wxWindow::GetFont}{wxwindowgetfont} | |
1505 | ||
1506 | \membersection{wxWindow::SetForegroundColour}\label{wxwindowsetforegroundcolour} | |
1507 | ||
1508 | \func{virtual void}{SetForegroundColour}{\param{const wxColour\& }{colour}} | |
1509 | ||
1510 | Sets the foreground colour of the window. | |
1511 | ||
1512 | \wxheading{Parameters} | |
1513 | ||
1514 | \docparam{colour}{The colour to be used as the foreground colour.} | |
1515 | ||
1516 | \wxheading{Remarks} | |
1517 | ||
1518 | The interpretation of foreground colour is open to interpretation according | |
1519 | to the window class; it may be the text colour or other colour, or it may not | |
1520 | be used at all. | |
1521 | ||
1522 | \wxheading{See also} | |
1523 | ||
1524 | \helpref{wxWindow::GetForegroundColour}{wxwindowgetforegroundcolour},\rtfsp | |
1525 | \helpref{wxWindow::SetBackgroundColour}{wxwindowsetbackgroundcolour},\rtfsp | |
1526 | \helpref{wxWindow::GetBackgroundColour}{wxwindowgetbackgroundcolour} | |
1527 | ||
1528 | \membersection{wxWindow::SetId}\label{wxwindowsetid} | |
1529 | ||
1530 | \func{void}{SetId}{\param{int}{ id}} | |
1531 | ||
1532 | Sets the identifier of the window. | |
1533 | ||
1534 | \wxheading{Remarks} | |
1535 | ||
1536 | Each window has an integer identifier. If the application has not provided one, | |
1537 | an identifier will be generated. Normally, the identifier should be provided | |
1538 | on creation and should not be modified subsequently. | |
1539 | ||
1540 | TODO: perhaps there should be a default identifier for each class, rather | |
1541 | choosing one, which could clash with other ones. | |
1542 | ||
1543 | \wxheading{See also} | |
1544 | ||
1545 | \helpref{wxWindow::GetId}{wxwindowgetid} | |
1546 | ||
1547 | ||
1548 | \membersection{wxWindow::SetName}\label{wxwindowsetname} | |
1549 | ||
1550 | \func{virtual void}{SetName}{\param{const wxString\& }{name}} | |
1551 | ||
1552 | Sets the window's name. | |
1553 | ||
1554 | \wxheading{Parameters} | |
1555 | ||
1556 | \docparam{name}{A name to set for the window.} | |
1557 | ||
1558 | \wxheading{See also} | |
1559 | ||
1560 | \helpref{wxWindow::GetName}{wxwindowgetname} | |
1561 | ||
1562 | \membersection{wxWindow::SetReturnCode}\label{wxwindowsetreturncode} | |
1563 | ||
1564 | \func{void}{SetReturnCode}{\param{int }{retCode}} | |
1565 | ||
1566 | Sets the return code for this window. | |
1567 | ||
1568 | \wxheading{Parameters} | |
1569 | ||
1570 | \docparam{retCode}{The integer return code, usually a control identifier.} | |
1571 | ||
1572 | \wxheading{Remarks} | |
1573 | ||
1574 | A return code is normally associated with a modal dialog, where \helpref{wxDialog::ShowModal}{wxdialogshowmodal} returns | |
1575 | a code to the application. The function \helpref{wxDialog::EndModal}{wxdialogendmodal} calls {\bf SetReturnCode}. | |
1576 | ||
1577 | \wxheading{See also} | |
1578 | ||
1579 | \helpref{wxWindow::GetReturnCode}{wxwindowgetreturncode}, \helpref{wxDialog::ShowModal}{wxdialogshowmodal},\rtfsp | |
1580 | \helpref{wxDialog::EndModal}{wxdialogendmodal} | |
1581 | ||
1582 | \membersection{wxWindow::SetScrollbar}\label{wxwindowsetscrollbar} | |
1583 | ||
eaaa6a06 JS |
1584 | \func{virtual void}{SetScrollbar}{\param{int }{orientation}, \param{int }{position},\rtfsp |
1585 | \param{int }{thumbSize}, \param{int }{range},\rtfsp | |
a660d684 KB |
1586 | \param{const bool }{refresh = TRUE}} |
1587 | ||
1588 | Sets the scrollbar properties of a built-in scrollbar. | |
1589 | ||
1590 | \wxheading{Parameters} | |
1591 | ||
1592 | \docparam{orientation}{Determines the scrollbar whose page size is to be set. May be wxHORIZONTAL or wxVERTICAL.} | |
1593 | ||
1594 | \docparam{position}{The position of the scrollbar in scroll units.} | |
1595 | ||
1596 | \docparam{thumbSize}{The size of the thumb, or visible portion of the scrollbar, in scroll units.} | |
1597 | ||
1598 | \docparam{range}{The maximum position of the scrollbar.} | |
1599 | ||
1600 | \docparam{refresh}{TRUE to redraw the scrollbar, FALSE otherwise.} | |
1601 | ||
1602 | \wxheading{Remarks} | |
1603 | ||
1604 | Let's say you wish to display 50 lines of text, using the same font. | |
1605 | The window is sized so that you can only see 16 lines at a time. | |
1606 | ||
1607 | You would use: | |
1608 | ||
1609 | {\small% | |
1610 | \begin{verbatim} | |
1611 | SetScrollbar(wxVERTICAL, 0, 16, 50); | |
1612 | \end{verbatim} | |
1613 | } | |
1614 | ||
1615 | Note that with the window at this size, the thumb position can never go | |
1616 | above 50 minus 16, or 34. | |
1617 | ||
1618 | You can determine how many lines are currently visible by dividing the current view | |
1619 | size by the character height in pixels. | |
1620 | ||
1621 | When defining your own scrollbar behaviour, you will always need to recalculate | |
1622 | the scrollbar settings when the window size changes. You could therefore put your | |
1623 | scrollbar calculations and SetScrollbar | |
1624 | call into a function named AdjustScrollbars, which can be called initially and also | |
1625 | from your \helpref{wxWindow::OnSize}{wxwindowonsize} event handler function. | |
1626 | ||
1627 | \wxheading{See also} | |
1628 | ||
1629 | \helpref{Scrolling overview}{scrollingoverview},\rtfsp | |
1630 | \helpref{wxScrollBar}{wxscrollbar}, \helpref{wxScrolledWindow}{wxscrolledwindow} | |
1631 | ||
1632 | \begin{comment} | |
1633 | \membersection{wxWindow::SetScrollPage}\label{wxwindowsetscrollpage} | |
1634 | ||
eaaa6a06 | 1635 | \func{virtual void}{SetScrollPage}{\param{int }{orientation}, \param{int }{pageSize}, \param{const bool }{refresh = TRUE}} |
a660d684 KB |
1636 | |
1637 | Sets the page size of one of the built-in scrollbars. | |
1638 | ||
1639 | \wxheading{Parameters} | |
1640 | ||
1641 | \docparam{orientation}{Determines the scrollbar whose page size is to be set. May be wxHORIZONTAL or wxVERTICAL.} | |
1642 | ||
1643 | \docparam{pageSize}{Page size in scroll units.} | |
1644 | ||
1645 | \docparam{refresh}{TRUE to redraw the scrollbar, FALSE otherwise.} | |
1646 | ||
1647 | \wxheading{Remarks} | |
1648 | ||
1649 | The page size of a scrollbar is the number of scroll units that the scroll thumb travels when you | |
1650 | click on the area above/left of or below/right of the thumb. Normally you will want a whole visible | |
1651 | page to be scrolled, i.e. the size of the current view (perhaps the window client size). This | |
1652 | value has to be adjusted when the window is resized, since the page size will have changed. | |
1653 | ||
1654 | In addition to specifying how far the scroll thumb travels when paging, in Motif and some versions of Windows | |
1655 | the thumb changes size to reflect the page size relative to the length of the document. When the | |
1656 | document size is only slightly bigger than the current view (window) size, almost all of the scrollbar | |
1657 | will be taken up by the thumb. When the two values become the same, the scrollbar will (on some systems) | |
1658 | disappear. | |
1659 | ||
1660 | Currently, this function should be called before SetPageRange, because of a quirk in the Windows | |
1661 | handling of pages and ranges. | |
1662 | ||
1663 | \wxheading{See also} | |
1664 | ||
1665 | \helpref{wxWindow::SetScrollPos}{wxwindowsetscrollpos},\rtfsp | |
a660d684 | 1666 | \helpref{wxWindow::GetScrollPos}{wxwindowsetscrollpos},\rtfsp |
f7bd2698 | 1667 | \helpref{wxWindow::GetScrollPage}{wxwindowsetscrollpage},\rtfsp |
a660d684 KB |
1668 | \helpref{wxScrollBar}{wxscrollbar}, \helpref{wxScrolledWindow}{wxscrolledwindow} |
1669 | \end{comment} | |
1670 | ||
1671 | \membersection{wxWindow::SetScrollPos}\label{wxwindowsetscrollpos} | |
1672 | ||
eaaa6a06 | 1673 | \func{virtual void}{SetScrollPos}{\param{int }{orientation}, \param{int }{pos}, \param{const bool }{refresh = TRUE}} |
a660d684 KB |
1674 | |
1675 | Sets the position of one of the built-in scrollbars. | |
1676 | ||
1677 | \wxheading{Parameters} | |
1678 | ||
1679 | \docparam{orientation}{Determines the scrollbar whose position is to be set. May be wxHORIZONTAL or wxVERTICAL.} | |
1680 | ||
1681 | \docparam{pos}{Position in scroll units.} | |
1682 | ||
1683 | \docparam{refresh}{TRUE to redraw the scrollbar, FALSE otherwise.} | |
1684 | ||
1685 | \wxheading{Remarks} | |
1686 | ||
1687 | This function does not directly affect the contents of the window: it is up to the | |
1688 | application to take note of scrollbar attributes and redraw contents accordingly. | |
1689 | ||
1690 | \wxheading{See also} | |
1691 | ||
1692 | \helpref{wxWindow::SetScrollbar}{wxwindowsetscrollbar},\rtfsp | |
1693 | \helpref{wxWindow::GetScrollPos}{wxwindowsetscrollpos},\rtfsp | |
f7bd2698 | 1694 | \helpref{wxWindow::GetScrollThumb}{wxwindowgetscrollthumb},\rtfsp |
a660d684 KB |
1695 | \helpref{wxScrollBar}{wxscrollbar}, \helpref{wxScrolledWindow}{wxscrolledwindow} |
1696 | ||
1697 | \begin{comment} | |
1698 | \membersection{wxWindow::SetScrollRange}\label{wxwindowsetscrollrange} | |
1699 | ||
eaaa6a06 | 1700 | \func{virtual void}{SetScrollRange}{\param{int }{orientation}, \param{int }{range}, \param{const bool }{refresh = TRUE}} |
a660d684 KB |
1701 | |
1702 | Sets the range of one of the built-in scrollbars. | |
1703 | ||
1704 | \wxheading{Parameters} | |
1705 | ||
1706 | \docparam{orientation}{Determines the scrollbar whose range is to be set. May be wxHORIZONTAL or wxVERTICAL.} | |
1707 | ||
1708 | \docparam{range}{Scroll range.} | |
1709 | ||
1710 | \docparam{refresh}{TRUE to redraw the scrollbar, FALSE otherwise.} | |
1711 | ||
1712 | \wxheading{Remarks} | |
1713 | ||
1714 | The range of a scrollbar is the number of steps that the thumb may travel, rather than the total | |
fe604ccd JS |
1715 | object length of the scrollbar. If you are implementing a scrolling window, for example, you |
1716 | would adjust the scroll range when the window is resized, by subtracting the window view size from the | |
1717 | total virtual window size. When the two sizes are the same (all the window is visible), the range goes to zero | |
a660d684 KB |
1718 | and usually the scrollbar will be automatically hidden. |
1719 | ||
1720 | \wxheading{See also} | |
1721 | ||
1722 | \helpref{wxWindow::SetScrollPos}{wxwindowsetscrollpos},\rtfsp | |
1723 | \helpref{wxWindow::SetScrollPage}{wxwindowsetscrollpage},\rtfsp | |
1724 | \helpref{wxWindow::GetScrollPos}{wxwindowsetscrollpos},\rtfsp | |
f7bd2698 | 1725 | \helpref{wxWindow::GetScrollPage}{wxwindowsetscrollpage},\rtfsp |
a660d684 KB |
1726 | \helpref{wxScrollBar}{wxscrollbar}, \helpref{wxScrolledWindow}{wxscrolledwindow} |
1727 | \end{comment} | |
1728 | ||
1729 | \membersection{wxWindow::SetSize}\label{wxwindowsetsize} | |
1730 | ||
eaaa6a06 JS |
1731 | \func{virtual void}{SetSize}{\param{int}{ x}, \param{int}{ y}, \param{int}{ width}, \param{int}{ height}, |
1732 | \param{int}{ sizeFlags = wxSIZE\_AUTO}} | |
a660d684 KB |
1733 | |
1734 | Sets the size and position of the window in pixels. | |
1735 | ||
eaaa6a06 | 1736 | \func{virtual void}{SetSize}{\param{int}{ width}, \param{int}{ height}} |
a660d684 KB |
1737 | |
1738 | Sets the size of the window in pixels. | |
1739 | ||
1740 | \wxheading{Parameters} | |
1741 | ||
1742 | \docparam{x}{Required x position in pixels, or -1 to indicate that the existing | |
1743 | value should be used.} | |
1744 | ||
1745 | \docparam{y}{Required y position in pixels, or -1 to indicate that the existing | |
1746 | value should be used.} | |
1747 | ||
1748 | \docparam{width}{Required width in pixels, or -1 to indicate that the existing | |
1749 | value should be used.} | |
1750 | ||
1751 | \docparam{height}{Required height position in pixels, or -1 to indicate that the existing | |
1752 | value should be used.} | |
1753 | ||
1754 | \docparam{sizeFlags}{Indicates the interpretation of other parameters. It is a bit list of the following: | |
1755 | ||
1756 | {\bf wxSIZE\_AUTO\_WIDTH}: a -1 width value is taken to indicate | |
1757 | a wxWindows-supplied default width.\\ | |
1758 | {\bf wxSIZE\_AUTO\_HEIGHT}: a -1 height value is taken to indicate | |
1759 | a wxWindows-supplied default width.\\ | |
1760 | {\bf wxSIZE\_AUTO}: -1 size values are taken to indicate | |
1761 | a wxWindows-supplied default size.\\ | |
1762 | {\bf wxSIZE\_USE\_EXISTING}: existing dimensions should be used | |
1763 | if -1 values are supplied.\\ | |
1764 | {\bf wxSIZE\_ALLOW\_MINUS\_ONE}: allow dimensions of -1 and less to be interpreted | |
1765 | as real dimensions, not default values. | |
1766 | } | |
1767 | ||
1768 | \wxheading{Remarks} | |
1769 | ||
1770 | The second form is a convenience for calling the first form with default | |
1771 | x and y parameters, and must be used with non-default width and height values. | |
1772 | ||
1773 | The first form sets the position and optionally size, of the window. | |
1774 | Parameters may be -1 to indicate either that a default should be supplied | |
1775 | by wxWindows, or that the current value of the dimension should be used. | |
1776 | ||
1777 | \wxheading{See also} | |
1778 | ||
1779 | \helpref{wxWindow::Move}{wxwindowmove} | |
1780 | ||
1781 | \membersection{wxWindow::SetSizeHints}\label{wxwindowsetsizehints} | |
1782 | ||
eaaa6a06 JS |
1783 | \func{virtual void}{SetSizeHints}{\param{int}{ minW=-1}, \param{int}{ minH=-1}, \param{int}{ maxW=-1}, \param{int}{ maxH=-1}, |
1784 | \param{int}{ incW=-1}, \param{int}{ incH=-1}} | |
a660d684 KB |
1785 | |
1786 | Allows specification of minimum and maximum window sizes, and window size increments. | |
1787 | If a pair of values is not set (or set to -1), the default values will be used. | |
1788 | ||
1789 | \wxheading{Parameters} | |
1790 | ||
1791 | \docparam{minW}{Specifies the minimum width allowable.} | |
1792 | ||
1793 | \docparam{minH}{Specifies the minimum height allowable.} | |
1794 | ||
1795 | \docparam{maxW}{Specifies the maximum width allowable.} | |
1796 | ||
1797 | \docparam{maxH}{Specifies the maximum height allowable.} | |
1798 | ||
1799 | \docparam{incW}{Specifies the increment for sizing the width (Motif/Xt only).} | |
1800 | ||
1801 | \docparam{incH}{Specifies the increment for sizing the height (Motif/Xt only).} | |
1802 | ||
1803 | \wxheading{Remarks} | |
1804 | ||
1805 | If this function is called, the user will not be able to size the window outside the | |
1806 | given bounds. | |
1807 | ||
1808 | The resizing increments are only significant under Motif or Xt. | |
1809 | ||
1810 | \membersection{wxWindow::SetClientSize} | |
1811 | ||
eaaa6a06 | 1812 | \func{virtual void}{SetClientSize}{\param{int}{ width}, \param{int}{ height}} |
a660d684 KB |
1813 | |
1814 | This sets the size of the window client area in pixels. Using this function to size a window | |
1815 | tends to be more device-independent than \helpref{wxWindow::SetSize}{wxwindowsetsize}, since the application need not | |
1816 | worry about what dimensions the border or title bar have when trying to fit the window | |
1817 | around panel items, for example. | |
1818 | ||
1819 | \wxheading{Parameters} | |
1820 | ||
1821 | \docparam{width}{The required client area width.} | |
1822 | ||
1823 | \docparam{height}{The required client area height.} | |
1824 | ||
1825 | \membersection{wxWindow::SetPalette} | |
1826 | ||
1827 | \func{virtual void}{SetPalette}{\param{wxPalette* }{palette}} | |
1828 | ||
1829 | Obsolete - use \helpref{wxDC::SetPalette}{wxdcsetpalette} instead. | |
1830 | ||
1831 | \membersection{wxWindow::SetCursor}\label{wxwindowsetcursor} | |
1832 | ||
1833 | \func{virtual void}{SetCursor}{\param{const wxCursor\&}{cursor}} | |
1834 | ||
1835 | Sets the window's cursor. | |
1836 | ||
1837 | \wxheading{Parameters} | |
1838 | ||
1839 | \docparam{cursor}{Specifies the cursor that the window should normally display.} | |
1840 | ||
1841 | \wxheading{Remarks} | |
1842 | ||
1843 | Under Windows, you sometimes need to call ::wxSetCursor in addition to this | |
1844 | function if you want the cursor to change immediately, because under Windows, | |
1845 | wxWindows only sets the global cursor when it detects mouse movement. | |
1846 | ||
1847 | \wxheading{See also} | |
1848 | ||
1849 | \helpref{::wxSetCursor}{wxsetcursor}, \helpref{wxCursor}{wxcursor} | |
1850 | ||
1851 | \membersection{wxWindow::SetEventHandler}\label{wxwindowseteventhandler} | |
1852 | ||
1853 | \func{void}{SetEventHandler}{\param{wxEvtHandler* }{handler}} | |
1854 | ||
1855 | Sets the event handler for this window. | |
1856 | ||
1857 | \wxheading{Parameters} | |
1858 | ||
1859 | \docparam{handler}{Specifies the handler to be set.} | |
1860 | ||
1861 | \wxheading{Remarks} | |
1862 | ||
1863 | An event handler is an object that is capable of processing the events | |
1864 | sent to a window. By default, the window is its own event handler, but | |
1865 | an application may wish to substitute another, for example to allow | |
1866 | central implementation of event-handling for a variety of different | |
1867 | window classes. | |
1868 | ||
1869 | It is usually better to use \helpref{wxWindow::PushEventHandler}{wxwindowpusheventhandler} since | |
1870 | this sets up a chain of event handlers, where an event not handled by one event handler is | |
1871 | handed to the next one in the chain. | |
1872 | ||
1873 | \wxheading{See also} | |
1874 | ||
1875 | \helpref{wxWindow::GetEventHandler}{wxwindowgeteventhandler},\rtfsp | |
1876 | \helpref{wxWindow::PushEventHandler}{wxwindowpusheventhandler},\rtfsp | |
1877 | \helpref{wxWindow::PopEventHandler}{wxwindowpusheventhandler},\rtfsp | |
1878 | \helpref{wxEvtHandler::ProcessEvent}{wxevthandlerprocessevent},\rtfsp | |
1879 | \helpref{wxEvtHandler}{wxevthandler} | |
1880 | ||
1881 | \membersection{wxWindow::SetTitle}\label{wxwindowsettitle} | |
1882 | ||
1883 | \func{virtual void}{SetTitle}{\param{const wxString\& }{title}} | |
1884 | ||
1885 | Sets the window's title. Applicable only to frames and dialogs. | |
1886 | ||
1887 | \wxheading{Parameters} | |
1888 | ||
1889 | \docparam{title}{The window's title.} | |
1890 | ||
1891 | \wxheading{See also} | |
1892 | ||
1893 | \helpref{wxWindow::GetTitle}{wxwindowgettitle} | |
1894 | ||
1895 | \membersection{wxWindow::Show} | |
1896 | ||
1897 | \func{virtual bool}{Show}{\param{const bool}{ show}} | |
1898 | ||
1899 | Shows or hides the window. | |
1900 | ||
1901 | \wxheading{Parameters} | |
1902 | ||
1903 | \docparam{show}{If TRUE, displays the window and brings it to the front. Otherwise, | |
1904 | hides the window.} | |
1905 | ||
1906 | \wxheading{See also} | |
1907 | ||
1908 | \helpref{wxWindow::IsShown}{wxwindowisshown} | |
1909 | ||
1910 | \membersection{wxWindow::TransferDataFromWindow}\label{wxwindowtransferdatafromwindow} | |
1911 | ||
1912 | \func{virtual bool}{TransferDataFromWindow}{\void} | |
1913 | ||
1914 | Transfers values from child controls to data areas specified by their validators. Returns | |
1915 | FALSE if a transfer failed. | |
1916 | ||
1917 | \wxheading{See also} | |
1918 | ||
1919 | \helpref{wxWindow::TransferDataToWindow}{wxwindowtransferdatatowindow},\rtfsp | |
1920 | \helpref{wxValidator}{wxvalidator}, \helpref{wxWindow::Validate}{wxwindowvalidate} | |
1921 | ||
1922 | \membersection{wxWindow::TransferDataToWindow}\label{wxwindowtransferdatatowindow} | |
1923 | ||
1924 | \func{virtual bool}{TransferDataToWindow}{\void} | |
1925 | ||
1926 | Transfers values to child controls from data areas specified by their validators. | |
1927 | ||
1928 | \wxheading{Return value} | |
1929 | ||
1930 | Returns FALSE if a transfer failed. | |
1931 | ||
1932 | \wxheading{See also} | |
1933 | ||
1934 | \helpref{wxWindow::TransferDataFromWindow}{wxwindowtransferdatafromwindow},\rtfsp | |
1935 | \helpref{wxValidator}{wxvalidator}, \helpref{wxWindow::Validate}{wxwindowvalidate} | |
1936 | ||
1937 | \membersection{wxWindow::Validate}\label{wxwindowvalidate} | |
1938 | ||
1939 | \func{virtual bool}{Validate}{\void} | |
1940 | ||
1941 | Validates the current values of the child controls using their validators. | |
1942 | ||
1943 | \wxheading{Return value} | |
1944 | ||
1945 | Returns FALSE if any of the validations failed. | |
1946 | ||
1947 | \wxheading{See also} | |
1948 | ||
1949 | \helpref{wxWindow::TransferDataFromWindow}{wxwindowtransferdatafromwindow},\rtfsp | |
1950 | \helpref{wxWindow::TransferDataFromWindow}{wxwindowtransferdatafromwindow},\rtfsp | |
1951 | \helpref{wxValidator}{wxvalidator} | |
1952 | ||
1953 | \membersection{wxWindow::WarpPointer}\label{wxwindowwarppointer} | |
1954 | ||
1955 | \func{void}{WarpPointer}{\param{int}{ x}, \param{int}{ y}} | |
1956 | ||
1957 | Moves the pointer to the given position on the window. | |
1958 | ||
1959 | \wxheading{Parameters} | |
1960 | ||
1961 | \docparam{x}{The new x position for the cursor.} | |
1962 | ||
1963 | \docparam{y}{The new y position for the cursor.} | |
1964 |