1 \section{\class{wxWindow
}}\label{wxwindow
}
3 wxWindow is the base class for all windows. Any children of the window will be deleted
4 automatically by the destructor before the window itself is deleted.
6 Please note that we documented a number of handler functions (OnChar(), OnMouse() etc.) in this
7 help text. These must not be called by a user program and are documented only for illustration.
8 On several platforms, only a few of these handlers are actually written (they are not always
9 needed) and if you are uncertain on how to add a certain behaviour to a window class, intercept
10 the respective event as usual and call
\helpref{wxEvent::Skip
}{wxeventskip
} so that the native
11 platform can implement its native behaviour or just ignore the event if nothing needs to be
14 \wxheading{Derived from
}
16 \helpref{wxEvtHandler
}{wxevthandler
}\\
17 \helpref{wxObject
}{wxobject
}
19 \wxheading{Include files
}
23 \wxheading{Window styles
}
25 The following styles can apply to all windows, although they will not always make sense for a particular
26 window class or on all platforms.
29 \begin{twocollist
}\itemsep=
0pt
30 \twocolitem{\windowstyle{wxSIMPLE
\_BORDER}}{Displays a thin border around the window. wxBORDER is the old name
32 \twocolitem{\windowstyle{wxDOUBLE
\_BORDER}}{Displays a double border. Windows only.
}
33 \twocolitem{\windowstyle{wxSUNKEN
\_BORDER}}{Displays a sunken border.
}
34 \twocolitem{\windowstyle{wxRAISED
\_BORDER}}{Displays a raised border. GTK only.
}
35 \twocolitem{\windowstyle{wxSTATIC
\_BORDER}}{Displays a border suitable for a static control. Windows only.
}
36 \twocolitem{\windowstyle{wxTRANSPARENT
\_WINDOW}}{The window is transparent, that is, it will not receive paint
37 events. Windows only.
}
38 \twocolitem{\windowstyle{wxNO
\_3D}}{Prevents the children of this window taking on
3D styles, even though
39 the application-wide policy is for
3D controls. Windows only.
}
40 \twocolitem{\windowstyle{wxTAB
\_TRAVERSAL}}{Use this to enable tab traversal for non-dialog windows.
}
41 \twocolitem{\windowstyle{wxWANTS
\_CHARS}}{Use this to indicate that the window
42 wants to get all char events - even for keys like TAB or ENTER which are
43 usually used for dialog navigation and which wouldn't be generated without
45 \twocolitem{\windowstyle{wxNO
\_FULL\_REPAINT\_ON\_RESIZE}}{Disables repainting
46 the window completely when its size is changed - you will have to repaint the
47 new window area manually if you use this style. Currently only has an effect for
49 \twocolitem{\windowstyle{wxVSCROLL
}}{Use this style to enable a vertical scrollbar. (Still used?)
}
50 \twocolitem{\windowstyle{wxHSCROLL
}}{Use this style to enable a horizontal scrollbar. (Still used?)
}
51 \twocolitem{\windowstyle{wxCLIP
\_CHILDREN}}{Use this style to eliminate flicker caused by the background being
52 repainted, then children being painted over them. Windows only.
}
55 See also
\helpref{window styles overview
}{windowstyles
}.
59 \helpref{Event handling overview
}{eventhandlingoverview
}
61 \latexignore{\rtfignore{\wxheading{Members
}}}
63 \membersection{wxWindow::wxWindow
}\label{wxwindowctor
}
65 \func{}{wxWindow
}{\void}
69 \func{}{wxWindow
}{\param{wxWindow*
}{ parent
},
\param{wxWindowID
}{id
},
70 \param{const wxPoint\&
}{pos = wxDefaultPosition
},
71 \param{const wxSize\&
}{size = wxDefaultSize
},
72 \param{long
}{style =
0},
73 \param{const wxString\&
}{name = wxPanelNameStr
}}
75 Constructs a window, which can be a child of a frame, dialog or any other non-control window.
77 \wxheading{Parameters
}
79 \docparam{parent
}{Pointer to a parent window.
}
81 \docparam{id
}{Window identifier. If -
1, will automatically create an identifier.
}
83 \docparam{pos
}{Window position. wxDefaultPosition is (-
1, -
1) which indicates that wxWindows
84 should generate a default position for the window. If using the wxWindow class directly, supply
87 \docparam{size
}{Window size. wxDefaultSize is (-
1, -
1) which indicates that wxWindows
88 should generate a default size for the window. If no suitable size can be found, the
89 window will be sized to
20x20 pixels so that the window is visible but obviously not
92 \docparam{style
}{Window style. For generic window styles, please see
\helpref{wxWindow
}{wxwindow
}.
}
94 \docparam{name
}{Window name.
}
96 \membersection{wxWindow::
\destruct{wxWindow
}}
98 \func{}{\destruct{wxWindow
}}{\void}
100 Destructor. Deletes all subwindows, then deletes itself. Instead of using
101 the
{\bf delete
} operator explicitly, you should normally
102 use
\helpref{wxWindow::Destroy
}{wxwindowdestroy
} so that wxWindows
103 can delete a window only when it is safe to do so, in idle time.
107 \helpref{Window deletion overview
}{windowdeletionoverview
},
\rtfsp
108 \helpref{wxWindow::OnCloseWindow
}{wxwindowonclosewindow
},
\rtfsp
109 \helpref{wxWindow::Destroy
}{wxwindowdestroy
},
\rtfsp
110 \helpref{wxCloseEvent
}{wxcloseevent
}
112 \membersection{wxWindow::AddChild
}
114 \func{virtual void
}{AddChild
}{\param{wxWindow*
}{child
}}
116 Adds a child window. This is called automatically by window creation
117 functions so should not be required by the application programmer.
119 \wxheading{Parameters
}
121 \docparam{child
}{Child window to add.
}
123 \membersection{wxWindow::CaptureMouse
}\label{wxwindowcapturemouse
}
125 \func{virtual void
}{CaptureMouse
}{\void}
127 Directs all mouse input to this window. Call
\helpref{wxWindow::ReleaseMouse
}{wxwindowreleasemouse
} to
132 \helpref{wxWindow::ReleaseMouse
}{wxwindowreleasemouse
}
134 \membersection{wxWindow::Center
}\label{wxwindowcenter
}
136 \func{void
}{Center
}{\param{int
}{ direction
}}
138 A synonym for
\helpref{Centre
}{wxwindowcentre
}.
140 \membersection{wxWindow::CenterOnParent
}\label{wxwindowcenteronparent
}
142 \func{void
}{CenterOnParent
}{\param{int
}{ direction
}}
144 A synonym for
\helpref{CentreOnParent
}{wxwindowcentreonparent
}.
146 \membersection{wxWindow::CenterOnScreen
}\label{wxwindowcenteronscreen
}
148 \func{void
}{CenterOnScreen
}{\param{int
}{ direction
}}
150 A synonym for
\helpref{CentreOnScreen
}{wxwindowcentreonscreen
}.
152 \membersection{wxWindow::Centre
}\label{wxwindowcentre
}
154 \func{void
}{Centre
}{\param{int
}{ direction = wxBOTH
}}
158 \wxheading{Parameters
}
160 \docparam{direction
}{Specifies the direction for the centering. May be
{\tt wxHORIZONTAL
},
{\tt wxVERTICAL
}\rtfsp
161 or
{\tt wxBOTH
}. It may also include
{\tt wxCENTRE
\_ON\_SCREEN} flag
162 if you want to center the window on the entire screen and not on its
165 The flag
{\tt wxCENTRE
\_FRAME} is obsolete and should not be used any longer
170 If the window is a top level one (i.e. doesn't have a parent), it will be
171 centered relative to the screen anyhow.
175 \helpref{wxWindow::Center
}{wxwindowcenter
}
177 \membersection{wxWindow::CentreOnParent
}\label{wxwindowcentreonparent
}
179 \func{void
}{CentreOnParent
}{\param{int
}{ direction = wxBOTH
}}
181 Centres the window on its parent. This is a more readable synonym for
182 \helpref{Centre
}{wxwindowcentre
}.
184 \wxheading{Parameters
}
186 \docparam{direction
}{Specifies the direction for the centering. May be
{\tt wxHORIZONTAL
},
{\tt wxVERTICAL
}\rtfsp
191 This methods provides for a way to center top level windows over their
192 parents instead of the entire screen. If there is no parent or if the
193 window is not a top level window, then behaviour is the same as
194 \helpref{wxWindow::Centre
}{wxwindowcentre
}.
198 \helpref{wxWindow::CentreOnScreen
}{wxwindowcenteronscreen
}
200 \membersection{wxWindow::CentreOnScreen
}\label{wxwindowcentreonscreen
}
202 \func{void
}{CentreOnScreen
}{\param{int
}{ direction = wxBOTH
}}
204 Centres the window on screen. This only works for top level windows -
205 otherwise, the window will still be centered on its parent.
207 \wxheading{Parameters
}
209 \docparam{direction
}{Specifies the direction for the centering. May be
{\tt wxHORIZONTAL
},
{\tt wxVERTICAL
}\rtfsp
214 \helpref{wxWindow::CentreOnParent
}{wxwindowcenteronparent
}
216 \membersection{wxWindow::Clear
}\label{wxwindowclear
}
218 \func{void
}{Clear
}{\void}
220 Clears the window by filling it with the current background colour. Does not
221 cause an erase background event to be generated.
223 \membersection{wxWindow::ClientToScreen
}
225 \constfunc{virtual void
}{ClientToScreen
}{\param{int*
}{x
},
\param{int*
}{y
}}
227 \constfunc{virtual wxPoint
}{ClientToScreen
}{\param{const wxPoint\&
}{ pt
}}
229 Converts to screen coordinates from coordinates relative to this window.
231 \docparam{x
}{A pointer to a integer value for the x coordinate. Pass the client coordinate in, and
232 a screen coordinate will be passed out.
}
234 \docparam{y
}{A pointer to a integer value for the y coordinate. Pass the client coordinate in, and
235 a screen coordinate will be passed out.
}
237 \docparam{pt
}{The client position for the second form of the function.
}
239 \pythonnote{In place of a single overloaded method name, wxPython
240 implements the following methods:
\par
241 \indented{2cm
}{\begin{twocollist
}
242 \twocolitem{{\bf ClientToScreen(point)
}}{Accepts and returns a wxPoint
}
243 \twocolitem{{\bf ClientToScreenXY(x, y)
}}{Returns a
2-tuple, (x, y)
}
248 \membersection{wxWindow::Close
}\label{wxwindowclose
}
250 \func{virtual bool
}{Close
}{\param{bool
}{ force = FALSE
}}
252 The purpose of this call is to provide a safer way of destroying a window than using
253 the
{\it delete
} operator.
255 \wxheading{Parameters
}
257 \docparam{force
}{FALSE if the window's close handler should be able to veto the destruction
258 of this window, TRUE if it cannot.
}
262 Close calls the
\helpref{close handler
}{wxcloseevent
} for the window, providing an opportunity for the window to
263 choose whether to destroy the window.
265 The close handler should check whether the window is being deleted forcibly,
266 using
\helpref{wxCloseEvent::GetForce
}{wxcloseeventgetforce
}, in which case it should
267 destroy the window using
\helpref{wxWindow::Destroy
}{wxwindowdestroy
}.
269 Applies to managed windows (wxFrame and wxDialog classes) only.
271 {\it Note
} that calling Close does not guarantee that the window will be destroyed; but it
272 provides a way to simulate a manual close of a window, which may or may not be implemented by
273 destroying the window. The default implementation of wxDialog::OnCloseWindow does not
274 necessarily delete the dialog, since it will simply simulate an wxID
\_CANCEL event which
275 itself only hides the dialog.
277 To guarantee that the window will be destroyed, call
\helpref{wxWindow::Destroy
}{wxwindowdestroy
} instead.
281 \helpref{Window deletion overview
}{windowdeletionoverview
},
\rtfsp
282 \helpref{wxWindow::OnCloseWindow
}{wxwindowonclosewindow
},
\rtfsp
283 \helpref{wxWindow::Destroy
}{wxwindowdestroy
},
\rtfsp
284 \helpref{wxCloseEvent
}{wxcloseevent
}
286 \membersection{wxWindow::ConvertDialogToPixels
}\label{wxwindowconvertdialogtopixels
}
288 \func{wxPoint
}{ConvertDialogToPixels
}{\param{const wxPoint\&
}{ pt
}}
290 \func{wxSize
}{ConvertDialogToPixels
}{\param{const wxSize\&
}{ sz
}}
292 Converts a point or size from dialog units to pixels.
294 For the x dimension, the dialog units are multiplied by the average character width
295 and then divided by
4.
297 For the y dimension, the dialog units are multiplied by the average character height
298 and then divided by
8.
302 Dialog units are used for maintaining a dialog's proportions even if the font changes.
303 Dialogs created using Dialog Editor optionally use dialog units.
305 You can also use these functions programmatically. A convenience macro is defined:
309 #define wxDLG_UNIT(parent, pt) parent->ConvertDialogToPixels(pt)
315 \helpref{wxWindow::ConvertPixelsToDialog
}{wxwindowconvertpixelstodialog
}
317 \pythonnote{In place of a single overloaded method name, wxPython
318 implements the following methods:
\par
319 \indented{2cm
}{\begin{twocollist
}
320 \twocolitem{{\bf ConvertDialogPointToPixels(point)
}}{Accepts and returns a wxPoint
}
321 \twocolitem{{\bf ConvertDialogSizeToPixels(size)
}}{Accepts and returns a wxSize
}
324 Additionally, the following helper functions are defined:
\par
325 \indented{2cm
}{\begin{twocollist
}
326 \twocolitem{{\bf wxDLG
\_PNT(win, point)
}}{Converts a wxPoint from dialog
328 \twocolitem{{\bf wxDLG
\_SZE(win, size)
}}{Converts a wxSize from dialog
334 \membersection{wxWindow::ConvertPixelsToDialog
}\label{wxwindowconvertpixelstodialog
}
336 \func{wxPoint
}{ConvertPixelsToDialog
}{\param{const wxPoint\&
}{ pt
}}
338 \func{wxSize
}{ConvertPixelsToDialog
}{\param{const wxSize\&
}{ sz
}}
340 Converts a point or size from pixels to dialog units.
342 For the x dimension, the pixels are multiplied by
4 and then divided by the average
345 For the y dimension, the pixels are multipled by
8 and then divided by the average
350 Dialog units are used for maintaining a dialog's proportions even if the font changes.
351 Dialogs created using Dialog Editor optionally use dialog units.
355 \helpref{wxWindow::ConvertDialogToPixels
}{wxwindowconvertdialogtopixels
}
358 \pythonnote{In place of a single overloaded method name, wxPython
359 implements the following methods:
\par
360 \indented{2cm
}{\begin{twocollist
}
361 \twocolitem{{\bf ConvertDialogPointToPixels(point)
}}{Accepts and returns a wxPoint
}
362 \twocolitem{{\bf ConvertDialogSizeToPixels(size)
}}{Accepts and returns a wxSize
}
366 \membersection{wxWindow::Destroy
}\label{wxwindowdestroy
}
368 \func{virtual bool
}{Destroy
}{\void}
370 Destroys the window safely. Use this function instead of the delete operator, since
371 different window classes can be destroyed differently. Frames and dialogs
372 are not destroyed immediately when this function is called - they are added
373 to a list of windows to be deleted on idle time, when all the window's events
374 have been processed. This prevents problems with events being sent to non-existant
377 \wxheading{Return value
}
379 TRUE if the window has either been successfully deleted, or it has been added
380 to the list of windows pending real deletion.
382 \membersection{wxWindow::DestroyChildren
}
384 \func{virtual void
}{DestroyChildren
}{\void}
386 Destroys all children of a window. Called automatically by the destructor.
388 \membersection{wxWindow::DragAcceptFiles
}\label{wxwindowdragacceptfiles
}
390 \func{virtual void
}{DragAcceptFiles
}{\param{bool
}{ accept
}}
392 Enables or disables elibility for drop file events (OnDropFiles).
394 \wxheading{Parameters
}
396 \docparam{accept
}{If TRUE, the window is eligible for drop file events. If FALSE, the window
397 will not accept drop file events.
}
405 \helpref{wxWindow::OnDropFiles
}{wxwindowondropfiles
}
407 \membersection{wxWindow::Enable
}\label{wxwindowenable
}
409 \func{virtual void
}{Enable
}{\param{bool
}{ enable
}}
411 Enable or disable the window for user input.
413 \wxheading{Parameters
}
415 \docparam{enable
}{If TRUE, enables the window for input. If FALSE, disables the window.
}
419 \helpref{wxWindow::IsEnabled
}{wxwindowisenabled
}
421 \membersection{wxWindow::FindFocus
}\label{wxwindowfindfocus
}
423 \func{static wxWindow*
}{FindFocus
}{\void}
425 Finds the window or control which currently has the keyboard focus.
429 Note that this is a static function, so it can be called without needing a wxWindow pointer.
433 \helpref{wxWindow::SetFocus
}{wxwindowsetfocus
}
435 \membersection{wxWindow::FindWindow
}\label{wxwindowfindwindow
}
437 \func{wxWindow*
}{FindWindow
}{\param{long
}{ id
}}
439 Find a child of this window, by identifier.
441 \func{wxWindow*
}{FindWindow
}{\param{const wxString\&
}{ name
}}
443 Find a child of this window, by name.
445 \pythonnote{In place of a single overloaded method name, wxPython
446 implements the following methods:
\par
447 \indented{2cm
}{\begin{twocollist
}
448 \twocolitem{{\bf FindWindowById(id)
}}{Accepts an integer
}
449 \twocolitem{{\bf FindWindowByName(name)
}}{Accepts a string
}
453 \membersection{wxWindow::Fit
}\label{wxwindowfit
}
455 \func{virtual void
}{Fit
}{\void}
457 Sizes the window so that it fits around its subwindows. This function won't do
458 anything if there are no subwindows.
460 \membersection{wxWindow::GetBackgroundColour
}\label{wxwindowgetbackgroundcolour
}
462 \constfunc{virtual wxColour
}{GetBackgroundColour
}{\void}
464 Returns the background colour of the window.
468 \helpref{wxWindow::SetBackgroundColour
}{wxwindowsetbackgroundcolour
},
\rtfsp
469 \helpref{wxWindow::SetForegroundColour
}{wxwindowsetforegroundcolour
},
\rtfsp
470 \helpref{wxWindow::GetForegroundColour
}{wxwindowgetforegroundcolour
},
\rtfsp
471 \helpref{wxWindow::OnEraseBackground
}{wxwindowonerasebackground
}
473 \membersection{wxWindow::GetBestSize
}\label{wxwindowgetbestsize
}
475 \constfunc{virtual wxSize
}{GetBestSize
}{\void}
477 This functions returns the best acceptable minimal size for the window. For
478 example, for a static control, it will be the minimal size such that the
479 control label is not truncated. For windows containing subwindows (typically
480 \helpref{wxPanel
}{wxpanel
}), the size returned by this function will be the
481 same as the size the window would have had after calling
482 \helpref{Fit
}{wxwindowfit
}.
484 \membersection{wxWindow::GetCaret
}\label{wxwindowgetcaret
}
486 \constfunc{wxCaret *
}{GetCaret
}{\void}
488 Returns the
\helpref{caret
}{wxcaret
} associated with the window.
490 \membersection{wxWindow::GetCharHeight
}
492 \constfunc{virtual int
}{GetCharHeight
}{\void}
494 Returns the character height for this window.
496 \membersection{wxWindow::GetCharWidth
}
498 \constfunc{virtual int
}{GetCharWidth
}{\void}
500 Returns the average character width for this window.
502 \membersection{wxWindow::GetChildren
}
504 \func{wxList\&
}{GetChildren
}{\void}
506 Returns a reference to the list of the window's children.
508 \membersection{wxWindow::GetClientSize
}\label{wxwindowgetclientsize
}
510 \constfunc{virtual void
}{GetClientSize
}{\param{int*
}{width
},
\param{int*
}{height
}}
512 \constfunc{virtual wxSize
}{GetClientSize
}{\void}
514 This gets the size of the window `client area' in pixels. The client area is the
515 area which may be drawn on by the programmer, excluding title bar, border etc.
517 \wxheading{Parameters
}
519 \docparam{width
}{Receives the client width in pixels.
}
521 \docparam{height
}{Receives the client height in pixels.
}
523 \pythonnote{In place of a single overloaded method name, wxPython
524 implements the following methods:
\par
525 \indented{2cm
}{\begin{twocollist
}
526 \twocolitem{{\bf wxGetClientSizeTuple()
}}{Returns a
2-tuple of (width, height)
}
527 \twocolitem{{\bf wxGetClientSize()
}}{Returns a wxSize object
}
531 \membersection{wxWindow::GetConstraints
}\label{wxwindowgetconstraints
}
533 \constfunc{wxLayoutConstraints*
}{GetConstraints
}{\void}
535 Returns a pointer to the window's layout constraints, or NULL if there are none.
537 \membersection{wxWindow::GetDropTarget
}\label{wxwindowgetdroptarget
}
539 \constfunc{wxDropTarget*
}{GetDropTarget
}{\void}
541 Returns the associated drop target, which may be NULL.
545 \helpref{wxWindow::SetDropTarget
}{wxwindowsetdroptarget
},
546 \helpref{Drag and drop overview
}{wxdndoverview
}
548 \membersection{wxWindow::GetEventHandler
}\label{wxwindowgeteventhandler
}
550 \constfunc{wxEvtHandler*
}{GetEventHandler
}{\void}
552 Returns the event handler for this window. By default, the window is its
557 \helpref{wxWindow::SetEventHandler
}{wxwindowseteventhandler
},
\rtfsp
558 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
559 \helpref{wxWindow::PopEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
560 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
561 \helpref{wxEvtHandler
}{wxevthandler
}\rtfsp
563 \membersection{wxWindow::GetExtraStyle
}\label{wxwindowgetextrastyle
}
565 \constfunc{long
}{GetExtraStyle
}{\void}
567 Returns the extra style bits for the window.
569 \membersection{wxWindow::GetFont
}\label{wxwindowgetfont
}
571 \constfunc{wxFont\&
}{GetFont
}{\void}
573 Returns a reference to the font for this window.
577 \helpref{wxWindow::SetFont
}{wxwindowsetfont
}
579 \membersection{wxWindow::GetForegroundColour
}\label{wxwindowgetforegroundcolour
}
581 \func{virtual wxColour
}{GetForegroundColour
}{\void}
583 Returns the foreground colour of the window.
587 The interpretation of foreground colour is open to interpretation according
588 to the window class; it may be the text colour or other colour, or it may not
593 \helpref{wxWindow::SetForegroundColour
}{wxwindowsetforegroundcolour
},
\rtfsp
594 \helpref{wxWindow::SetBackgroundColour
}{wxwindowsetbackgroundcolour
},
\rtfsp
595 \helpref{wxWindow::GetBackgroundColour
}{wxwindowgetbackgroundcolour
}
597 \membersection{wxWindow::GetGrandParent
}
599 \constfunc{wxWindow*
}{GetGrandParent
}{\void}
601 Returns the grandparent of a window, or NULL if there isn't one.
603 \membersection{wxWindow::GetHandle
}\label{wxwindowgethandle
}
605 \constfunc{void*
}{GetHandle
}{\void}
607 Returns the platform-specific handle of the physical window. Cast it to an appropriate
608 handle, such as
{\bf HWND
} for Windows,
{\bf Widget
} for Motif or
{\bf GtkWidget
} for GTK.
610 \pythonnote{This method will return an integer in wxPython.
}
612 \membersection{wxWindow::GetHelpText
}\label{wxwindowgethelptext
}
614 \constfunc{virtual wxString
}{GetHelpText
}{\void}
616 Gets the help text to be used as context-sensitive help for this window.
618 Note that the text is actually stored by the current
\helpref{wxHelpProvider
}{wxhelpprovider
} implementation,
619 and not in the window object itself.
623 \helpref{SetHelpText
}{wxwindowsethelptext
},
\helpref{wxHelpProvider
}{wxhelpprovider
}
625 \membersection{wxWindow::GetId
}\label{wxwindowgetid
}
627 \constfunc{int
}{GetId
}{\void}
629 Returns the identifier of the window.
633 Each window has an integer identifier. If the application has not provided one
634 (or the default Id -
1) an unique identifier with a negative value will be generated.
638 \helpref{wxWindow::SetId
}{wxwindowsetid
},
\rtfsp
639 \helpref{Window identifiers
}{windowids
}
641 \membersection{wxWindow::GetLabel
}
643 \constfunc{virtual wxString
}{GetLabel
}{\void}
645 Generic way of getting a label from any window, for
646 identification purposes.
650 The interpretation of this function differs from class to class.
651 For frames and dialogs, the value returned is the title. For buttons or static text controls, it is
652 the button text. This function can be useful for meta-programs (such as testing
653 tools or special-needs access programs) which need to identify windows
656 \membersection{wxWindow::GetName
}\label{wxwindowgetname
}
658 \constfunc{virtual wxString
}{GetName
}{\void}
660 Returns the window's name.
664 This name is not guaranteed to be unique; it is up to the programmer to supply an appropriate
665 name in the window constructor or via
\helpref{wxWindow::SetName
}{wxwindowsetname
}.
669 \helpref{wxWindow::SetName
}{wxwindowsetname
}
671 \membersection{wxWindow::GetParent
}
673 \constfunc{virtual wxWindow*
}{GetParent
}{\void}
675 Returns the parent of the window, or NULL if there is no parent.
677 \membersection{wxWindow::GetPosition
}\label{wxwindowgetposition
}
679 \constfunc{virtual void
}{GetPosition
}{\param{int*
}{x
},
\param{int*
}{y
}}
681 \constfunc{wxPoint
}{GetPosition
}{\void}
683 This gets the position of the window in pixels, relative to the parent window or
684 if no parent, relative to the whole display.
686 \wxheading{Parameters
}
688 \docparam{x
}{Receives the x position of the window.
}
690 \docparam{y
}{Receives the y position of the window.
}
692 \pythonnote{In place of a single overloaded method name, wxPython
693 implements the following methods:
\par
694 \indented{2cm
}{\begin{twocollist
}
695 \twocolitem{{\bf GetPosition()
}}{Returns a wxPoint
}
696 \twocolitem{{\bf GetPositionTuple()
}}{Returns a tuple (x, y)
}
700 \membersection{wxWindow::GetRect
}\label{wxwindowgetrect
}
702 \constfunc{virtual wxRect
}{GetRect
}{\void}
704 Returns the size and position of the window as a
\helpref{wxRect
}{wxrect
} object.
706 \membersection{wxWindow::GetScrollThumb
}\label{wxwindowgetscrollthumb
}
708 \func{virtual int
}{GetScrollThumb
}{\param{int
}{orientation
}}
710 Returns the built-in scrollbar thumb size.
714 \helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
}
716 \membersection{wxWindow::GetScrollPos
}\label{wxwindowgetscrollpos
}
718 \func{virtual int
}{GetScrollPos
}{\param{int
}{orientation
}}
720 Returns the built-in scrollbar position.
724 See
\helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
}
726 \membersection{wxWindow::GetScrollRange
}\label{wxwindowgetscrollrange
}
728 \func{virtual int
}{GetScrollRange
}{\param{int
}{orientation
}}
730 Returns the built-in scrollbar range.
734 \helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
}
736 \membersection{wxWindow::GetSize
}\label{wxwindowgetsize
}
738 \constfunc{virtual void
}{GetSize
}{\param{int*
}{width
},
\param{int*
}{height
}}
740 \constfunc{virtual wxSize
}{GetSize
}{\void}
742 This gets the size of the entire window in pixels.
744 \wxheading{Parameters
}
746 \docparam{width
}{Receives the window width.
}
748 \docparam{height
}{Receives the window height.
}
750 \pythonnote{In place of a single overloaded method name, wxPython
751 implements the following methods:
\par
752 \indented{2cm
}{\begin{twocollist
}
753 \twocolitem{{\bf GetSize()
}}{Returns a wxSize
}
754 \twocolitem{{\bf GetSizeTuple()
}}{Returns a
2-tuple (width, height)
}
758 \membersection{wxWindow::GetTextExtent
}
760 \constfunc{virtual void
}{GetTextExtent
}{\param{const wxString\&
}{string
},
\param{int*
}{x
},
\param{int*
}{y
},
761 \param{int*
}{descent = NULL
},
\param{int*
}{externalLeading = NULL
},
762 \param{const wxFont*
}{font = NULL
},
\param{bool
}{ use16 = FALSE
}}
764 Gets the dimensions of the string as it would be drawn on the
765 window with the currently selected font.
767 \wxheading{Parameters
}
769 \docparam{string
}{String whose extent is to be measured.
}
771 \docparam{x
}{Return value for width.
}
773 \docparam{y
}{Return value for height.
}
775 \docparam{descent
}{Return value for descent (optional).
}
777 \docparam{externalLeading
}{Return value for external leading (optional).
}
779 \docparam{font
}{Font to use instead of the current window font (optional).
}
781 \docparam{use16
}{If TRUE,
{\it string
} contains
16-bit characters. The default is FALSE.
}
784 \pythonnote{In place of a single overloaded method name, wxPython
785 implements the following methods:
\par
786 \indented{2cm
}{\begin{twocollist
}
787 \twocolitem{{\bf GetTextExtent(string)
}}{Returns a
2-tuple, (width, height)
}
788 \twocolitem{{\bf GetFullTextExtent(string, font=NULL)
}}{Returns a
789 4-tuple, (width, height, descent, externalLeading)
}
794 \membersection{wxWindow::GetTitle
}\label{wxwindowgettitle
}
796 \func{virtual wxString
}{GetTitle
}{\void}
798 Gets the window's title. Applicable only to frames and dialogs.
802 \helpref{wxWindow::SetTitle
}{wxwindowsettitle
}
804 \membersection{wxWindow::GetUpdateRegion
}\label{wxwindowgetupdateregion
}
806 \constfunc{virtual wxRegion
}{GetUpdateRegion
}{\void}
808 Returns the region specifying which parts of the window have been damaged. Should
809 only be called within an
\helpref{OnPaint
}{wxwindowonpaint
} event handler.
813 \helpref{wxRegion
}{wxregion
},
\helpref{wxRegionIterator
}{wxregioniterator
},
\helpref{wxWindow::OnPaint
}{wxwindowonpaint
}
815 \membersection{wxWindow::GetValidator
}\label{wxwindowgetvalidator
}
817 \constfunc{wxValidator*
}{GetValidator
}{\void}
819 Returns a pointer to the current validator for the window, or NULL if there is none.
821 \membersection{wxWindow::GetWindowStyleFlag
}\label{wxwindowgetwindowstyleflag
}
823 \constfunc{long
}{GetWindowStyleFlag
}{\void}
825 Gets the window style that was passed to the constructor or
{\bf Create
}
826 method.
{\bf GetWindowStyle()
} is another name for the same function.
828 \membersection{wxWindow::InitDialog
}\label{wxwindowinitdialog
}
830 \func{void
}{InitDialog
}{\void}
832 Sends an
\helpref{wxWindow::OnInitDialog
}{wxwindowoninitdialog
} event, which
833 in turn transfers data to the dialog via validators.
837 \helpref{wxWindow::OnInitDialog
}{wxwindowoninitdialog
}
839 \membersection{wxWindow::IsEnabled
}\label{wxwindowisenabled
}
841 \constfunc{virtual bool
}{IsEnabled
}{\void}
843 Returns TRUE if the window is enabled for input, FALSE otherwise.
847 \helpref{wxWindow::Enable
}{wxwindowenable
}
849 \membersection{wxWindow:IsExposed
}\label{wxwindowisexposed
}
851 \constfunc{bool
}{IsExposed
}{\param{int
}{x
},
\param{int
}{y
}}
853 \constfunc{bool
}{IsExposed
}{\param{wxPoint
}{\&pt
}}
855 \constfunc{bool
}{IsExposed
}{\param{int
}{x
},
\param{int
}{y
},
\param{int
}{w
},
\param{int
}{h
}}
857 \constfunc{bool
}{IsExposed
}{\param{wxRect
}{\&rect
}}
859 Returns TRUE if the given point or rectange area has been exposed since the
860 last repaint. Call this in an paint event handler to optimize redrawing by
861 only redrawing those areas, which have been exposed.
863 \pythonnote{In place of a single overloaded method name, wxPython
864 implements the following methods:
\par
865 \indented{2cm
}{\begin{twocollist
}
866 \twocolitem{{\bf IsExposed(x,y, w=
0,h=
0}}{}
867 \twocolitem{{\bf IsExposedPoint(pt)
}}{}
868 \twocolitem{{\bf IsExposedRect(rect)
}}{}
871 \membersection{wxWindow::IsRetained
}\label{wxwindowisretained
}
873 \constfunc{virtual bool
}{IsRetained
}{\void}
875 Returns TRUE if the window is retained, FALSE otherwise.
879 Retained windows are only available on X platforms.
881 \membersection{wxWindow::IsShown
}\label{wxwindowisshown
}
883 \constfunc{virtual bool
}{IsShown
}{\void}
885 Returns TRUE if the window is shown, FALSE if it has been hidden.
887 \membersection{wxWindow::IsTopLevel
}\label{wxwindowistoplevel
}
889 \constfunc{bool
}{IsTopLevel
}{\void}
891 Returns TRUE if the given window is a top-level one. Currently all frames and
892 dialogs are considered to be top-level windows (even if they have a parent
895 \membersection{wxWindow::Layout
}\label{wxwindowlayout
}
897 \func{void
}{Layout
}{\void}
899 Invokes the constraint-based layout algorithm or the sizer-based algorithm
902 See
\helpref{wxWindow::SetAutoLayout
}{wxwindowsetautolayout
} on when
903 this function gets called automatically using auto layout.
905 \membersection{wxWindow::LoadFromResource
}\label{wxwindowloadfromresource
}
907 \func{virtual bool
}{LoadFromResource
}{\param{wxWindow*
}{parent
},
\rtfsp
908 \param{const wxString\&
}{resourceName
},
\param{const wxResourceTable*
}{resourceTable = NULL
}}
910 Loads a panel or dialog from a resource file.
912 \wxheading{Parameters
}
914 \docparam{parent
}{Parent window.
}
916 \docparam{resourceName
}{The name of the resource to load.
}
918 \docparam{resourceTable
}{The resource table to load it from. If this is NULL, the
919 default resource table will be used.
}
921 \wxheading{Return value
}
923 TRUE if the operation succeeded, otherwise FALSE.
925 \membersection{wxWindow::Lower
}\label{wxwindowlower
}
927 \func{void
}{Lower
}{\void}
929 Lowers the window to the bottom of the window hierarchy if it is a managed window (dialog
932 \membersection{wxWindow::MakeModal
}\label{wxwindowmakemodal
}
934 \func{virtual void
}{MakeModal
}{\param{bool
}{flag
}}
936 Disables all other windows in the application so that
937 the user can only interact with this window. (This function
938 is not implemented anywhere).
940 \wxheading{Parameters
}
942 \docparam{flag
}{If TRUE, this call disables all other windows in the application so that
943 the user can only interact with this window. If FALSE, the effect is reversed.
}
945 \membersection{wxWindow::Move
}\label{wxwindowmove
}
947 \func{void
}{Move
}{\param{int
}{ x
},
\param{int
}{ y
}}
949 \func{void
}{Move
}{\param{const wxPoint\&
}{ pt
}}
951 Moves the window to the given position.
953 \wxheading{Parameters
}
955 \docparam{x
}{Required x position.
}
957 \docparam{y
}{Required y position.
}
959 \docparam{pt
}{\helpref{wxPoint
}{wxpoint
} object representing the position.
}
963 Implementations of SetSize can also implicitly implement the
964 wxWindow::Move function, which is defined in the base wxWindow class
968 SetSize(x, y, -
1, -
1, wxSIZE_USE_EXISTING);
973 \helpref{wxWindow::SetSize
}{wxwindowsetsize
}
975 \pythonnote{In place of a single overloaded method name, wxPython
976 implements the following methods:
\par
977 \indented{2cm
}{\begin{twocollist
}
978 \twocolitem{{\bf Move(point)
}}{Accepts a wxPoint
}
979 \twocolitem{{\bf MoveXY(x, y)
}}{Accepts a pair of integers
}
983 \membersection{wxWindow::OnActivate
}\label{wxwindowonactivate
}
985 \func{void
}{OnActivate
}{\param{wxActivateEvent\&
}{ event
}}
987 Called when a window is activated or deactivated.
989 \wxheading{Parameters
}
991 \docparam{event
}{Object containing activation information.
}
995 If the window is being activated,
\helpref{wxActivateEvent::GetActive
}{wxactivateeventgetactive
} returns TRUE,
996 otherwise it returns FALSE (it is being deactivated).
1000 \helpref{wxActivateEvent
}{wxactivateevent
},
\rtfsp
1001 \helpref{Event handling overview
}{eventhandlingoverview
}
1003 \membersection{wxWindow::OnChar
}\label{wxwindowonchar
}
1005 \func{void
}{OnChar
}{\param{wxKeyEvent\&
}{ event
}}
1007 Called when the user has pressed a key that is not a modifier (SHIFT, CONTROL or ALT).
1009 \wxheading{Parameters
}
1011 \docparam{event
}{Object containing keypress information. See
\helpref{wxKeyEvent
}{wxkeyevent
} for
1012 details about this class.
}
1016 This member function is called in response to a keypress. To intercept this event,
1017 use the EVT
\_CHAR macro in an event table definition. Your
{\bf OnChar
} handler may call this
1018 default function to achieve default keypress functionality.
1020 Note that the ASCII values do not have explicit key codes: they are passed as ASCII
1023 Note that not all keypresses can be intercepted this way. If you wish to intercept modifier
1024 keypresses, then you will need to use
\helpref{wxWindow::OnKeyDown
}{wxwindowonkeydown
} or
1025 \helpref{wxWindow::OnKeyUp
}{wxwindowonkeyup
}.
1027 Most, but not all, windows allow keypresses to be intercepted.
1029 \wxheading{See also
}
1031 \helpref{wxWindow::OnKeyDown
}{wxwindowonkeydown
},
\helpref{wxWindow::OnKeyUp
}{wxwindowonkeyup
},
\rtfsp
1032 \helpref{wxKeyEvent
}{wxkeyevent
},
\helpref{wxWindow::OnCharHook
}{wxwindowoncharhook
},
\rtfsp
1033 \helpref{Event handling overview
}{eventhandlingoverview
}
1035 \membersection{wxWindow::OnCharHook
}\label{wxwindowoncharhook
}
1037 \func{void
}{OnCharHook
}{\param{wxKeyEvent\&
}{ event
}}
1039 This member is called to allow the window to intercept keyboard events
1040 before they are processed by child windows.
1042 \wxheading{Parameters
}
1044 \docparam{event
}{Object containing keypress information. See
\helpref{wxKeyEvent
}{wxkeyevent
} for
1045 details about this class.
}
1049 This member function is called in response to a keypress, if the window is active. To intercept this event,
1050 use the EVT
\_CHAR\_HOOK macro in an event table definition. If you do not process a particular
1051 keypress, call
\helpref{wxEvent::Skip
}{wxeventskip
} to allow default processing.
1053 An example of using this function is in the implementation of escape-character processing for wxDialog,
1054 where pressing ESC dismisses the dialog by
{\bf OnCharHook
} 'forging' a cancel button press event.
1056 Note that the ASCII values do not have explicit key codes: they are passed as ASCII
1059 This function is only relevant to top-level windows (frames and dialogs), and under
1060 Windows only. Under GTK the normal EVT
\_CHAR\_ event has the functionality, i.e.
1061 you can intercepts it and if you don't call
\helpref{wxEvent::Skip
}{wxeventskip
}
1062 the window won't get the event.
1064 \wxheading{See also
}
1066 \helpref{wxKeyEvent
}{wxkeyevent
},
\helpref{wxWindow::OnCharHook
}{wxwindowoncharhook
},
\rtfsp
1067 \helpref{wxApp::OnCharHook
}{wxapponcharhook
},
\rtfsp
1068 \helpref{Event handling overview
}{eventhandlingoverview
}
1070 \membersection{wxWindow::OnCommand
}\label{wxwindowoncommand
}
1072 \func{virtual void
}{OnCommand
}{\param{wxEvtHandler\&
}{object
},
\param{wxCommandEvent\&
}{event
}}
1074 This virtual member function is called if the control does not handle the command event.
1076 \wxheading{Parameters
}
1078 \docparam{object
}{Object receiving the command event.
}
1080 \docparam{event
}{Command event
}
1084 This virtual function is provided mainly for backward compatibility. You can also intercept commands
1085 from child controls by using an event table, with identifiers or identifier ranges to identify
1086 the control(s) in question.
1088 \wxheading{See also
}
1090 \helpref{wxCommandEvent
}{wxcommandevent
},
\rtfsp
1091 \helpref{Event handling overview
}{eventhandlingoverview
}
1093 \membersection{wxWindow::OnClose
}\label{wxwindowonclose
}
1095 \func{virtual bool
}{OnClose
}{\void}
1097 Called when the user has tried to close a a frame
1098 or dialog box using the window manager (X) or system menu (Windows).
1100 {\bf Note:
} This is an obsolete function.
1101 It is superceded by the
\helpref{wxWindow::OnCloseWindow
}{wxwindowonclosewindow
} event
1104 \wxheading{Return value
}
1106 If TRUE is returned by OnClose, the window will be deleted by the system, otherwise the
1107 attempt will be ignored. Do not delete the window from within this handler, although
1108 you may delete other windows.
1110 \wxheading{See also
}
1112 \helpref{Window deletion overview
}{windowdeletionoverview
},
\rtfsp
1113 \helpref{wxWindow::Close
}{wxwindowclose
},
\rtfsp
1114 \helpref{wxWindow::OnCloseWindow
}{wxwindowonclosewindow
},
\rtfsp
1115 \helpref{wxCloseEvent
}{wxcloseevent
}
1117 \membersection{wxWindow::OnCloseWindow
}\label{wxwindowonclosewindow
}
1119 \func{void
}{OnCloseWindow
}{\param{wxCloseEvent\&
}{event
}}
1121 This is an event handler function called when the user has tried to close a a frame
1122 or dialog box using the window manager (X) or system menu (Windows). It is
1123 called via the
\helpref{wxWindow::Close
}{wxwindowclose
} function, so
1124 that the application can also invoke the handler programmatically.
1126 Use the EVT
\_CLOSE event table macro to handle close events.
1128 You should check whether the application is forcing the deletion of the window
1129 using
\helpref{wxCloseEvent::GetForce
}{wxcloseeventgetforce
}. If this is TRUE,
1130 destroy the window using
\helpref{wxWindow::Destroy
}{wxwindowdestroy
}.
1131 If not, it is up to you whether you respond by destroying the window.
1133 (Note: GetForce is now superceded by CanVeto. So to test whether forced destruction of
1134 the window is required, test for the negative of CanVeto. If CanVeto returns FALSE,
1135 it is not possible to skip window deletion.)
1137 If you don't destroy the window, you should call
\helpref{wxCloseEvent::Veto
}{wxcloseeventveto
} to
1138 let the calling code know that you did not destroy the window. This allows the
\helpref{wxWindow::Close
}{wxwindowclose
} function
1139 to return TRUE or FALSE depending on whether the close instruction was honoured or not.
1143 The
\helpref{wxWindow::OnClose
}{wxwindowonclose
} virtual function remains
1144 for backward compatibility with earlier versions of wxWindows. The
1145 default
{\bf OnCloseWindow
} handler for wxFrame and wxDialog will call
{\bf OnClose
},
1146 destroying the window if it returns TRUE or if the close is being forced.
1148 \wxheading{See also
}
1150 \helpref{Window deletion overview
}{windowdeletionoverview
},
\rtfsp
1151 \helpref{wxWindow::Close
}{wxwindowclose
},
\rtfsp
1152 \helpref{wxWindow::OnClose
}{wxwindowonclose
},
\rtfsp
1153 \helpref{wxWindow::Destroy
}{wxwindowdestroy
},
\rtfsp
1154 \helpref{wxCloseEvent
}{wxcloseevent
},
\rtfsp
1155 \helpref{wxApp::OnQueryEndSession
}{wxapponqueryendsession
},
\rtfsp
1156 \helpref{wxApp::OnEndSession
}{wxapponendsession
}
1158 \membersection{wxWindow::OnDropFiles
}\label{wxwindowondropfiles
}
1160 \func{void
}{OnDropFiles
}{\param{wxDropFilesEvent\&
}{ event
}}
1162 Called when files have been dragged from the file manager to the window.
1164 \wxheading{Parameters
}
1166 \docparam{event
}{Drop files event. For more information, see
\helpref{wxDropFilesEvent
}{wxdropfilesevent
}.
}
1170 The window must have previously been enabled for dropping by calling
1171 \rtfsp\helpref{wxWindow::DragAcceptFiles
}{wxwindowdragacceptfiles
}.
1173 This event is only generated under Windows.
1175 To intercept this event, use the EVT
\_DROP\_FILES macro in an event table definition.
1177 \wxheading{See also
}
1179 \helpref{wxDropFilesEvent
}{wxdropfilesevent
},
\helpref{wxWindow::DragAcceptFiles
}{wxwindowdragacceptfiles
},
\rtfsp
1180 \helpref{Event handling overview
}{eventhandlingoverview
}
1182 \membersection{wxWindow::OnEraseBackground
}\label{wxwindowonerasebackground
}
1184 \func{void
}{OnEraseBackground
}{\param{wxEraseEvent\&
}{ event
}}
1186 Called when the background of the window needs to be erased.
1188 \wxheading{Parameters
}
1190 \docparam{event
}{Erase background event. For more information, see
\helpref{wxEraseEvent
}{wxeraseevent
}.
}
1194 Under non-Windows platforms, this event is simulated (simply generated just before the
1195 paint event) and may cause flicker. It is therefore recommended that
1196 you set the text background colour explicitly in order to prevent flicker.
1197 The default background colour under GTK is grey.
1199 To intercept this event, use the EVT
\_ERASE\_BACKGROUND macro in an event table definition.
1201 \wxheading{See also
}
1203 \helpref{wxEraseEvent
}{wxeraseevent
},
\helpref{Event handling overview
}{eventhandlingoverview
}
1205 \membersection{wxWindow::OnKeyDown
}\label{wxwindowonkeydown
}
1207 \func{void
}{OnKeyDown
}{\param{wxKeyEvent\&
}{ event
}}
1209 Called when the user has pressed a key, before it is translated into an ASCII value using other
1210 modifier keys that might be pressed at the same time.
1212 \wxheading{Parameters
}
1214 \docparam{event
}{Object containing keypress information. See
\helpref{wxKeyEvent
}{wxkeyevent
} for
1215 details about this class.
}
1219 This member function is called in response to a key down event. To intercept this event,
1220 use the EVT
\_KEY\_DOWN macro in an event table definition. Your
{\bf OnKeyDown
} handler may call this
1221 default function to achieve default keypress functionality.
1223 Note that not all keypresses can be intercepted this way. If you wish to intercept special
1224 keys, such as shift, control, and function keys, then you will need to use
\helpref{wxWindow::OnKeyDown
}{wxwindowonkeydown
} or
1225 \helpref{wxWindow::OnKeyUp
}{wxwindowonkeyup
}.
1227 Most, but not all, windows allow keypresses to be intercepted.
1229 \wxheading{See also
}
1231 \helpref{wxWindow::OnChar
}{wxwindowonchar
},
\helpref{wxWindow::OnKeyUp
}{wxwindowonkeyup
},
\rtfsp
1232 \helpref{wxKeyEvent
}{wxkeyevent
},
\helpref{wxWindow::OnCharHook
}{wxwindowoncharhook
},
\rtfsp
1233 \helpref{Event handling overview
}{eventhandlingoverview
}
1235 \membersection{wxWindow::OnKeyUp
}\label{wxwindowonkeyup
}
1237 \func{void
}{OnKeyUp
}{\param{wxKeyEvent\&
}{ event
}}
1239 Called when the user has released a key.
1241 \wxheading{Parameters
}
1243 \docparam{event
}{Object containing keypress information. See
\helpref{wxKeyEvent
}{wxkeyevent
} for
1244 details about this class.
}
1248 This member function is called in response to a key up event. To intercept this event,
1249 use the EVT
\_KEY\_UP macro in an event table definition. Your
{\bf OnKeyUp
} handler may call this
1250 default function to achieve default keypress functionality.
1252 Note that not all keypresses can be intercepted this way. If you wish to intercept special
1253 keys, such as shift, control, and function keys, then you will need to use
\helpref{wxWindow::OnKeyDown
}{wxwindowonkeydown
} or
1254 \helpref{wxWindow::OnKeyUp
}{wxwindowonkeyup
}.
1256 Most, but not all, windows allow key up events to be intercepted.
1258 \wxheading{See also
}
1260 \helpref{wxWindow::OnChar
}{wxwindowonchar
},
\helpref{wxWindow::OnKeyDown
}{wxwindowonkeydown
},
\rtfsp
1261 \helpref{wxKeyEvent
}{wxkeyevent
},
\helpref{wxWindow::OnCharHook
}{wxwindowoncharhook
},
\rtfsp
1262 \helpref{Event handling overview
}{eventhandlingoverview
}
1264 \membersection{wxWindow::OnKillFocus
}\label{wxwindowonkillfocus
}
1266 \func{void
}{OnKillFocus
}{\param{wxFocusEvent\&
}{event
}}
1268 Called when a window's focus is being killed.
1270 \wxheading{Parameters
}
1272 \docparam{event
}{The focus event. For more information, see
\helpref{wxFocusEvent
}{wxfocusevent
}.
}
1276 To intercept this event, use the macro EVT
\_KILL\_FOCUS in an event table definition.
1278 Most, but not all, windows respond to this event.
1280 \wxheading{See also
}
1282 \helpref{wxFocusEvent
}{wxfocusevent
},
\helpref{wxWindow::OnSetFocus
}{wxwindowonsetfocus
},
\rtfsp
1283 \helpref{Event handling overview
}{eventhandlingoverview
}
1285 \membersection{wxWindow::OnIdle
}\label{wxwindowonidle
}
1287 \func{void
}{OnIdle
}{\param{wxIdleEvent\&
}{event
}}
1289 Provide this member function for any processing which needs to be done
1290 when the application is idle.
1292 \wxheading{See also
}
1294 \helpref{wxApp::OnIdle
}{wxapponidle
},
\helpref{wxIdleEvent
}{wxidleevent
}
1296 \membersection{wxWindow::OnInitDialog
}\label{wxwindowoninitdialog
}
1298 \func{void
}{OnInitDialog
}{\param{wxInitDialogEvent\&
}{ event
}}
1300 Default handler for the wxEVT
\_INIT\_DIALOG event. Calls
\helpref{wxWindow::TransferDataToWindow
}{wxwindowtransferdatatowindow
}.
1302 \wxheading{Parameters
}
1304 \docparam{event
}{Dialog initialisation event.
}
1308 Gives the window the default behaviour of transferring data to child controls via
1309 the validator that each control has.
1311 \wxheading{See also
}
1313 \helpref{wxValidator
}{wxvalidator
},
\helpref{wxWindow::TransferDataToWindow
}{wxwindowtransferdatatowindow
}
1315 \membersection{wxWindow::OnMenuCommand
}\label{wxwindowonmenucommand
}
1317 \func{void
}{OnMenuCommand
}{\param{wxCommandEvent\&
}{event
}}
1319 Called when a menu command is received from a menu bar.
1321 \wxheading{Parameters
}
1323 \docparam{event
}{The menu command event. For more information, see
\helpref{wxCommandEvent
}{wxcommandevent
}.
}
1327 A function with this name doesn't actually exist; you can choose any member function to receive
1328 menu command events, using the EVT
\_COMMAND macro for individual commands or EVT
\_COMMAND\_RANGE for
1329 a range of commands.
1331 \wxheading{See also
}
1333 \helpref{wxCommandEvent
}{wxcommandevent
},
\rtfsp
1334 \helpref{wxWindow::OnMenuHighlight
}{wxwindowonmenuhighlight
},
\rtfsp
1335 \helpref{Event handling overview
}{eventhandlingoverview
}
1337 \membersection{wxWindow::OnMenuHighlight
}\label{wxwindowonmenuhighlight
}
1339 \func{void
}{OnMenuHighlight
}{\param{wxMenuEvent\&
}{event
}}
1341 Called when a menu select is received from a menu bar: that is, the
1342 mouse cursor is over a menu item, but the left mouse button has not been
1345 \wxheading{Parameters
}
1347 \docparam{event
}{The menu highlight event. For more information, see
\helpref{wxMenuEvent
}{wxmenuevent
}.
}
1351 You can choose any member function to receive
1352 menu select events, using the EVT
\_MENU\_HIGHLIGHT macro for individual menu items or EVT
\_MENU\_HIGHLIGHT\_ALL macro
1355 The default implementation for
\helpref{wxFrame::OnMenuHighlight
}{wxframeonmenuhighlight
} displays help
1356 text in the first field of the status bar.
1358 This function was known as
{\bf OnMenuSelect
} in earlier versions of wxWindows, but this was confusing
1359 since a selection is normally a left-click action.
1361 \wxheading{See also
}
1363 \helpref{wxMenuEvent
}{wxmenuevent
},
\rtfsp
1364 \helpref{wxWindow::OnMenuCommand
}{wxwindowonmenucommand
},
\rtfsp
1365 \helpref{Event handling overview
}{eventhandlingoverview
}
1368 \membersection{wxWindow::OnMouseEvent
}\label{wxwindowonmouseevent
}
1370 \func{void
}{OnMouseEvent
}{\param{wxMouseEvent\&
}{ event
}}
1372 Called when the user has initiated an event with the
1375 \wxheading{Parameters
}
1377 \docparam{event
}{The mouse event. See
\helpref{wxMouseEvent
}{wxmouseevent
} for
1382 Most, but not all, windows respond to this event.
1384 To intercept this event, use the EVT
\_MOUSE\_EVENTS macro in an event table definition, or individual
1385 mouse event macros such as EVT
\_LEFT\_DOWN.
1387 \wxheading{See also
}
1389 \helpref{wxMouseEvent
}{wxmouseevent
},
\rtfsp
1390 \helpref{Event handling overview
}{eventhandlingoverview
}
1392 \membersection{wxWindow::OnMove
}\label{wxwindowonmove
}
1394 \func{void
}{OnMove
}{\param{wxMoveEvent\&
}{event
}}
1396 Called when a window is moved.
1398 \wxheading{Parameters
}
1400 \docparam{event
}{The move event. For more information, see
\helpref{wxMoveEvent
}{wxmoveevent
}.
}
1404 Use the EVT
\_MOVE macro to intercept move events.
1408 Not currently implemented.
1410 \wxheading{See also
}
1412 \helpref{wxMoveEvent
}{wxmoveevent
},
\rtfsp
1413 \helpref{wxFrame::OnSize
}{wxframeonsize
},
\rtfsp
1414 \helpref{Event handling overview
}{eventhandlingoverview
}
1416 \membersection{wxWindow::OnPaint
}\label{wxwindowonpaint
}
1418 \func{void
}{OnPaint
}{\param{wxPaintEvent\&
}{event
}}
1420 Sent to the event handler when the window must be refreshed.
1422 \wxheading{Parameters
}
1424 \docparam{event
}{Paint event. For more information, see
\helpref{wxPaintEvent
}{wxpaintevent
}.
}
1428 Use the EVT
\_PAINT macro in an event table definition to intercept paint events.
1430 Note that In a paint event handler, the application must
{\it always
} create a
\helpref{wxPaintDC
}{wxpaintdc
} object,
1431 even if you do not use it. Otherwise, under MS Windows, refreshing for this and other windows will go wrong.
1437 void MyWindow::OnPaint(wxPaintEvent\& event)
1446 You can optimize painting by retrieving the rectangles
1447 that have been damaged and only repainting these. The rectangles are in
1448 terms of the client area, and are unscrolled, so you will need to do
1449 some calculations using the current view position to obtain logical,
1452 Here is an example of using the
\helpref{wxRegionIterator
}{wxregioniterator
} class:
1456 // Called when window needs to be repainted.
1457 void MyWindow::OnPaint(wxPaintEvent\& event)
1461 // Find Out where the window is scrolled to
1462 int vbX,vbY; // Top left corner of client
1463 GetViewStart(&vbX,&vbY);
1465 int vX,vY,vW,vH; // Dimensions of client area in pixels
1466 wxRegionIterator upd(GetUpdateRegion()); // get the update rect list
1475 // Alternatively we can do this:
1477 // upd.GetRect(&rect);
1479 // Repaint this rectangle
1488 \wxheading{See also
}
1490 \helpref{wxPaintEvent
}{wxpaintevent
},
\rtfsp
1491 \helpref{wxPaintDC
}{wxpaintdc
},
\rtfsp
1492 \helpref{Event handling overview
}{eventhandlingoverview
}
1494 \membersection{wxWindow::OnScroll
}\label{wxwindowonscroll
}
1496 \func{void
}{OnScroll
}{\param{wxScrollWinEvent\&
}{event
}}
1498 Called when a scroll window event is received from one of the window's built-in scrollbars.
1500 \wxheading{Parameters
}
1502 \docparam{event
}{Command event. Retrieve the new scroll position by
1503 calling
\helpref{wxScrollEvent::GetPosition
}{wxscrolleventgetposition
}, and the
1504 scrollbar orientation by calling
\helpref{wxScrollEvent::GetOrientation
}{wxscrolleventgetorientation
}.
}
1508 Note that it is not possible to distinguish between horizontal and vertical scrollbars
1509 until the function is executing (you can't have one function for vertical, another
1510 for horizontal events).
1512 \wxheading{See also
}
1514 \helpref{wxScrollWinEvent
}{wxscrollwinevent
},
\rtfsp
1515 \helpref{Event handling overview
}{eventhandlingoverview
}
1517 \membersection{wxWindow::OnSetFocus
}\label{wxwindowonsetfocus
}
1519 \func{void
}{OnSetFocus
}{\param{wxFocusEvent\&
}{event
}}
1521 Called when a window's focus is being set.
1523 \wxheading{Parameters
}
1525 \docparam{event
}{The focus event. For more information, see
\helpref{wxFocusEvent
}{wxfocusevent
}.
}
1529 To intercept this event, use the macro EVT
\_SET\_FOCUS in an event table definition.
1531 Most, but not all, windows respond to this event.
1533 \wxheading{See also
}
1535 \helpref{wxFocusEvent
}{wxfocusevent
},
\helpref{wxWindow::OnKillFocus
}{wxwindowonkillfocus
},
\rtfsp
1536 \helpref{Event handling overview
}{eventhandlingoverview
}
1538 \membersection{wxWindow::OnSize
}\label{wxwindowonsize
}
1540 \func{void
}{OnSize
}{\param{wxSizeEvent\&
}{event
}}
1542 Called when the window has been resized.
1544 \wxheading{Parameters
}
1546 \docparam{event
}{Size event. For more information, see
\helpref{wxSizeEvent
}{wxsizeevent
}.
}
1550 You may wish to use this for frames to resize their child windows as appropriate.
1552 Note that the size passed is of
1553 the whole window: call
\helpref{wxWindow::GetClientSize
}{wxwindowgetclientsize
} for the area which may be
1554 used by the application.
1556 When a window is resized, usually only a small part of the window is damaged and you
1557 may only need to repaint that area. However, if your drawing depends on the size of the window,
1558 you may need to clear the DC explicitly and repaint the whole window. In which case, you
1559 may need to call
\helpref{wxWindow::Refresh
}{wxwindowrefresh
} to invalidate the entire window.
1561 \wxheading{See also
}
1563 \helpref{wxSizeEvent
}{wxsizeevent
},
\rtfsp
1564 \helpref{Event handling overview
}{eventhandlingoverview
}
1566 \membersection{wxWindow::OnSysColourChanged
}\label{wxwindowonsyscolourchanged
}
1568 \func{void
}{OnSysColourChanged
}{\param{wxOnSysColourChangedEvent\&
}{event
}}
1570 Called when the user has changed the system colours. Windows only.
1572 \wxheading{Parameters
}
1574 \docparam{event
}{System colour change event. For more information, see
\helpref{wxSysColourChangedEvent
}{wxsyscolourchangedevent
}.
}
1576 \wxheading{See also
}
1578 \helpref{wxSysColourChangedEvent
}{wxsyscolourchangedevent
},
\rtfsp
1579 \helpref{Event handling overview
}{eventhandlingoverview
}
1581 \membersection{wxWindow::PopEventHandler
}\label{wxwindowpopeventhandler
}
1583 \constfunc{wxEvtHandler*
}{PopEventHandler
}{\param{bool
}{deleteHandler = FALSE
}}
1585 Removes and returns the top-most event handler on the event handler stack.
1587 \wxheading{Parameters
}
1589 \docparam{deleteHandler
}{If this is TRUE, the handler will be deleted after it is removed. The
1590 default value is FALSE.
}
1592 \wxheading{See also
}
1594 \helpref{wxWindow::SetEventHandler
}{wxwindowseteventhandler
},
\rtfsp
1595 \helpref{wxWindow::GetEventHandler
}{wxwindowgeteventhandler
},
\rtfsp
1596 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1597 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
1598 \helpref{wxEvtHandler
}{wxevthandler
}\rtfsp
1600 \membersection{wxWindow::PopupMenu
}\label{wxwindowpopupmenu
}
1602 \func{bool
}{PopupMenu
}{\param{wxMenu*
}{menu
},
\param{const wxPoint\&
}{pos
}}
1604 \func{bool
}{PopupMenu
}{\param{wxMenu*
}{menu
},
\param{int
}{x
},
\param{int
}{y
}}
1606 Pops up the given menu at the specified coordinates, relative to this
1607 window, and returns control when the user has dismissed the menu. If a
1608 menu item is selected, the corresponding menu event is generated and will be
1609 processed as usually.
1611 \wxheading{Parameters
}
1613 \docparam{menu
}{Menu to pop up.
}
1615 \docparam{pos
}{The position where the menu will appear.
}
1617 \docparam{x
}{Required x position for the menu to appear.
}
1619 \docparam{y
}{Required y position for the menu to appear.
}
1621 \wxheading{See also
}
1623 \helpref{wxMenu
}{wxmenu
}
1627 Just before the menu is popped up,
\helpref{wxMenu::UpdateUI
}{wxmenuupdateui
} is called
1628 to ensure that the menu items are in the correct state. The menu does not get deleted
1631 \pythonnote{In place of a single overloaded method name, wxPython
1632 implements the following methods:
\par
1633 \indented{2cm
}{\begin{twocollist
}
1634 \twocolitem{{\bf PopupMenu(menu, point)
}}{Specifies position with a wxPoint
}
1635 \twocolitem{{\bf PopupMenuXY(menu, x, y)
}}{Specifies position with two integers (x, y)
}
1639 \membersection{wxWindow::PushEventHandler
}\label{wxwindowpusheventhandler
}
1641 \func{void
}{PushEventHandler
}{\param{wxEvtHandler*
}{handler
}}
1643 Pushes this event handler onto the event stack for the window.
1645 \wxheading{Parameters
}
1647 \docparam{handler
}{Specifies the handler to be pushed.
}
1651 An event handler is an object that is capable of processing the events
1652 sent to a window. By default, the window is its own event handler, but
1653 an application may wish to substitute another, for example to allow
1654 central implementation of event-handling for a variety of different
1657 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
} allows
1658 an application to set up a chain of event handlers, where an event not handled by one event handler is
1659 handed to the next one in the chain. Use
\helpref{wxWindow::PopEventHandler
}{wxwindowpopeventhandler
} to
1660 remove the event handler.
1662 \wxheading{See also
}
1664 \helpref{wxWindow::SetEventHandler
}{wxwindowseteventhandler
},
\rtfsp
1665 \helpref{wxWindow::GetEventHandler
}{wxwindowgeteventhandler
},
\rtfsp
1666 \helpref{wxWindow::PopEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1667 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
1668 \helpref{wxEvtHandler
}{wxevthandler
}
1670 \membersection{wxWindow::Raise
}\label{wxwindowraise
}
1672 \func{void
}{Raise
}{\void}
1674 Raises the window to the top of the window hierarchy if it is a managed window (dialog
1677 \membersection{wxWindow::Refresh
}\label{wxwindowrefresh
}
1679 \func{virtual void
}{Refresh
}{\param{bool
}{ eraseBackground = TRUE
},
\param{const wxRect*
}{rect
1682 Causes a message or event to be generated to repaint the
1685 \wxheading{Parameters
}
1687 \docparam{eraseBackground
}{If TRUE, the background will be
1690 \docparam{rect
}{If non-NULL, only the given rectangle will
1691 be treated as damaged.
}
1693 \membersection{wxWindow::ReleaseMouse
}\label{wxwindowreleasemouse
}
1695 \func{virtual void
}{ReleaseMouse
}{\void}
1697 Releases mouse input captured with
\helpref{wxWindow::CaptureMouse
}{wxwindowcapturemouse
}.
1699 \wxheading{See also
}
1701 \helpref{wxWindow::CaptureMouse
}{wxwindowcapturemouse
}
1703 \membersection{wxWindow::RemoveChild
}\label{wxwindowremovechild
}
1705 \func{virtual void
}{RemoveChild
}{\param{wxWindow*
}{child
}}
1707 Removes a child window. This is called automatically by window deletion
1708 functions so should not be required by the application programmer.
1710 \wxheading{Parameters
}
1712 \docparam{child
}{Child window to remove.
}
1714 \membersection{wxWindow::Reparent
}\label{wxwindowreparent
}
1716 \func{virtual bool
}{Reparent
}{\param{wxWindow*
}{newParent
}}
1718 Reparents the window, i.e the window will be removed from its
1719 current parent window (e.g. a non-standard toolbar in a wxFrame)
1720 and then re-inserted into another. Available on Windows and GTK.
1722 \wxheading{Parameters
}
1724 \docparam{newParent
}{New parent.
}
1726 \membersection{wxWindow::ScreenToClient
}\label{wxwindowscreentoclient
}
1728 \constfunc{virtual void
}{ScreenToClient
}{\param{int*
}{x
},
\param{int*
}{y
}}
1730 \constfunc{virtual wxPoint
}{ScreenToClient
}{\param{const wxPoint\&
}{pt
}}
1732 Converts from screen to client window coordinates.
1734 \wxheading{Parameters
}
1736 \docparam{x
}{Stores the screen x coordinate and receives the client x coordinate.
}
1738 \docparam{y
}{Stores the screen x coordinate and receives the client x coordinate.
}
1740 \docparam{pt
}{The screen position for the second form of the function.
}
1742 \pythonnote{In place of a single overloaded method name, wxPython
1743 implements the following methods:
\par
1744 \indented{2cm
}{\begin{twocollist
}
1745 \twocolitem{{\bf ScreenToClient(point)
}}{Accepts and returns a wxPoint
}
1746 \twocolitem{{\bf ScreenToClientXY(x, y)
}}{Returns a
2-tuple, (x, y)
}
1751 \membersection{wxWindow::ScrollWindow
}\label{wxwindowscrollwindow
}
1753 \func{virtual void
}{ScrollWindow
}{\param{int
}{dx
},
\param{int
}{dy
},
\param{const wxRect*
}{ rect = NULL
}}
1755 Physically scrolls the pixels in the window and move child windows accordingly.
1757 \wxheading{Parameters
}
1759 \docparam{dx
}{Amount to scroll horizontally.
}
1761 \docparam{dy
}{Amount to scroll vertically.
}
1763 \docparam{rect
}{Rectangle to invalidate. If this is NULL, the whole window is invalidated. If you
1764 pass a rectangle corresponding to the area of the window exposed by the scroll, your painting handler
1765 can optimize painting by checking for the invalidated region. This parameter is ignored under GTK.
}
1769 Use this function to optimise your scrolling implementations, to minimise the area that must be
1770 redrawn. Note that it is rarely required to call this function from a user program.
1772 \membersection{wxWindow::SetAcceleratorTable
}\label{wxwindowsetacceleratortable
}
1774 \func{virtual void
}{SetAcceleratorTable
}{\param{const wxAcceleratorTable\&
}{ accel
}}
1776 Sets the accelerator table for this window. See
\helpref{wxAcceleratorTable
}{wxacceleratortable
}.
1778 \membersection{wxWindow::SetAutoLayout
}\label{wxwindowsetautolayout
}
1780 \func{void
}{SetAutoLayout
}{\param{bool
}{ autoLayout
}}
1782 Determines whether the
\helpref{wxWindow::Layout
}{wxwindowlayout
} function will
1783 be called automatically when the window is resized. Use in connection with
1784 \helpref{wxWindow::SetSizer
}{wxwindowsetsizer
} and
1785 \helpref{wxWindow::SetConstraints
}{wxwindowsetconstraints
} for laying out subwindows.
1787 \wxheading{Parameters
}
1789 \docparam{autoLayout
}{Set this to TRUE if you wish the Layout function to be called
1790 from within wxWindow::OnSize functions.
}
1792 \wxheading{See also
}
1794 \helpref{wxWindow::SetConstraints
}{wxwindowsetconstraints
}
1796 \membersection{wxWindow::SetBackgroundColour
}\label{wxwindowsetbackgroundcolour
}
1798 \func{virtual void
}{SetBackgroundColour
}{\param{const wxColour\&
}{colour
}}
1800 Sets the background colour of the window.
1802 \wxheading{Parameters
}
1804 \docparam{colour
}{The colour to be used as the background colour.
}
1808 The background colour is usually painted by the default
\rtfsp
1809 \helpref{wxWindow::OnEraseBackground
}{wxwindowonerasebackground
} event handler function
1810 under Windows and automatically under GTK.
1812 Note that setting the background colour does not cause an immediate refresh, so you
1813 may wish to call
\helpref{wxWindow::Clear
}{wxwindowclear
} or
\helpref{wxWindow::Refresh
}{wxwindowrefresh
} after
1814 calling this function.
1816 Use this function with care under GTK as the new appearance of the window might
1817 not look equally well when used with "Themes", i.e GTK's ability to change its
1818 look as the user wishes with run-time loadable modules.
1820 \wxheading{See also
}
1822 \helpref{wxWindow::GetBackgroundColour
}{wxwindowgetbackgroundcolour
},
\rtfsp
1823 \helpref{wxWindow::SetForegroundColour
}{wxwindowsetforegroundcolour
},
\rtfsp
1824 \helpref{wxWindow::GetForegroundColour
}{wxwindowgetforegroundcolour
},
\rtfsp
1825 \helpref{wxWindow::Clear
}{wxwindowclear
},
\rtfsp
1826 \helpref{wxWindow::Refresh
}{wxwindowrefresh
},
\rtfsp
1827 \helpref{wxWindow::OnEraseBackground
}{wxwindowonerasebackground
}
1829 \membersection{wxWindow::SetCaret
}\label{wxwindowsetcaret
}
1831 \constfunc{void
}{SetCaret
}{\param{wxCaret *
}{caret
}}
1833 Sets the
\helpref{caret
}{wxcaret
} associated with the window.
1835 \membersection{wxWindow::SetClientSize
}\label{wxwindowsetclientsize
}
1837 \func{virtual void
}{SetClientSize
}{\param{int
}{ width
},
\param{int
}{ height
}}
1839 \func{virtual void
}{SetClientSize
}{\param{const wxSize\&
}{ size
}}
1841 This sets the size of the window client area in pixels. Using this function to size a window
1842 tends to be more device-independent than
\helpref{wxWindow::SetSize
}{wxwindowsetsize
}, since the application need not
1843 worry about what dimensions the border or title bar have when trying to fit the window
1844 around panel items, for example.
1846 \wxheading{Parameters
}
1848 \docparam{width
}{The required client area width.
}
1850 \docparam{height
}{The required client area height.
}
1852 \docparam{size
}{The required client size.
}
1854 \pythonnote{In place of a single overloaded method name, wxPython
1855 implements the following methods:
\par
1856 \indented{2cm
}{\begin{twocollist
}
1857 \twocolitem{{\bf SetClientSize(size)
}}{Accepts a wxSize
}
1858 \twocolitem{{\bf SetClientSizeWH(width, height)
}}{}
1862 \membersection{wxWindow::SetCursor
}\label{wxwindowsetcursor
}
1864 \func{virtual void
}{SetCursor
}{\param{const wxCursor\&
}{cursor
}}
1866 % VZ: the docs are correct, if the code doesn't behave like this, it must be
1868 Sets the window's cursor. Notice that the window cursor also sets it for the
1869 children of the window implicitly.
1871 The
{\it cursor
} may be
{\tt wxNullCursor
} in which case the window cursor will
1872 be reset back to default.
1874 \wxheading{Parameters
}
1876 \docparam{cursor
}{Specifies the cursor that the window should normally display.
}
1878 \wxheading{See also
}
1880 \helpref{::wxSetCursor
}{wxsetcursor
},
\helpref{wxCursor
}{wxcursor
}
1882 \membersection{wxWindow::SetConstraints
}\label{wxwindowsetconstraints
}
1884 \func{void
}{SetConstraints
}{\param{wxLayoutConstraints*
}{constraints
}}
1886 Sets the window to have the given layout constraints. The window
1887 will then own the object, and will take care of its deletion.
1888 If an existing layout constraints object is already owned by the
1889 window, it will be deleted.
1891 \wxheading{Parameters
}
1893 \docparam{constraints
}{The constraints to set. Pass NULL to disassociate and delete the window's
1898 You must call
\helpref{wxWindow::SetAutoLayout
}{wxwindowsetautolayout
} to tell a window to use
1899 the constraints automatically in OnSize; otherwise, you must override OnSize and call Layout()
1900 explicitly. When setting both a wxLayoutConstraints and a
\helpref{wxSizer
}{wxsizer
}, only the
1901 sizer will have effect.
1903 \membersection{wxWindow::SetDropTarget
}\label{wxwindowsetdroptarget
}
1905 \func{void
}{SetDropTarget
}{\param{wxDropTarget*
}{ target
}}
1907 Associates a drop target with this window.
1909 If the window already has a drop target, it is deleted.
1911 \wxheading{See also
}
1913 \helpref{wxWindow::GetDropTarget
}{wxwindowgetdroptarget
},
1914 \helpref{Drag and drop overview
}{wxdndoverview
}
1916 \membersection{wxWindow::SetEventHandler
}\label{wxwindowseteventhandler
}
1918 \func{void
}{SetEventHandler
}{\param{wxEvtHandler*
}{handler
}}
1920 Sets the event handler for this window.
1922 \wxheading{Parameters
}
1924 \docparam{handler
}{Specifies the handler to be set.
}
1928 An event handler is an object that is capable of processing the events
1929 sent to a window. By default, the window is its own event handler, but
1930 an application may wish to substitute another, for example to allow
1931 central implementation of event-handling for a variety of different
1934 It is usually better to use
\helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
} since
1935 this sets up a chain of event handlers, where an event not handled by one event handler is
1936 handed to the next one in the chain.
1938 \wxheading{See also
}
1940 \helpref{wxWindow::GetEventHandler
}{wxwindowgeteventhandler
},
\rtfsp
1941 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1942 \helpref{wxWindow::PopEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1943 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
1944 \helpref{wxEvtHandler
}{wxevthandler
}
1946 \membersection{wxWindow::SetExtraStyle
}\label{wxwindowsetextrastyle
}
1948 \func{void
}{SetExtraStyle
}{\param{long
}{exStyle
}}
1950 Sets the extra style bits for the window. The currently defined extra style
1954 \begin{twocollist
}\itemsep=
0pt
1955 \twocolitem{\windowstyle{wxWS
\_EX\_VALIDATE\_RECURSIVELY}}{TransferDataTo/FromWindow()
1956 and Validate() methods will recursively descend into all children of the
1957 window if it has this style flag set.
}
1960 \membersection{wxWindow::SetFocus
}\label{wxwindowsetfocus
}
1962 \func{virtual void
}{SetFocus
}{\void}
1964 This sets the window to receive keyboard input.
1966 \membersection{wxWindow::SetFont
}\label{wxwindowsetfont
}
1968 \func{void
}{SetFont
}{\param{const wxFont\&
}{font
}}
1970 Sets the font for this window.
1972 \wxheading{Parameters
}
1974 \docparam{font
}{Font to associate with this window.
}
1976 \wxheading{See also
}
1978 \helpref{wxWindow::GetFont
}{wxwindowgetfont
}
1980 \membersection{wxWindow::SetForegroundColour
}\label{wxwindowsetforegroundcolour
}
1982 \func{virtual void
}{SetForegroundColour
}{\param{const wxColour\&
}{colour
}}
1984 Sets the foreground colour of the window.
1986 \wxheading{Parameters
}
1988 \docparam{colour
}{The colour to be used as the foreground colour.
}
1992 The interpretation of foreground colour is open to interpretation according
1993 to the window class; it may be the text colour or other colour, or it may not
1996 Note that when using this functions under GTK, you will disable the so called "themes",
1997 i.e. the user chosen apperance of windows and controls, including the themes of
1998 their parent windows.
2000 \wxheading{See also
}
2002 \helpref{wxWindow::GetForegroundColour
}{wxwindowgetforegroundcolour
},
\rtfsp
2003 \helpref{wxWindow::SetBackgroundColour
}{wxwindowsetbackgroundcolour
},
\rtfsp
2004 \helpref{wxWindow::GetBackgroundColour
}{wxwindowgetbackgroundcolour
}
2006 \membersection{wxWindow::SetHelpText
}\label{wxwindowsethelptext
}
2008 \func{virtual void
}{SetHelpText
}{\param{const wxString\&
}{helpText
}}
2010 Sets the help text to be used as context-sensitive help for this window.
2012 Note that the text is actually stored by the current
\helpref{wxHelpProvider
}{wxhelpprovider
} implementation,
2013 and not in the window object itself.
2015 \wxheading{See also
}
2017 \helpref{GetHelpText
}{wxwindowgethelptext
},
\helpref{wxHelpProvider
}{wxhelpprovider
}
2019 \membersection{wxWindow::SetId
}\label{wxwindowsetid
}
2021 \func{void
}{SetId
}{\param{int
}{ id
}}
2023 Sets the identifier of the window.
2027 Each window has an integer identifier. If the application has not provided one,
2028 an identifier will be generated. Normally, the identifier should be provided
2029 on creation and should not be modified subsequently.
2031 \wxheading{See also
}
2033 \helpref{wxWindow::GetId
}{wxwindowgetid
},
\rtfsp
2034 \helpref{Window identifiers
}{windowids
}
2036 \membersection{wxWindow::SetName
}\label{wxwindowsetname
}
2038 \func{virtual void
}{SetName
}{\param{const wxString\&
}{name
}}
2040 Sets the window's name.
2042 \wxheading{Parameters
}
2044 \docparam{name
}{A name to set for the window.
}
2046 \wxheading{See also
}
2048 \helpref{wxWindow::GetName
}{wxwindowgetname
}
2050 \membersection{wxWindow::SetPalette
}\label{wxwindowsetpalette
}
2052 \func{virtual void
}{SetPalette
}{\param{wxPalette*
}{palette
}}
2054 Obsolete - use
\helpref{wxDC::SetPalette
}{wxdcsetpalette
} instead.
2056 \membersection{wxWindow::SetScrollbar
}\label{wxwindowsetscrollbar
}
2058 \func{virtual void
}{SetScrollbar
}{\param{int
}{orientation
},
\param{int
}{position
},
\rtfsp
2059 \param{int
}{thumbSize
},
\param{int
}{range
},
\rtfsp
2060 \param{bool
}{refresh = TRUE
}}
2062 Sets the scrollbar properties of a built-in scrollbar.
2064 \wxheading{Parameters
}
2066 \docparam{orientation
}{Determines the scrollbar whose page size is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
2068 \docparam{position
}{The position of the scrollbar in scroll units.
}
2070 \docparam{thumbSize
}{The size of the thumb, or visible portion of the scrollbar, in scroll units.
}
2072 \docparam{range
}{The maximum position of the scrollbar.
}
2074 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
2078 Let's say you wish to display
50 lines of text, using the same font.
2079 The window is sized so that you can only see
16 lines at a time.
2085 SetScrollbar(wxVERTICAL,
0,
16,
50);
2089 Note that with the window at this size, the thumb position can never go
2090 above
50 minus
16, or
34.
2092 You can determine how many lines are currently visible by dividing the current view
2093 size by the character height in pixels.
2095 When defining your own scrollbar behaviour, you will always need to recalculate
2096 the scrollbar settings when the window size changes. You could therefore put your
2097 scrollbar calculations and SetScrollbar
2098 call into a function named AdjustScrollbars, which can be called initially and also
2099 from your
\helpref{wxWindow::OnSize
}{wxwindowonsize
} event handler function.
2101 \wxheading{See also
}
2103 \helpref{Scrolling overview
}{scrollingoverview
},
\rtfsp
2104 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
2107 \membersection{wxWindow::SetScrollPage
}\label{wxwindowsetscrollpage
}
2109 \func{virtual void
}{SetScrollPage
}{\param{int
}{orientation
},
\param{int
}{pageSize
},
\param{bool
}{refresh = TRUE
}}
2111 Sets the page size of one of the built-in scrollbars.
2113 \wxheading{Parameters
}
2115 \docparam{orientation
}{Determines the scrollbar whose page size is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
2117 \docparam{pageSize
}{Page size in scroll units.
}
2119 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
2123 The page size of a scrollbar is the number of scroll units that the scroll thumb travels when you
2124 click on the area above/left of or below/right of the thumb. Normally you will want a whole visible
2125 page to be scrolled, i.e. the size of the current view (perhaps the window client size). This
2126 value has to be adjusted when the window is resized, since the page size will have changed.
2128 In addition to specifying how far the scroll thumb travels when paging, in Motif and some versions of Windows
2129 the thumb changes size to reflect the page size relative to the length of the
document. When the
2130 document size is only slightly bigger than the current view (window) size, almost all of the scrollbar
2131 will be taken up by the thumb. When the two values become the same, the scrollbar will (on some systems)
2134 Currently, this function should be called before SetPageRange, because of a quirk in the Windows
2135 handling of pages and ranges.
2137 \wxheading{See also
}
2139 \helpref{wxWindow::SetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
2140 \helpref{wxWindow::GetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
2141 \helpref{wxWindow::GetScrollPage
}{wxwindowsetscrollpage
},
\rtfsp
2142 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
2145 \membersection{wxWindow::SetScrollPos
}\label{wxwindowsetscrollpos
}
2147 \func{virtual void
}{SetScrollPos
}{\param{int
}{orientation
},
\param{int
}{pos
},
\param{bool
}{refresh = TRUE
}}
2149 Sets the position of one of the built-in scrollbars.
2151 \wxheading{Parameters
}
2153 \docparam{orientation
}{Determines the scrollbar whose position is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
2155 \docparam{pos
}{Position in scroll units.
}
2157 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
2161 This function does not directly affect the contents of the window: it is up to the
2162 application to take note of scrollbar attributes and redraw contents accordingly.
2164 \wxheading{See also
}
2166 \helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
},
\rtfsp
2167 \helpref{wxWindow::GetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
2168 \helpref{wxWindow::GetScrollThumb
}{wxwindowgetscrollthumb
},
\rtfsp
2169 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
2172 \membersection{wxWindow::SetScrollRange
}\label{wxwindowsetscrollrange
}
2174 \func{virtual void
}{SetScrollRange
}{\param{int
}{orientation
},
\param{int
}{range
},
\param{bool
}{refresh = TRUE
}}
2176 Sets the range of one of the built-in scrollbars.
2178 \wxheading{Parameters
}
2180 \docparam{orientation
}{Determines the scrollbar whose range is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
2182 \docparam{range
}{Scroll range.
}
2184 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
2188 The range of a scrollbar is the number of steps that the thumb may travel, rather than the total
2189 object length of the scrollbar. If you are implementing a scrolling window, for example, you
2190 would adjust the scroll range when the window is resized, by subtracting the window view size from the
2191 total virtual window size. When the two sizes are the same (all the window is visible), the range goes to zero
2192 and usually the scrollbar will be automatically hidden.
2194 \wxheading{See also
}
2196 \helpref{wxWindow::SetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
2197 \helpref{wxWindow::SetScrollPage
}{wxwindowsetscrollpage
},
\rtfsp
2198 \helpref{wxWindow::GetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
2199 \helpref{wxWindow::GetScrollPage
}{wxwindowsetscrollpage
},
\rtfsp
2200 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
2203 \membersection{wxWindow::SetSize
}\label{wxwindowsetsize
}
2205 \func{virtual void
}{SetSize
}{\param{int
}{ x
},
\param{int
}{ y
},
\param{int
}{ width
},
\param{int
}{ height
},
2206 \param{int
}{ sizeFlags = wxSIZE
\_AUTO}}
2208 \func{virtual void
}{SetSize
}{\param{const wxRect\&
}{ rect
}}
2210 Sets the size and position of the window in pixels.
2212 \func{virtual void
}{SetSize
}{\param{int
}{ width
},
\param{int
}{ height
}}
2214 \func{virtual void
}{SetSize
}{\param{const wxSize\&
}{ size
}}
2216 Sets the size of the window in pixels.
2218 \wxheading{Parameters
}
2220 \docparam{x
}{Required x position in pixels, or -
1 to indicate that the existing
2221 value should be used.
}
2223 \docparam{y
}{Required y position in pixels, or -
1 to indicate that the existing
2224 value should be used.
}
2226 \docparam{width
}{Required width in pixels, or -
1 to indicate that the existing
2227 value should be used.
}
2229 \docparam{height
}{Required height position in pixels, or -
1 to indicate that the existing
2230 value should be used.
}
2232 \docparam{size
}{\helpref{wxSize
}{wxsize
} object for setting the size.
}
2234 \docparam{rect
}{\helpref{wxRect
}{wxrect
} object for setting the position and size.
}
2236 \docparam{sizeFlags
}{Indicates the interpretation of other parameters. It is a bit list of the following:
2238 {\bf wxSIZE
\_AUTO\_WIDTH}: a -
1 width value is taken to indicate
2239 a wxWindows-supplied default width.\\
2240 {\bf wxSIZE
\_AUTO\_HEIGHT}: a -
1 height value is taken to indicate
2241 a wxWindows-supplied default width.\\
2242 {\bf wxSIZE
\_AUTO}: -
1 size values are taken to indicate
2243 a wxWindows-supplied default size.\\
2244 {\bf wxSIZE
\_USE\_EXISTING}: existing dimensions should be used
2245 if -
1 values are supplied.\\
2246 {\bf wxSIZE
\_ALLOW\_MINUS\_ONE}: allow dimensions of -
1 and less to be interpreted
2247 as real dimensions, not default values.
2252 The second form is a convenience for calling the first form with default
2253 x and y parameters, and must be used with non-default width and height values.
2255 The first form sets the position and optionally size, of the window.
2256 Parameters may be -
1 to indicate either that a default should be supplied
2257 by wxWindows, or that the current value of the dimension should be used.
2259 \wxheading{See also
}
2261 \helpref{wxWindow::Move
}{wxwindowmove
}
2263 \pythonnote{In place of a single overloaded method name, wxPython
2264 implements the following methods:
\par
2265 \indented{2cm
}{\begin{twocollist
}
2266 \twocolitem{{\bf SetDimensions(x, y, width, height, sizeFlags=wxSIZE
\_AUTO)
}}{}
2267 \twocolitem{{\bf SetSize(size)
}}{}
2268 \twocolitem{{\bf SetPosition(point)
}}{}
2272 \membersection{wxWindow::SetSizeHints
}\label{wxwindowsetsizehints
}
2274 \func{virtual void
}{SetSizeHints
}{\param{int
}{ minW=-
1},
\param{int
}{ minH=-
1},
\param{int
}{ maxW=-
1},
\param{int
}{ maxH=-
1},
2275 \param{int
}{ incW=-
1},
\param{int
}{ incH=-
1}}
2277 Allows specification of minimum and maximum window sizes, and window size increments.
2278 If a pair of values is not set (or set to -
1), the default values will be used.
2280 \wxheading{Parameters
}
2282 \docparam{minW
}{Specifies the minimum width allowable.
}
2284 \docparam{minH
}{Specifies the minimum height allowable.
}
2286 \docparam{maxW
}{Specifies the maximum width allowable.
}
2288 \docparam{maxH
}{Specifies the maximum height allowable.
}
2290 \docparam{incW
}{Specifies the increment for sizing the width (Motif/Xt only).
}
2292 \docparam{incH
}{Specifies the increment for sizing the height (Motif/Xt only).
}
2296 If this function is called, the user will not be able to size the window outside the
2299 The resizing increments are only significant under Motif or Xt.
2301 \membersection{wxWindow::SetSizer
}\label{wxwindowsetsizer
}
2303 \func{void
}{SetSizer
}{\param{wxSizer*
}{sizer
}}
2305 Sets the window to have the given layout sizer. The window
2306 will then own the object, and will take care of its deletion.
2307 If an existing layout constraints object is already owned by the
2308 window, it will be deleted.
2310 \wxheading{Parameters
}
2312 \docparam{sizer
}{The sizer to set. Pass NULL to disassociate and delete the window's
2317 You must call
\helpref{wxWindow::SetAutoLayout
}{wxwindowsetautolayout
} to tell a window to use
2318 the sizer automatically in OnSize; otherwise, you must override OnSize and call Layout()
2319 explicitly. When setting both a wxSizer and a
\helpref{wxLayoutConstraints
}{wxlayoutconstraints
},
2320 only the sizer will have effect.
2322 \membersection{wxWindow::SetTitle
}\label{wxwindowsettitle
}
2324 \func{virtual void
}{SetTitle
}{\param{const wxString\&
}{title
}}
2326 Sets the window's title. Applicable only to frames and dialogs.
2328 \wxheading{Parameters
}
2330 \docparam{title
}{The window's title.
}
2332 \wxheading{See also
}
2334 \helpref{wxWindow::GetTitle
}{wxwindowgettitle
}
2336 \membersection{wxWindow::SetValidator
}\label{wxwindowsetvalidator
}
2338 \func{virtual void
}{SetValidator
}{\param{const wxValidator\&
}{ validator
}}
2340 Deletes the current validator (if any) and sets the window validator, having called wxValidator::Clone to
2341 create a new validator of this type.
2343 \membersection{wxWindow::SetToolTip
}\label{wxwindowsettooltip
}
2345 \func{void
}{SetToolTip
}{\param{const wxString\&
}{tip
}}
2347 \func{void
}{SetToolTip
}{\param{wxToolTip*
}{tip
}}
2349 Attach a tooltip to the window.
2351 See also:
\helpref{GetToolTip
}{wxwindowgettooltip
},
2352 \helpref{wxToolTip
}{wxtooltip
}
2355 \membersection{wxWindow::GetToolTip
}\label{wxwindowgettooltip
}
2357 \constfunc{wxToolTip*
}{GetToolTip
}{\void}
2359 Get the associated tooltip or NULL if none.
2363 \membersection{wxWindow::SetWindowStyle
}\label{wxwindowsetwindowstyle
}
2365 \func{void
}{SetWindowStyle
}{\param{long
}{ style
}}
2367 Identical to
\helpref{SetWindowStyleFlag
}{wxwindowsetwindowstyleflag
}.
2369 \membersection{wxWindow::SetWindowStyleFlag
}\label{wxwindowsetwindowstyleflag
}
2371 \func{virtual void
}{SetWindowStyleFlag
}{\param{long
}{ style
}}
2373 Sets the style of the window. Please note that some styles cannot be changed
2374 after the window creation and that
\helpref{Refresh()
}{wxwindowrefresh
} might
2375 be called after changing the others for the change to take place immediately.
2377 See
\helpref{Window styles
}{windowstyles
} for more information about flags.
2379 \wxheading{See also
}
2381 \helpref{GetWindowStyleFlag
}{wxwindowgetwindowstyleflag
}
2383 \membersection{wxWindow::Show
}\label{wxwindowshow
}
2385 \func{virtual bool
}{Show
}{\param{bool
}{ show
}}
2387 Shows or hides the window.
2389 \wxheading{Parameters
}
2391 \docparam{show
}{If TRUE, displays the window and brings it to the front. Otherwise,
2394 \wxheading{See also
}
2396 \helpref{wxWindow::IsShown
}{wxwindowisshown
}
2398 \membersection{wxWindow::TransferDataFromWindow
}\label{wxwindowtransferdatafromwindow
}
2400 \func{virtual bool
}{TransferDataFromWindow
}{\void}
2402 Transfers values from child controls to data areas specified by their validators. Returns
2403 FALSE if a transfer failed.
2405 If the window has
{\tt wxWS
\_EX\_VALIDATE\_RECURSIVELY} extra style flag set,
2406 the method will also call TransferDataFromWindow() of all child windows.
2408 \wxheading{See also
}
2410 \helpref{wxWindow::TransferDataToWindow
}{wxwindowtransferdatatowindow
},
\rtfsp
2411 \helpref{wxValidator
}{wxvalidator
},
\helpref{wxWindow::Validate
}{wxwindowvalidate
}
2413 \membersection{wxWindow::TransferDataToWindow
}\label{wxwindowtransferdatatowindow
}
2415 \func{virtual bool
}{TransferDataToWindow
}{\void}
2417 Transfers values to child controls from data areas specified by their validators.
2419 If the window has
{\tt wxWS
\_EX\_VALIDATE\_RECURSIVELY} extra style flag set,
2420 the method will also call TransferDataToWindow() of all child windows.
2422 \wxheading{Return value
}
2424 Returns FALSE if a transfer failed.
2426 \wxheading{See also
}
2428 \helpref{wxWindow::TransferDataFromWindow
}{wxwindowtransferdatafromwindow
},
\rtfsp
2429 \helpref{wxValidator
}{wxvalidator
},
\helpref{wxWindow::Validate
}{wxwindowvalidate
}
2431 \membersection{wxWindow::Validate
}\label{wxwindowvalidate
}
2433 \func{virtual bool
}{Validate
}{\void}
2435 Validates the current values of the child controls using their validators.
2437 If the window has
{\tt wxWS
\_EX\_VALIDATE\_RECURSIVELY} extra style flag set,
2438 the method will also call Validate() of all child windows.
2440 \wxheading{Return value
}
2442 Returns FALSE if any of the validations failed.
2444 \wxheading{See also
}
2446 \helpref{wxWindow::TransferDataFromWindow
}{wxwindowtransferdatafromwindow
},
\rtfsp
2447 \helpref{wxWindow::TransferDataFromWindow
}{wxwindowtransferdatafromwindow
},
\rtfsp
2448 \helpref{wxValidator
}{wxvalidator
}
2450 \membersection{wxWindow::WarpPointer
}\label{wxwindowwarppointer
}
2452 \func{void
}{WarpPointer
}{\param{int
}{ x
},
\param{int
}{ y
}}
2454 Moves the pointer to the given position on the window.
2456 \wxheading{Parameters
}
2458 \docparam{x
}{The new x position for the cursor.
}
2460 \docparam{y
}{The new y position for the cursor.
}