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