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
\_FULLREPAINT\_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 style. Currently only has 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
}
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::Centre
}\label{wxwindowcentre
}
148 \func{void
}{Centre
}{\param{int
}{ direction = wxHORIZONTAL
}}
152 \wxheading{Parameters
}
154 \docparam{direction
}{Specifies the direction for the centering. May be
{\tt wxHORIZONTAL
},
{\tt wxVERTICAL
}\rtfsp
155 or
{\tt wxBOTH
}. It may also include
{\tt wxCENTRE
\_ON\_SCREEN} flag
156 if you want to center the window on the entire screen and not on its
159 The flag
{\tt wxCENTRE
\_FRAME} is obsolete and should not be used any longer.
163 If the window is a top level one (i.e. doesn't have a parent), it will be
164 centered relative to the screen anyhow.
168 \helpref{wxWindow::Center
}{wxwindowcenter
}
170 \membersection{wxWindow::CentreOnParent
}\label{wxwindowcentreonparent
}
172 \func{void
}{CentreOnParent
}{\param{int
}{ direction = wxHORIZONTAL
}}
176 \wxheading{Parameters
}
178 \docparam{direction
}{Specifies the direction for the centering. May be
{\tt wxHORIZONTAL
},
{\tt wxVERTICAL
}\rtfsp
183 This methods provides for a way to center top level windows over their
184 parents instead of the entire screen. If there is no parent or if the
185 window is not a top level window, then behaviour is the same as
186 \helpref{wxWindow::Centre
}{wxwindowcentre
}.
190 \helpref{wxWindow::CenterOnParent
}{wxwindowcenteronparent
}
192 \membersection{wxWindow::Clear
}\label{wxwindowclear
}
194 \func{void
}{Clear
}{\void}
196 Clears the window by filling it with the current background colour. Does not
197 cause an erase background event to be generated.
199 \membersection{wxWindow::ClientToScreen
}
201 \constfunc{virtual void
}{ClientToScreen
}{\param{int*
}{x
},
\param{int*
}{y
}}
203 \constfunc{virtual wxPoint
}{ClientToScreen
}{\param{const wxPoint\&
}{ pt
}}
205 Converts to screen coordinates from coordinates relative to this window.
207 \docparam{x
}{A pointer to a integer value for the x coordinate. Pass the client coordinate in, and
208 a screen coordinate will be passed out.
}
210 \docparam{y
}{A pointer to a integer value for the y coordinate. Pass the client coordinate in, and
211 a screen coordinate will be passed out.
}
213 \docparam{pt
}{The client position for the second form of the function.
}
215 \pythonnote{In place of a single overloaded method name, wxPython
216 implements the following methods:
\par
217 \indented{2cm
}{\begin{twocollist
}
218 \twocolitem{{\bf ClientToScreen(point)
}}{Accepts and returns a wxPoint
}
219 \twocolitem{{\bf ClientToScreenXY(x, y)
}}{Returns a
2-tuple, (x, y)
}
224 \membersection{wxWindow::Close
}\label{wxwindowclose
}
226 \func{virtual bool
}{Close
}{\param{bool
}{ force = FALSE
}}
228 The purpose of this call is to provide a safer way of destroying a window than using
229 the
{\it delete
} operator.
231 \wxheading{Parameters
}
233 \docparam{force
}{FALSE if the window's close handler should be able to veto the destruction
234 of this window, TRUE if it cannot.
}
238 Close calls the
\helpref{close handler
}{wxcloseevent
} for the window, providing an opportunity for the window to
239 choose whether to destroy the window.
241 The close handler should check whether the window is being deleted forcibly,
242 using
\helpref{wxCloseEvent::GetForce
}{wxcloseeventgetforce
}, in which case it should
243 destroy the window using
\helpref{wxWindow::Destroy
}{wxwindowdestroy
}.
245 Applies to managed windows (wxFrame and wxDialog classes) only.
247 {\it Note
} that calling Close does not guarantee that the window will be destroyed; but it
248 provides a way to simulate a manual close of a window, which may or may not be implemented by
249 destroying the window. The default implementation of wxDialog::OnCloseWindow does not
250 necessarily delete the dialog, since it will simply simulate an wxID
\_CANCEL event which
251 itself only hides the dialog.
253 To guarantee that the window will be destroyed, call
\helpref{wxWindow::Destroy
}{wxwindowdestroy
} instead.
257 \helpref{Window deletion overview
}{windowdeletionoverview
},
\rtfsp
258 \helpref{wxWindow::OnCloseWindow
}{wxwindowonclosewindow
},
\rtfsp
259 \helpref{wxWindow::Destroy
}{wxwindowdestroy
},
\rtfsp
260 \helpref{wxCloseEvent
}{wxcloseevent
}
262 \membersection{wxWindow::ConvertDialogToPixels
}\label{wxwindowconvertdialogtopixels
}
264 \func{wxPoint
}{ConvertDialogToPixels
}{\param{const wxPoint\&
}{ pt
}}
266 \func{wxSize
}{ConvertDialogToPixels
}{\param{const wxSize\&
}{ sz
}}
268 Converts a point or size from dialog units to pixels.
270 For the x dimension, the dialog units are multiplied by the average character width
271 and then divided by
4.
273 For the y dimension, the dialog units are multiplied by the average character height
274 and then divided by
8.
278 Dialog units are used for maintaining a dialog's proportions even if the font changes.
279 Dialogs created using Dialog Editor optionally use dialog units.
281 You can also use these functions programmatically. A convenience macro is defined:
285 #define wxDLG_UNIT(parent, pt) parent->ConvertDialogToPixels(pt)
291 \helpref{wxWindow::ConvertPixelsToDialog
}{wxwindowconvertpixelstodialog
}
293 \pythonnote{In place of a single overloaded method name, wxPython
294 implements the following methods:
\par
295 \indented{2cm
}{\begin{twocollist
}
296 \twocolitem{{\bf ConvertDialogPointToPixels(point)
}}{Accepts and returns a wxPoint
}
297 \twocolitem{{\bf ConvertDialogSizeToPixels(size)
}}{Accepts and returns a wxSize
}
300 Additionally, the following helper functions are defined:
\par
301 \indented{2cm
}{\begin{twocollist
}
302 \twocolitem{{\bf wxDLG
\_PNT(win, point)
}}{Converts a wxPoint from dialog
304 \twocolitem{{\bf wxDLG
\_SZE(win, size)
}}{Converts a wxSize from dialog
310 \membersection{wxWindow::ConvertPixelsToDialog
}\label{wxwindowconvertpixelstodialog
}
312 \func{wxPoint
}{ConvertPixelsToDialog
}{\param{const wxPoint\&
}{ pt
}}
314 \func{wxSize
}{ConvertPixelsToDialog
}{\param{const wxSize\&
}{ sz
}}
316 Converts a point or size from pixels to dialog units.
318 For the x dimension, the pixels are multiplied by
4 and then divided by the average
321 For the y dimension, the pixels are multipled by
8 and then divided by the average
326 Dialog units are used for maintaining a dialog's proportions even if the font changes.
327 Dialogs created using Dialog Editor optionally use dialog units.
331 \helpref{wxWindow::ConvertDialogToPixels
}{wxwindowconvertdialogtopixels
}
334 \pythonnote{In place of a single overloaded method name, wxPython
335 implements the following methods:
\par
336 \indented{2cm
}{\begin{twocollist
}
337 \twocolitem{{\bf ConvertDialogPointToPixels(point)
}}{Accepts and returns a wxPoint
}
338 \twocolitem{{\bf ConvertDialogSizeToPixels(size)
}}{Accepts and returns a wxSize
}
342 \membersection{wxWindow::Destroy
}\label{wxwindowdestroy
}
344 \func{virtual bool
}{Destroy
}{\void}
346 Destroys the window safely. Use this function instead of the delete operator, since
347 different window classes can be destroyed differently. Frames and dialogs
348 are not destroyed immediately when this function is called - they are added
349 to a list of windows to be deleted on idle time, when all the window's events
350 have been processed. This prevents problems with events being sent to non-existant
353 \wxheading{Return value
}
355 TRUE if the window has either been successfully deleted, or it has been added
356 to the list of windows pending real deletion.
358 \membersection{wxWindow::DestroyChildren
}
360 \func{virtual void
}{DestroyChildren
}{\void}
362 Destroys all children of a window. Called automatically by the destructor.
364 \membersection{wxWindow::DragAcceptFiles
}\label{wxwindowdragacceptfiles
}
366 \func{virtual void
}{DragAcceptFiles
}{\param{bool
}{ accept
}}
368 Enables or disables elibility for drop file events (OnDropFiles).
370 \wxheading{Parameters
}
372 \docparam{accept
}{If TRUE, the window is eligible for drop file events. If FALSE, the window
373 will not accept drop file events.
}
381 \helpref{wxWindow::OnDropFiles
}{wxwindowondropfiles
}
383 \membersection{wxWindow::Enable
}\label{wxwindowenable
}
385 \func{virtual void
}{Enable
}{\param{bool
}{ enable
}}
387 Enable or disable the window for user input.
389 \wxheading{Parameters
}
391 \docparam{enable
}{If TRUE, enables the window for input. If FALSE, disables the window.
}
395 \helpref{wxWindow::IsEnabled
}{wxwindowisenabled
}
397 \membersection{wxWindow::FindFocus
}\label{wxwindowfindfocus
}
399 \func{static wxWindow*
}{FindFocus
}{\void}
401 Finds the window or control which currently has the keyboard focus.
405 Note that this is a static function, so it can be called without needing a wxWindow pointer.
409 \helpref{wxWindow::SetFocus
}{wxwindowsetfocus
}
411 \membersection{wxWindow::FindWindow
}\label{wxwindowfindwindow
}
413 \func{wxWindow*
}{FindWindow
}{\param{long
}{ id
}}
415 Find a child of this window, by identifier.
417 \func{wxWindow*
}{FindWindow
}{\param{const wxString\&
}{ name
}}
419 Find a child of this window, by name.
421 \pythonnote{In place of a single overloaded method name, wxPython
422 implements the following methods:
\par
423 \indented{2cm
}{\begin{twocollist
}
424 \twocolitem{{\bf FindWindowById(id)
}}{Accepts an integer
}
425 \twocolitem{{\bf FindWindowByName(name)
}}{Accepts a string
}
429 \membersection{wxWindow::Fit
}\label{wxwindowfit
}
431 \func{virtual void
}{Fit
}{\void}
433 Sizes the window so that it fits around its subwindows. This function won't do
434 anything if there are no subwindows.
436 \membersection{wxWindow::GetBackgroundColour
}\label{wxwindowgetbackgroundcolour
}
438 \constfunc{virtual wxColour
}{GetBackgroundColour
}{\void}
440 Returns the background colour of the window.
444 \helpref{wxWindow::SetBackgroundColour
}{wxwindowsetbackgroundcolour
},
\rtfsp
445 \helpref{wxWindow::SetForegroundColour
}{wxwindowsetforegroundcolour
},
\rtfsp
446 \helpref{wxWindow::GetForegroundColour
}{wxwindowgetforegroundcolour
},
\rtfsp
447 \helpref{wxWindow::OnEraseBackground
}{wxwindowonerasebackground
}
449 \membersection{wxWindow::GetBestSize
}\label{wxwindowgetbestsize
}
451 \constfunc{virtual wxSize
}{GetBestSize
}{\void}
453 This functions returns the best acceptable minimal size for the window. For
454 example, for a static control, it will be the minimal size such that the
455 control label is not truncated. For windows containing subwindows (typically
456 \helpref{wxPanel
}{wxpanel
}), the size returned by this function will be the
457 same as the size the window would have had after calling
458 \helpref{Fit
}{wxwindowfit
}.
460 \membersection{wxWindow::GetCharHeight
}
462 \constfunc{virtual int
}{GetCharHeight
}{\void}
464 Returns the character height for this window.
466 \membersection{wxWindow::GetCharWidth
}
468 \constfunc{virtual int
}{GetCharWidth
}{\void}
470 Returns the average character width for this window.
472 \membersection{wxWindow::GetChildren
}
474 \func{wxList\&
}{GetChildren
}{\void}
476 Returns a reference to the list of the window's children.
478 \membersection{wxWindow::GetClientSize
}\label{wxwindowgetclientsize
}
480 \constfunc{virtual void
}{GetClientSize
}{\param{int*
}{width
},
\param{int*
}{height
}}
482 \constfunc{virtual wxSize
}{GetClientSize
}{\void}
484 This gets the size of the window `client area' in pixels. The client area is the
485 area which may be drawn on by the programmer, excluding title bar, border etc.
487 \wxheading{Parameters
}
489 \docparam{width
}{Receives the client width in pixels.
}
491 \docparam{height
}{Receives the client height in pixels.
}
493 \pythonnote{In place of a single overloaded method name, wxPython
494 implements the following methods:
\par
495 \indented{2cm
}{\begin{twocollist
}
496 \twocolitem{{\bf wxGetClientSizeTuple()
}}{Returns a
2-tuple of (width, height)
}
497 \twocolitem{{\bf wxGetClientSize()
}}{Returns a wxSize object
}
501 \membersection{wxWindow::GetConstraints
}\label{wxwindowgetconstraints
}
503 \constfunc{wxLayoutConstraints*
}{GetConstraints
}{\void}
505 Returns a pointer to the window's layout constraints, or NULL if there are none.
507 \membersection{wxWindow::GetDefaultItem
}\label{wxwindowgetdefaultitem
}
509 \constfunc{wxButton*
}{GetDefaultItem
}{\void}
511 Returns a pointer to the button which is the default for this window, or NULL.
513 \membersection{wxWindow::GetDropTarget
}\label{wxwindowgetdroptarget
}
515 \constfunc{wxDropTarget*
}{GetDropTarget
}{\void}
517 Returns the associated drop target, which may be NULL.
521 \helpref{wxWindow::SetDropTarget
}{wxwindowsetdroptarget
},
522 \helpref{Drag and drop overview
}{wxdndoverview
}
524 \membersection{wxWindow::GetEventHandler
}\label{wxwindowgeteventhandler
}
526 \constfunc{wxEvtHandler*
}{GetEventHandler
}{\void}
528 Returns the event handler for this window. By default, the window is its
533 \helpref{wxWindow::SetEventHandler
}{wxwindowseteventhandler
},
\rtfsp
534 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
535 \helpref{wxWindow::PopEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
536 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
537 \helpref{wxEvtHandler
}{wxevthandler
}\rtfsp
539 \membersection{wxWindow::GetExtraStyle
}\label{wxwindowgetextrastyle
}
541 \constfunc{long
}{GetExtraStyle
}{\void}
543 Returns the extra style bits for the window.
545 \membersection{wxWindow::GetFont
}\label{wxwindowgetfont
}
547 \constfunc{wxFont\&
}{GetFont
}{\void}
549 Returns a reference to the font for this window.
553 \helpref{wxWindow::SetFont
}{wxwindowsetfont
}
555 \membersection{wxWindow::GetForegroundColour
}\label{wxwindowgetforegroundcolour
}
557 \func{virtual wxColour
}{GetForegroundColour
}{\void}
559 Returns the foreground colour of the window.
563 The interpretation of foreground colour is open to interpretation according
564 to the window class; it may be the text colour or other colour, or it may not
569 \helpref{wxWindow::SetForegroundColour
}{wxwindowsetforegroundcolour
},
\rtfsp
570 \helpref{wxWindow::SetBackgroundColour
}{wxwindowsetbackgroundcolour
},
\rtfsp
571 \helpref{wxWindow::GetBackgroundColour
}{wxwindowgetbackgroundcolour
}
573 \membersection{wxWindow::GetGrandParent
}
575 \constfunc{wxWindow*
}{GetGrandParent
}{\void}
577 Returns the grandparent of a window, or NULL if there isn't one.
579 \membersection{wxWindow::GetHandle
}
581 \constfunc{void*
}{GetHandle
}{\void}
583 Returns the platform-specific handle of the physical window. Cast it to an appropriate
584 handle, such as
{\bf HWND
} for Windows,
{\bf Widget
} for Motif or
{\bf GtkWidget
} for GTK.
586 \pythonnote{This method will return an integer in wxPython.
}
588 \membersection{wxWindow::GetId
}\label{wxwindowgetid
}
590 \constfunc{int
}{GetId
}{\void}
592 Returns the identifier of the window.
596 Each window has an integer identifier. If the application has not provided one
597 (or the default Id -
1) an unique identifier with a negative value will be generated.
601 \helpref{wxWindow::SetId
}{wxwindowsetid
}\rtfsp
602 \helpref{Window identifiers
}{windowids
}
604 \membersection{wxWindow::GetPosition
}
606 \constfunc{virtual void
}{GetPosition
}{\param{int*
}{x
},
\param{int*
}{y
}}
608 This gets the position of the window in pixels, relative to the parent window or
609 if no parent, relative to the whole display.
611 \wxheading{Parameters
}
613 \docparam{x
}{Receives the x position of the window.
}
615 \docparam{y
}{Receives the y position of the window.
}
617 \pythonnote{In place of a single overloaded method name, wxPython
618 implements the following methods:
\par
619 \indented{2cm
}{\begin{twocollist
}
620 \twocolitem{{\bf GetPosition()
}}{Returns a wxPoint
}
621 \twocolitem{{\bf GetPositionTuple()
}}{Returns a tuple (x, y)
}
625 \membersection{wxWindow::GetLabel
}
627 \constfunc{virtual wxString
}{GetLabel
}{\void}
629 Generic way of getting a label from any window, for
630 identification purposes.
634 The interpretation of this function differs from class to class.
635 For frames and dialogs, the value returned is the title. For buttons or static text controls, it is
636 the button text. This function can be useful for meta-programs (such as testing
637 tools or special-needs access programs) which need to identify windows
640 \membersection{wxWindow::GetName
}\label{wxwindowgetname
}
642 \constfunc{virtual wxString
}{GetName
}{\void}
644 Returns the window's name.
648 This name is not guaranteed to be unique; it is up to the programmer to supply an appropriate
649 name in the window constructor or via
\helpref{wxWindow::SetName
}{wxwindowsetname
}.
653 \helpref{wxWindow::SetName
}{wxwindowsetname
}
655 \membersection{wxWindow::GetParent
}
657 \constfunc{virtual wxWindow*
}{GetParent
}{\void}
659 Returns the parent of the window, or NULL if there is no parent.
661 \membersection{wxWindow::GetRect
}\label{wxwindowgetrect
}
663 \constfunc{virtual wxRect
}{GetRect
}{\void}
665 Returns the size and position of the window as a
\helpref{wxRect
}{wxrect
} object.
667 \membersection{wxWindow::GetScrollThumb
}\label{wxwindowgetscrollthumb
}
669 \func{virtual int
}{GetScrollThumb
}{\param{int
}{orientation
}}
671 Returns the built-in scrollbar thumb size.
675 \helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
}
677 \membersection{wxWindow::GetScrollPos
}\label{wxwindowgetscrollpos
}
679 \func{virtual int
}{GetScrollPos
}{\param{int
}{orientation
}}
681 Returns the built-in scrollbar position.
685 See
\helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
}
687 \membersection{wxWindow::GetScrollRange
}\label{wxwindowgetscrollrange
}
689 \func{virtual int
}{GetScrollRange
}{\param{int
}{orientation
}}
691 Returns the built-in scrollbar range.
695 \helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
}
697 \membersection{wxWindow::GetSize
}\label{wxwindowgetsize
}
699 \constfunc{virtual void
}{GetSize
}{\param{int*
}{width
},
\param{int*
}{height
}}
701 \constfunc{virtual wxSize
}{GetSize
}{\void}
703 This gets the size of the entire window in pixels.
705 \wxheading{Parameters
}
707 \docparam{width
}{Receives the window width.
}
709 \docparam{height
}{Receives the window height.
}
711 \pythonnote{In place of a single overloaded method name, wxPython
712 implements the following methods:
\par
713 \indented{2cm
}{\begin{twocollist
}
714 \twocolitem{{\bf GetSize()
}}{Returns a wxSize
}
715 \twocolitem{{\bf GetSizeTuple()
}}{Returns a
2-tuple (width, height)
}
719 \membersection{wxWindow::GetTextExtent
}
721 \constfunc{virtual void
}{GetTextExtent
}{\param{const wxString\&
}{string
},
\param{int*
}{x
},
\param{int*
}{y
},
722 \param{int*
}{descent = NULL
},
\param{int*
}{externalLeading = NULL
},
723 \param{const wxFont*
}{font = NULL
},
\param{bool
}{ use16 = FALSE
}}
725 Gets the dimensions of the string as it would be drawn on the
726 window with the currently selected font.
728 \wxheading{Parameters
}
730 \docparam{string
}{String whose extent is to be measured.
}
732 \docparam{x
}{Return value for width.
}
734 \docparam{y
}{Return value for height.
}
736 \docparam{descent
}{Return value for descent (optional).
}
738 \docparam{externalLeading
}{Return value for external leading (optional).
}
740 \docparam{font
}{Font to use instead of the current window font (optional).
}
742 \docparam{use16
}{If TRUE,
{\it string
} contains
16-bit characters. The default is FALSE.
}
745 \pythonnote{In place of a single overloaded method name, wxPython
746 implements the following methods:
\par
747 \indented{2cm
}{\begin{twocollist
}
748 \twocolitem{{\bf GetTextExtent(string)
}}{Returns a
2-tuple, (width, height)
}
749 \twocolitem{{\bf GetFullTextExtent(string, font=NULL)
}}{Returns a
750 4-tuple, (width, height, descent, externalLeading)
}
755 \membersection{wxWindow::GetTitle
}\label{wxwindowgettitle
}
757 \func{virtual wxString
}{GetTitle
}{\void}
759 Gets the window's title. Applicable only to frames and dialogs.
763 \helpref{wxWindow::SetTitle
}{wxwindowsettitle
}
765 \membersection{wxWindow::GetUpdateRegion
}\label{wxwindowgetupdateregion
}
767 \constfunc{virtual wxRegion
}{GetUpdateRegion
}{\void}
769 Returns the region specifying which parts of the window have been damaged. Should
770 only be called within an
\helpref{OnPaint
}{wxwindowonpaint
} event handler.
774 \helpref{wxRegion
}{wxregion
},
\helpref{wxRegionIterator
}{wxregioniterator
},
\helpref{wxWindow::OnPaint
}{wxwindowonpaint
}
776 \membersection{wxWindow::GetValidator
}\label{wxwindowgetvalidator
}
778 \constfunc{wxValidator*
}{GetValidator
}{\void}
780 Returns a pointer to the current validator for the window, or NULL if there is none.
782 \membersection{wxWindow::GetWindowStyleFlag
}\label{wxwindowgetwindowstyleflag
}
784 \constfunc{long
}{GetWindowStyleFlag
}{\void}
786 Gets the window style that was passed to the constructor or
{\bf Create
}
787 method.
{\bf GetWindowStyle()
} is another name for the same function.
789 \membersection{wxWindow::InitDialog
}\label{wxwindowinitdialog
}
791 \func{void
}{InitDialog
}{\void}
793 Sends an
\helpref{wxWindow::OnInitDialog
}{wxwindowoninitdialog
} event, which
794 in turn transfers data to the dialog via validators.
798 \helpref{wxWindow::OnInitDialog
}{wxwindowoninitdialog
}
800 \membersection{wxWindow::IsEnabled
}\label{wxwindowisenabled
}
802 \constfunc{virtual bool
}{IsEnabled
}{\void}
804 Returns TRUE if the window is enabled for input, FALSE otherwise.
808 \helpref{wxWindow::Enable
}{wxwindowenable
}
810 \membersection{wxWindow:IsExposed
}\label{wxwindowisexposed
}
812 \constfunc{bool
}{IsExposed
}{\param{int
}{x
},
\param{int
}{y
}}
814 \constfunc{bool
}{IsExposed
}{\param{wxPoint
}{\&pt
}}
816 \constfunc{bool
}{IsExposed
}{\param{int
}{x
},
\param{int
}{y
},
\param{int
}{w
},
\param{int
}{h
}}
818 \constfunc{bool
}{IsExposed
}{\param{wxRect
}{\&rect
}}
820 Returns TRUE if the given point or rectange area has been exposed since the
821 last repaint. Call this in an paint event handler to optimize redrawing by
822 only redrawing those areas, which have been exposed.
824 \membersection{wxWindow::IsRetained
}\label{wxwindowisretained
}
826 \constfunc{virtual bool
}{IsRetained
}{\void}
828 Returns TRUE if the window is retained, FALSE otherwise.
832 Retained windows are only available on X platforms.
834 \membersection{wxWindow::IsShown
}\label{wxwindowisshown
}
836 \constfunc{virtual bool
}{IsShown
}{\void}
838 Returns TRUE if the window is shown, FALSE if it has been hidden.
840 \membersection{wxWindow::IsTopLevel
}\label{wxwindowistoplevel
}
842 \constfunc{bool
}{IsTopLevel
}{\void}
844 Returns TRUE if the given window is a top-level one. Currently all frames and
845 dialogs are considered to be top-level windows (even if they have a parent
848 \membersection{wxWindow::Layout
}\label{wxwindowlayout
}
850 \func{void
}{Layout
}{\void}
852 Invokes the constraint-based layout algorithm or the sizer-based algorithm
855 See
\helpref{wxWindow::SetAutoLayout
}{wxwindowsetautolayout
} on when
856 this function gets called automatically using auto layout.
858 \membersection{wxWindow::LoadFromResource
}\label{wxwindowloadfromresource
}
860 \func{virtual bool
}{LoadFromResource
}{\param{wxWindow*
}{parent
},
\rtfsp
861 \param{const wxString\&
}{resourceName
},
\param{const wxResourceTable*
}{resourceTable = NULL
}}
863 Loads a panel or dialog from a resource file.
865 \wxheading{Parameters
}
867 \docparam{parent
}{Parent window.
}
869 \docparam{resourceName
}{The name of the resource to load.
}
871 \docparam{resourceTable
}{The resource table to load it from. If this is NULL, the
872 default resource table will be used.
}
874 \wxheading{Return value
}
876 TRUE if the operation succeeded, otherwise FALSE.
878 \membersection{wxWindow::Lower
}\label{wxwindowlower
}
880 \func{void
}{Lower
}{\void}
882 Lowers the window to the bottom of the window hierarchy if it is a managed window (dialog
885 \membersection{wxWindow::MakeModal
}\label{wxwindowmakemodal
}
887 \func{virtual void
}{MakeModal
}{\param{bool
}{flag
}}
889 Disables all other windows in the application so that
890 the user can only interact with this window. (This function
891 is not implemented anywhere).
893 \wxheading{Parameters
}
895 \docparam{flag
}{If TRUE, this call disables all other windows in the application so that
896 the user can only interact with this window. If FALSE, the effect is reversed.
}
898 \membersection{wxWindow::Move
}\label{wxwindowmove
}
900 \func{void
}{Move
}{\param{int
}{ x
},
\param{int
}{ y
}}
902 \func{void
}{Move
}{\param{const wxPoint\&
}{ pt
}}
904 Moves the window to the given position.
906 \wxheading{Parameters
}
908 \docparam{x
}{Required x position.
}
910 \docparam{y
}{Required y position.
}
912 \docparam{pt
}{\helpref{wxPoint
}{wxpoint
} object representing the position.
}
916 Implementations of SetSize can also implicitly implement the
917 wxWindow::Move function, which is defined in the base wxWindow class
921 SetSize(x, y, -
1, -
1, wxSIZE_USE_EXISTING);
926 \helpref{wxWindow::SetSize
}{wxwindowsetsize
}
928 \pythonnote{In place of a single overloaded method name, wxPython
929 implements the following methods:
\par
930 \indented{2cm
}{\begin{twocollist
}
931 \twocolitem{{\bf Move(point)
}}{Accepts a wxPoint
}
932 \twocolitem{{\bf MoveXY(x, y)
}}{Accepts a pair of integers
}
936 \membersection{wxWindow::OnActivate
}\label{wxwindowonactivate
}
938 \func{void
}{OnActivate
}{\param{wxActivateEvent\&
}{ event
}}
940 Called when a window is activated or deactivated.
942 \wxheading{Parameters
}
944 \docparam{event
}{Object containing activation information.
}
948 If the window is being activated,
\helpref{wxActivateEvent::GetActive
}{wxactivateeventgetactive
} returns TRUE,
949 otherwise it returns FALSE (it is being deactivated).
953 \helpref{wxActivateEvent
}{wxactivateevent
},
\rtfsp
954 \helpref{Event handling overview
}{eventhandlingoverview
}
956 \membersection{wxWindow::OnChar
}\label{wxwindowonchar
}
958 \func{void
}{OnChar
}{\param{wxKeyEvent\&
}{ event
}}
960 Called when the user has pressed a key that is not a modifier (SHIFT, CONTROL or ALT).
962 \wxheading{Parameters
}
964 \docparam{event
}{Object containing keypress information. See
\helpref{wxKeyEvent
}{wxkeyevent
} for
965 details about this class.
}
969 This member function is called in response to a keypress. To intercept this event,
970 use the EVT
\_CHAR macro in an event table definition. Your
{\bf OnChar
} handler may call this
971 default function to achieve default keypress functionality.
973 Note that the ASCII values do not have explicit key codes: they are passed as ASCII
976 Note that not all keypresses can be intercepted this way. If you wish to intercept modifier
977 keypresses, then you will need to use
\helpref{wxWindow::OnKeyDown
}{wxwindowonkeydown
} or
978 \helpref{wxWindow::OnKeyUp
}{wxwindowonkeyup
}.
980 Most, but not all, windows allow keypresses to be intercepted.
984 \helpref{wxWindow::OnKeyDown
}{wxwindowonkeydown
},
\helpref{wxWindow::OnKeyUp
}{wxwindowonkeyup
},
\rtfsp
985 \helpref{wxKeyEvent
}{wxkeyevent
},
\helpref{wxWindow::OnCharHook
}{wxwindowoncharhook
},
\rtfsp
986 \helpref{Event handling overview
}{eventhandlingoverview
}
988 \membersection{wxWindow::OnCharHook
}\label{wxwindowoncharhook
}
990 \func{void
}{OnCharHook
}{\param{wxKeyEvent\&
}{ event
}}
992 This member is called to allow the window to intercept keyboard events
993 before they are processed by child windows.
995 \wxheading{Parameters
}
997 \docparam{event
}{Object containing keypress information. See
\helpref{wxKeyEvent
}{wxkeyevent
} for
998 details about this class.
}
1002 This member function is called in response to a keypress, if the window is active. To intercept this event,
1003 use the EVT
\_CHAR\_HOOK macro in an event table definition. If you do not process a particular
1004 keypress, call
\helpref{wxEvent::Skip
}{wxeventskip
} to allow default processing.
1006 An example of using this function is in the implementation of escape-character processing for wxDialog,
1007 where pressing ESC dismisses the dialog by
{\bf OnCharHook
} 'forging' a cancel button press event.
1009 Note that the ASCII values do not have explicit key codes: they are passed as ASCII
1012 This function is only relevant to top-level windows (frames and dialogs), and under
1013 Windows only. Under GTK the normal EVT
\_CHAR\_ event has the functionality, i.e.
1014 you can intercepts it and if you don't call
\helpref{wxEvent::Skip
}{wxeventskip
}
1015 the window won't get the event.
1017 \wxheading{See also
}
1019 \helpref{wxKeyEvent
}{wxkeyevent
},
\helpref{wxWindow::OnCharHook
}{wxwindowoncharhook
},
\rtfsp
1020 \helpref{wxApp::OnCharHook
}{wxapponcharhook
},
\rtfsp
1021 \helpref{Event handling overview
}{eventhandlingoverview
}
1023 \membersection{wxWindow::OnCommand
}\label{wxwindowoncommand
}
1025 \func{virtual void
}{OnCommand
}{\param{wxEvtHandler\&
}{object
},
\param{wxCommandEvent\&
}{event
}}
1027 This virtual member function is called if the control does not handle the command event.
1029 \wxheading{Parameters
}
1031 \docparam{object
}{Object receiving the command event.
}
1033 \docparam{event
}{Command event
}
1037 This virtual function is provided mainly for backward compatibility. You can also intercept commands
1038 from child controls by using an event table, with identifiers or identifier ranges to identify
1039 the control(s) in question.
1041 \wxheading{See also
}
1043 \helpref{wxCommandEvent
}{wxcommandevent
},
\rtfsp
1044 \helpref{Event handling overview
}{eventhandlingoverview
}
1046 \membersection{wxWindow::OnClose
}\label{wxwindowonclose
}
1048 \func{virtual bool
}{OnClose
}{\void}
1050 Called when the user has tried to close a a frame
1051 or dialog box using the window manager (X) or system menu (Windows).
1053 {\bf Note:
} This is an obsolete function.
1054 It is superceded by the
\helpref{wxWindow::OnCloseWindow
}{wxwindowonclosewindow
} event
1057 \wxheading{Return value
}
1059 If TRUE is returned by OnClose, the window will be deleted by the system, otherwise the
1060 attempt will be ignored. Do not delete the window from within this handler, although
1061 you may delete other windows.
1063 \wxheading{See also
}
1065 \helpref{Window deletion overview
}{windowdeletionoverview
},
\rtfsp
1066 \helpref{wxWindow::Close
}{wxwindowclose
},
\rtfsp
1067 \helpref{wxWindow::OnCloseWindow
}{wxwindowonclosewindow
},
\rtfsp
1068 \helpref{wxCloseEvent
}{wxcloseevent
}
1070 \membersection{wxWindow::OnCloseWindow
}\label{wxwindowonclosewindow
}
1072 \func{void
}{OnCloseWindow
}{\param{wxCloseEvent\&
}{event
}}
1074 This is an event handler function called when the user has tried to close a a frame
1075 or dialog box using the window manager (X) or system menu (Windows). It is
1076 called via the
\helpref{wxWindow::Close
}{wxwindowclose
} function, so
1077 that the application can also invoke the handler programmatically.
1079 Use the EVT
\_CLOSE event table macro to handle close events.
1081 You should check whether the application is forcing the deletion of the window
1082 using
\helpref{wxCloseEvent::GetForce
}{wxcloseeventgetforce
}. If this is TRUE,
1083 destroy the window using
\helpref{wxWindow::Destroy
}{wxwindowdestroy
}.
1084 If not, it is up to you whether you respond by destroying the window.
1086 (Note: GetForce is now superceded by CanVeto. So to test whether forced destruction of
1087 the window is required, test for the negative of CanVeto. If CanVeto returns FALSE,
1088 it is not possible to skip window deletion.)
1090 If you don't destroy the window, you should call
\helpref{wxCloseEvent::Veto
}{wxcloseeventveto
} to
1091 let the calling code know that you did not destroy the window. This allows the
\helpref{wxWindow::Close
}{wxwindowclose
} function
1092 to return TRUE or FALSE depending on whether the close instruction was honoured or not.
1096 The
\helpref{wxWindow::OnClose
}{wxwindowonclose
} virtual function remains
1097 for backward compatibility with earlier versions of wxWindows. The
1098 default
{\bf OnCloseWindow
} handler for wxFrame and wxDialog will call
{\bf OnClose
},
1099 destroying the window if it returns TRUE or if the close is being forced.
1101 \wxheading{See also
}
1103 \helpref{Window deletion overview
}{windowdeletionoverview
},
\rtfsp
1104 \helpref{wxWindow::Close
}{wxwindowclose
},
\rtfsp
1105 \helpref{wxWindow::OnClose
}{wxwindowonclose
},
\rtfsp
1106 \helpref{wxWindow::Destroy
}{wxwindowdestroy
},
\rtfsp
1107 \helpref{wxCloseEvent
}{wxcloseevent
},
\rtfsp
1108 \helpref{wxApp::OnQueryEndSession
}{wxapponqueryendsession
},
\rtfsp
1109 \helpref{wxApp::OnEndSession
}{wxapponendsession
}
1111 \membersection{wxWindow::OnDropFiles
}\label{wxwindowondropfiles
}
1113 \func{void
}{OnDropFiles
}{\param{wxDropFilesEvent\&
}{ event
}}
1115 Called when files have been dragged from the file manager to the window.
1117 \wxheading{Parameters
}
1119 \docparam{event
}{Drop files event. For more information, see
\helpref{wxDropFilesEvent
}{wxdropfilesevent
}.
}
1123 The window must have previously been enabled for dropping by calling
1124 \rtfsp\helpref{wxWindow::DragAcceptFiles
}{wxwindowdragacceptfiles
}.
1126 This event is only generated under Windows.
1128 To intercept this event, use the EVT
\_DROP\_FILES macro in an event table definition.
1130 \wxheading{See also
}
1132 \helpref{wxDropFilesEvent
}{wxdropfilesevent
},
\helpref{wxWindow::DragAcceptFiles
}{wxwindowdragacceptfiles
},
\rtfsp
1133 \helpref{Event handling overview
}{eventhandlingoverview
}
1135 \membersection{wxWindow::OnEraseBackground
}\label{wxwindowonerasebackground
}
1137 \func{void
}{OnEraseBackground
}{\param{wxEraseEvent\&
}{ event
}}
1139 Called when the background of the window needs to be erased.
1141 \wxheading{Parameters
}
1143 \docparam{event
}{Erase background event. For more information, see
\helpref{wxEraseEvent
}{wxeraseevent
}.
}
1147 This event is only generated under Windows. It is therefore recommended that
1148 you set the text background colour explicitly in order to prevent flicker.
1149 The default background colour under GTK is grey.
1151 To intercept this event, use the EVT
\_ERASE\_BACKGROUND macro in an event table definition.
1153 \wxheading{See also
}
1155 \helpref{wxEraseEvent
}{wxeraseevent
},
\helpref{Event handling overview
}{eventhandlingoverview
}
1157 \membersection{wxWindow::OnKeyDown
}\label{wxwindowonkeydown
}
1159 \func{void
}{OnKeyDown
}{\param{wxKeyEvent\&
}{ event
}}
1161 Called when the user has pressed a key, before it is translated into an ASCII value using other
1162 modifier keys that might be pressed at the same time.
1164 \wxheading{Parameters
}
1166 \docparam{event
}{Object containing keypress information. See
\helpref{wxKeyEvent
}{wxkeyevent
} for
1167 details about this class.
}
1171 This member function is called in response to a key down event. To intercept this event,
1172 use the EVT
\_KEY\_DOWN macro in an event table definition. Your
{\bf OnKeyDown
} handler may call this
1173 default function to achieve default keypress functionality.
1175 Note that not all keypresses can be intercepted this way. If you wish to intercept special
1176 keys, such as shift, control, and function keys, then you will need to use
\helpref{wxWindow::OnKeyDown
}{wxwindowonkeydown
} or
1177 \helpref{wxWindow::OnKeyUp
}{wxwindowonkeyup
}.
1179 Most, but not all, windows allow keypresses to be intercepted.
1181 \wxheading{See also
}
1183 \helpref{wxWindow::OnChar
}{wxwindowonchar
},
\helpref{wxWindow::OnKeyUp
}{wxwindowonkeyup
},
\rtfsp
1184 \helpref{wxKeyEvent
}{wxkeyevent
},
\helpref{wxWindow::OnCharHook
}{wxwindowoncharhook
},
\rtfsp
1185 \helpref{Event handling overview
}{eventhandlingoverview
}
1187 \membersection{wxWindow::OnKeyUp
}\label{wxwindowonkeyup
}
1189 \func{void
}{OnKeyUp
}{\param{wxKeyEvent\&
}{ event
}}
1191 Called when the user has released a key.
1193 \wxheading{Parameters
}
1195 \docparam{event
}{Object containing keypress information. See
\helpref{wxKeyEvent
}{wxkeyevent
} for
1196 details about this class.
}
1200 This member function is called in response to a key up event. To intercept this event,
1201 use the EVT
\_KEY\_UP macro in an event table definition. Your
{\bf OnKeyUp
} handler may call this
1202 default function to achieve default keypress functionality.
1204 Note that not all keypresses can be intercepted this way. If you wish to intercept special
1205 keys, such as shift, control, and function keys, then you will need to use
\helpref{wxWindow::OnKeyDown
}{wxwindowonkeydown
} or
1206 \helpref{wxWindow::OnKeyUp
}{wxwindowonkeyup
}.
1208 Most, but not all, windows allow key up events to be intercepted.
1210 \wxheading{See also
}
1212 \helpref{wxWindow::OnChar
}{wxwindowonchar
},
\helpref{wxWindow::OnKeyDown
}{wxwindowonkeydown
},
\rtfsp
1213 \helpref{wxKeyEvent
}{wxkeyevent
},
\helpref{wxWindow::OnCharHook
}{wxwindowoncharhook
},
\rtfsp
1214 \helpref{Event handling overview
}{eventhandlingoverview
}
1216 \membersection{wxWindow::OnKillFocus
}\label{wxwindowonkillfocus
}
1218 \func{void
}{OnKillFocus
}{\param{wxFocusEvent\&
}{event
}}
1220 Called when a window's focus is being killed.
1222 \wxheading{Parameters
}
1224 \docparam{event
}{The focus event. For more information, see
\helpref{wxFocusEvent
}{wxfocusevent
}.
}
1228 To intercept this event, use the macro EVT
\_KILL\_FOCUS in an event table definition.
1230 Most, but not all, windows respond to this event.
1232 \wxheading{See also
}
1234 \helpref{wxFocusEvent
}{wxfocusevent
},
\helpref{wxWindow::OnSetFocus
}{wxwindowonsetfocus
},
\rtfsp
1235 \helpref{Event handling overview
}{eventhandlingoverview
}
1237 \membersection{wxWindow::OnIdle
}\label{wxwindowonidle
}
1239 \func{void
}{OnIdle
}{\param{wxIdleEvent\&
}{event
}}
1241 Provide this member function for any processing which needs to be done
1242 when the application is idle.
1244 \wxheading{See also
}
1246 \helpref{wxApp::OnIdle
}{wxapponidle
},
\helpref{wxIdleEvent
}{wxidleevent
}
1248 \membersection{wxWindow::OnInitDialog
}\label{wxwindowoninitdialog
}
1250 \func{void
}{OnInitDialog
}{\param{wxInitDialogEvent\&
}{ event
}}
1252 Default handler for the wxEVT
\_INIT\_DIALOG event. Calls
\helpref{wxWindow::TransferDataToWindow
}{wxwindowtransferdatatowindow
}.
1254 \wxheading{Parameters
}
1256 \docparam{event
}{Dialog initialisation event.
}
1260 Gives the window the default behaviour of transferring data to child controls via
1261 the validator that each control has.
1263 \wxheading{See also
}
1265 \helpref{wxValidator
}{wxvalidator
},
\helpref{wxWindow::TransferDataToWindow
}{wxwindowtransferdatatowindow
}
1267 \membersection{wxWindow::OnMenuCommand
}\label{wxwindowonmenucommand
}
1269 \func{void
}{OnMenuCommand
}{\param{wxCommandEvent\&
}{event
}}
1271 Called when a menu command is received from a menu bar.
1273 \wxheading{Parameters
}
1275 \docparam{event
}{The menu command event. For more information, see
\helpref{wxCommandEvent
}{wxcommandevent
}.
}
1279 A function with this name doesn't actually exist; you can choose any member function to receive
1280 menu command events, using the EVT
\_COMMAND macro for individual commands or EVT
\_COMMAND\_RANGE for
1281 a range of commands.
1283 \wxheading{See also
}
1285 \helpref{wxCommandEvent
}{wxcommandevent
},
\rtfsp
1286 \helpref{wxWindow::OnMenuHighlight
}{wxwindowonmenuhighlight
},
\rtfsp
1287 \helpref{Event handling overview
}{eventhandlingoverview
}
1289 \membersection{wxWindow::OnMenuHighlight
}\label{wxwindowonmenuhighlight
}
1291 \func{void
}{OnMenuHighlight
}{\param{wxMenuEvent\&
}{event
}}
1293 Called when a menu select is received from a menu bar: that is, the
1294 mouse cursor is over a menu item, but the left mouse button has not been
1297 \wxheading{Parameters
}
1299 \docparam{event
}{The menu highlight event. For more information, see
\helpref{wxMenuEvent
}{wxmenuevent
}.
}
1303 You can choose any member function to receive
1304 menu select events, using the EVT
\_MENU\_HIGHLIGHT macro for individual menu items or EVT
\_MENU\_HIGHLIGHT\_ALL macro
1307 The default implementation for
\helpref{wxFrame::OnMenuHighlight
}{wxframeonmenuhighlight
} displays help
1308 text in the first field of the status bar.
1310 This function was known as
{\bf OnMenuSelect
} in earlier versions of wxWindows, but this was confusing
1311 since a selection is normally a left-click action.
1313 \wxheading{See also
}
1315 \helpref{wxMenuEvent
}{wxmenuevent
},
\rtfsp
1316 \helpref{wxWindow::OnMenuCommand
}{wxwindowonmenucommand
},
\rtfsp
1317 \helpref{Event handling overview
}{eventhandlingoverview
}
1320 \membersection{wxWindow::OnMouseEvent
}\label{wxwindowonmouseevent
}
1322 \func{void
}{OnMouseEvent
}{\param{wxMouseEvent\&
}{ event
}}
1324 Called when the user has initiated an event with the
1327 \wxheading{Parameters
}
1329 \docparam{event
}{The mouse event. See
\helpref{wxMouseEvent
}{wxmouseevent
} for
1334 Most, but not all, windows respond to this event.
1336 To intercept this event, use the EVT
\_MOUSE\_EVENTS macro in an event table definition, or individual
1337 mouse event macros such as EVT
\_LEFT\_DOWN.
1339 \wxheading{See also
}
1341 \helpref{wxMouseEvent
}{wxmouseevent
},
\rtfsp
1342 \helpref{Event handling overview
}{eventhandlingoverview
}
1344 \membersection{wxWindow::OnMove
}\label{wxwindowonmove
}
1346 \func{void
}{OnMove
}{\param{wxMoveEvent\&
}{event
}}
1348 Called when a window is moved.
1350 \wxheading{Parameters
}
1352 \docparam{event
}{The move event. For more information, see
\helpref{wxMoveEvent
}{wxmoveevent
}.
}
1356 Use the EVT
\_MOVE macro to intercept move events.
1360 Not currently implemented.
1362 \wxheading{See also
}
1364 \helpref{wxMoveEvent
}{wxmoveevent
},
\rtfsp
1365 \helpref{wxFrame::OnSize
}{wxframeonsize
},
\rtfsp
1366 \helpref{Event handling overview
}{eventhandlingoverview
}
1368 \membersection{wxWindow::OnPaint
}\label{wxwindowonpaint
}
1370 \func{void
}{OnPaint
}{\param{wxPaintEvent\&
}{event
}}
1372 Sent to the event handler when the window must be refreshed.
1374 \wxheading{Parameters
}
1376 \docparam{event
}{Paint event. For more information, see
\helpref{wxPaintEvent
}{wxpaintevent
}.
}
1380 Use the EVT
\_PAINT macro in an event table definition to intercept paint events.
1382 In a paint event handler, the application should always create a
\helpref{wxPaintDC
}{wxpaintdc
} object.
1388 void MyWindow::OnPaint(wxPaintEvent\& event)
1397 You can optimize painting by retrieving the rectangles
1398 that have been damaged and only repainting these. The rectangles are in
1399 terms of the client area, and are unscrolled, so you will need to do
1400 some calculations using the current view position to obtain logical,
1403 Here is an example of using the
\helpref{wxRegionIterator
}{wxregioniterator
} class:
1407 // Called when window needs to be repainted.
1408 void MyWindow::OnPaint(wxPaintEvent\& event)
1412 // Find Out where the window is scrolled to
1413 int vbX,vbY; // Top left corner of client
1414 GetViewStart(&vbX,&vbY);
1416 int vX,vY,vW,vH; // Dimensions of client area in pixels
1417 wxRegionIterator upd(GetUpdateRegion()); // get the update rect list
1426 // Alternatively we can do this:
1428 // upd.GetRect(&rect);
1430 // Repaint this rectangle
1439 \wxheading{See also
}
1441 \helpref{wxPaintEvent
}{wxpaintevent
},
\rtfsp
1442 \helpref{wxPaintDC
}{wxpaintdc
},
\rtfsp
1443 \helpref{Event handling overview
}{eventhandlingoverview
}
1445 \membersection{wxWindow::OnScroll
}\label{wxwindowonscroll
}
1447 \func{void
}{OnScroll
}{\param{wxScrollWinEvent\&
}{event
}}
1449 Called when a scroll window event is received from one of the window's built-in scrollbars.
1451 \wxheading{Parameters
}
1453 \docparam{event
}{Command event. Retrieve the new scroll position by
1454 calling
\helpref{wxScrollEvent::GetPosition
}{wxscrolleventgetposition
}, and the
1455 scrollbar orientation by calling
\helpref{wxScrollEvent::GetOrientation
}{wxscrolleventgetorientation
}.
}
1459 Note that it is not possible to distinguish between horizontal and vertical scrollbars
1460 until the function is executing (you can't have one function for vertical, another
1461 for horizontal events).
1463 \wxheading{See also
}
1465 \helpref{wxScrollWinEvent
}{wxscrollwinevent
},
\rtfsp
1466 \helpref{Event handling overview
}{eventhandlingoverview
}
1468 \membersection{wxWindow::OnSetFocus
}\label{wxwindowonsetfocus
}
1470 \func{void
}{OnSetFocus
}{\param{wxFocusEvent\&
}{event
}}
1472 Called when a window's focus is being set.
1474 \wxheading{Parameters
}
1476 \docparam{event
}{The focus event. For more information, see
\helpref{wxFocusEvent
}{wxfocusevent
}.
}
1480 To intercept this event, use the macro EVT
\_SET\_FOCUS in an event table definition.
1482 Most, but not all, windows respond to this event.
1484 \wxheading{See also
}
1486 \helpref{wxFocusEvent
}{wxfocusevent
},
\helpref{wxWindow::OnKillFocus
}{wxwindowonkillfocus
},
\rtfsp
1487 \helpref{Event handling overview
}{eventhandlingoverview
}
1489 \membersection{wxWindow::OnSize
}\label{wxwindowonsize
}
1491 \func{void
}{OnSize
}{\param{wxSizeEvent\&
}{event
}}
1493 Called when the window has been resized.
1495 \wxheading{Parameters
}
1497 \docparam{event
}{Size event. For more information, see
\helpref{wxSizeEvent
}{wxsizeevent
}.
}
1501 You may wish to use this for frames to resize their child windows as appropriate.
1503 Note that the size passed is of
1504 the whole window: call
\helpref{wxWindow::GetClientSize
}{wxwindowgetclientsize
} for the area which may be
1505 used by the application.
1507 \wxheading{See also
}
1509 \helpref{wxSizeEvent
}{wxsizeevent
},
\rtfsp
1510 \helpref{Event handling overview
}{eventhandlingoverview
}
1512 \membersection{wxWindow::OnSysColourChanged
}\label{wxwindowonsyscolourchanged
}
1514 \func{void
}{OnSysColourChanged
}{\param{wxOnSysColourChangedEvent\&
}{event
}}
1516 Called when the user has changed the system colours. Windows only.
1518 \wxheading{Parameters
}
1520 \docparam{event
}{System colour change event. For more information, see
\helpref{wxSysColourChangedEvent
}{wxsyscolourchangedevent
}.
}
1522 \wxheading{See also
}
1524 \helpref{wxSysColourChangedEvent
}{wxsyscolourchangedevent
},
\rtfsp
1525 \helpref{Event handling overview
}{eventhandlingoverview
}
1527 \membersection{wxWindow::PopEventHandler
}\label{wxwindowpopeventhandler
}
1529 \constfunc{wxEvtHandler*
}{PopEventHandler
}{\param{bool
}{deleteHandler = FALSE
}}
1531 Removes and returns the top-most event handler on the event handler stack.
1533 \wxheading{Parameters
}
1535 \docparam{deleteHandler
}{If this is TRUE, the handler will be deleted after it is removed. The
1536 default value is FALSE.
}
1538 \wxheading{See also
}
1540 \helpref{wxWindow::SetEventHandler
}{wxwindowseteventhandler
},
\rtfsp
1541 \helpref{wxWindow::GetEventHandler
}{wxwindowgeteventhandler
},
\rtfsp
1542 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1543 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
1544 \helpref{wxEvtHandler
}{wxevthandler
}\rtfsp
1546 \membersection{wxWindow::PopupMenu
}\label{wxwindowpopupmenu
}
1548 \func{bool
}{PopupMenu
}{\param{wxMenu*
}{menu
},
\param{const wxPoint\&
}{pos
}}
1550 \func{bool
}{PopupMenu
}{\param{wxMenu*
}{menu
},
\param{int
}{x
},
\param{int
}{y
}}
1552 Pops up the given menu at the specified coordinates, relative to this
1553 window, and returns control when the user has dismissed the menu. If a
1554 menu item is selected, the corresponding menu event is generated and will be
1555 processed as usually.
1557 \wxheading{Parameters
}
1559 \docparam{menu
}{Menu to pop up.
}
1561 \docparam{pos
}{The position where the menu will appear.
}
1563 \docparam{x
}{Required x position for the menu to appear.
}
1565 \docparam{y
}{Required y position for the menu to appear.
}
1567 \wxheading{See also
}
1569 \helpref{wxMenu
}{wxmenu
}
1573 Just before the menu is popped up,
\helpref{wxMenu::UpdateUI
}{wxmenuupdateui
} is called
1574 to ensure that the menu items are in the correct state. The menu does not get deleted
1577 \pythonnote{In place of a single overloaded method name, wxPython
1578 implements the following methods:
\par
1579 \indented{2cm
}{\begin{twocollist
}
1580 \twocolitem{{\bf PopupMenu(menu, point)
}}{Specifies position with a wxPoint
}
1581 \twocolitem{{\bf PopupMenuXY(menu, x, y)
}}{Specifies position with two integers (x, y)
}
1585 \membersection{wxWindow::PushEventHandler
}\label{wxwindowpusheventhandler
}
1587 \func{void
}{PushEventHandler
}{\param{wxEvtHandler*
}{handler
}}
1589 Pushes this event handler onto the event stack for the window.
1591 \wxheading{Parameters
}
1593 \docparam{handler
}{Specifies the handler to be pushed.
}
1597 An event handler is an object that is capable of processing the events
1598 sent to a window. By default, the window is its own event handler, but
1599 an application may wish to substitute another, for example to allow
1600 central implementation of event-handling for a variety of different
1603 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
} allows
1604 an application to set up a chain of event handlers, where an event not handled by one event handler is
1605 handed to the next one in the chain. Use
\helpref{wxWindow::PopEventHandler
}{wxwindowpopeventhandler
} to
1606 remove the event handler.
1608 \wxheading{See also
}
1610 \helpref{wxWindow::SetEventHandler
}{wxwindowseteventhandler
},
\rtfsp
1611 \helpref{wxWindow::GetEventHandler
}{wxwindowgeteventhandler
},
\rtfsp
1612 \helpref{wxWindow::PopEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1613 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
1614 \helpref{wxEvtHandler
}{wxevthandler
}
1616 \membersection{wxWindow::Raise
}\label{wxwindowraise
}
1618 \func{void
}{Raise
}{\void}
1620 Raises the window to the top of the window hierarchy if it is a managed window (dialog
1623 \membersection{wxWindow::Refresh
}\label{wxwindowrefresh
}
1625 \func{virtual void
}{Refresh
}{\param{bool
}{ eraseBackground = TRUE
},
\param{const wxRect*
}{rect
1628 Causes a message or event to be generated to repaint the
1631 \wxheading{Parameters
}
1633 \docparam{eraseBackground
}{If TRUE, the background will be
1636 \docparam{rect
}{If non-NULL, only the given rectangle will
1637 be treated as damaged.
}
1639 \membersection{wxWindow::ReleaseMouse
}\label{wxwindowreleasemouse
}
1641 \func{virtual void
}{ReleaseMouse
}{\void}
1643 Releases mouse input captured with
\helpref{wxWindow::CaptureMouse
}{wxwindowcapturemouse
}.
1645 \wxheading{See also
}
1647 \helpref{wxWindow::CaptureMouse
}{wxwindowcapturemouse
}
1649 \membersection{wxWindow::RemoveChild
}\label{wxwindowremovechild
}
1651 \func{virtual void
}{RemoveChild
}{\param{wxWindow*
}{child
}}
1653 Removes a child window. This is called automatically by window deletion
1654 functions so should not be required by the application programmer.
1656 \wxheading{Parameters
}
1658 \docparam{child
}{Child window to remove.
}
1660 \membersection{wxWindow::Reparent
}\label{wxwindowreparent
}
1662 \func{virtual bool
}{Reparent
}{\param{wxWindow*
}{newParent
}}
1664 Reparents the window, i.e the window will be removed from its
1665 current parent window (e.g. a non-standard toolbar in a wxFrame)
1666 and then re-inserted into another (e.g. a wxMiniFrame for a
1667 floating toolbar). Available on Windows and GTK+.
1669 \wxheading{Parameters
}
1671 \docparam{newParent
}{New parent.
}
1673 \membersection{wxWindow::ScreenToClient
}\label{wxwindowscreentoclient
}
1675 \constfunc{virtual void
}{ScreenToClient
}{\param{int*
}{x
},
\param{int*
}{y
}}
1677 \constfunc{virtual wxPoint
}{ScreenToClient
}{\param{const wxPoint\&
}{pt
}}
1679 Converts from screen to client window coordinates.
1681 \wxheading{Parameters
}
1683 \docparam{x
}{Stores the screen x coordinate and receives the client x coordinate.
}
1685 \docparam{y
}{Stores the screen x coordinate and receives the client x coordinate.
}
1687 \docparam{pt
}{The screen position for the second form of the function.
}
1689 \pythonnote{In place of a single overloaded method name, wxPython
1690 implements the following methods:
\par
1691 \indented{2cm
}{\begin{twocollist
}
1692 \twocolitem{{\bf ScreenToClient(point)
}}{Accepts and returns a wxPoint
}
1693 \twocolitem{{\bf ScreenToClientXY(x, y)
}}{Returns a
2-tuple, (x, y)
}
1698 \membersection{wxWindow::ScrollWindow
}\label{wxwindowscrollwindow
}
1700 \func{virtual void
}{ScrollWindow
}{\param{int
}{dx
},
\param{int
}{dy
},
\param{const wxRect*
}{ rect = NULL
}}
1702 Physically scrolls the pixels in the window and move child windows accordingly.
1704 \wxheading{Parameters
}
1706 \docparam{dx
}{Amount to scroll horizontally.
}
1708 \docparam{dy
}{Amount to scroll vertically.
}
1710 \docparam{rect
}{Rectangle to invalidate. If this is NULL, the whole window is invalidated. If you
1711 pass a rectangle corresponding to the area of the window exposed by the scroll, your painting handler
1712 can optimise painting by checking for the invalidated region. This paramter is ignored under GTK,
1713 instead the regions to be invalidated are calculated automatically.
}
1717 Use this function to optimise your scrolling implementations, to minimise the area that must be
1718 redrawn. Note that it is rarely required to call this function from a user program.
1720 \membersection{wxWindow::SetAcceleratorTable
}\label{wxwindowsetacceleratortable
}
1722 \func{virtual void
}{SetAcceleratorTable
}{\param{const wxAcceleratorTable\&
}{ accel
}}
1724 Sets the accelerator table for this window. See
\helpref{wxAcceleratorTable
}{wxacceleratortable
}.
1726 \membersection{wxWindow::SetAutoLayout
}\label{wxwindowsetautolayout
}
1728 \func{void
}{SetAutoLayout
}{\param{bool
}{ autoLayout
}}
1730 Determines whether the
\helpref{wxWindow::Layout
}{wxwindowlayout
} function will
1731 be called automatically when the window is resized. Use in connection with
1732 \helpref{wxWindow::SetSizer
}{wxwindowsetsizer
} and
1733 \helpref{wxWindow::SetConstraints
}{wxwindowsetconstraints
} for layouting subwindows.
1735 \wxheading{Parameters
}
1737 \docparam{autoLayout
}{Set this to TRUE if you wish the Layout function to be called
1738 from within wxWindow::OnSize functions.
}
1742 Note that this function is actually disabled for wxWindow. It has
1743 effect for wxDialog, wxFrame, wxPanel and wxScrolledWindow. Windows
1744 of other types that need to invoke the Layout algorithm should provide
1745 an EVT
\_SIZE handler and call
1746 \helpref{wxWindow::Layout
}{wxwindowlayout
} from within it.
1748 \wxheading{See also
}
1750 \helpref{wxWindow::SetConstraints
}{wxwindowsetconstraints
}
1752 \membersection{wxWindow::SetBackgroundColour
}\label{wxwindowsetbackgroundcolour
}
1754 \func{virtual void
}{SetBackgroundColour
}{\param{const wxColour\&
}{colour
}}
1756 Sets the background colour of the window.
1758 \wxheading{Parameters
}
1760 \docparam{colour
}{The colour to be used as the background colour.
}
1764 The background colour is usually painted by the default
\rtfsp
1765 \helpref{wxWindow::OnEraseBackground
}{wxwindowonerasebackground
} event handler function
1766 under Windows and automatically under GTK.
1768 Note that setting the background colour does not cause an immediate refresh, so you
1769 may wish to call
\helpref{wxWindow::Clear
}{wxwindowclear
} or
\helpref{wxWindow::Refresh
}{wxwindowrefresh
} after
1770 calling this function.
1772 Note that when using this functions under GTK, you will disable the so called "themes",
1773 i.e. the user chosen apperance of windows and controls, including the themes of
1774 their parent windows.
1776 \wxheading{See also
}
1778 \helpref{wxWindow::GetBackgroundColour
}{wxwindowgetbackgroundcolour
},
\rtfsp
1779 \helpref{wxWindow::SetForegroundColour
}{wxwindowsetforegroundcolour
},
\rtfsp
1780 \helpref{wxWindow::GetForegroundColour
}{wxwindowgetforegroundcolour
},
\rtfsp
1781 \helpref{wxWindow::Clear
}{wxwindowclear
},
\rtfsp
1782 \helpref{wxWindow::Refresh
}{wxwindowrefresh
},
\rtfsp
1783 \helpref{wxWindow::OnEraseBackground
}{wxwindowonerasebackground
}
1785 \membersection{wxWindow::SetClientSize
}\label{wxwindowsetclientsize
}
1787 \func{virtual void
}{SetClientSize
}{\param{int
}{ width
},
\param{int
}{ height
}}
1789 \func{virtual void
}{SetClientSize
}{\param{const wxSize\&
}{ size
}}
1791 This sets the size of the window client area in pixels. Using this function to size a window
1792 tends to be more device-independent than
\helpref{wxWindow::SetSize
}{wxwindowsetsize
}, since the application need not
1793 worry about what dimensions the border or title bar have when trying to fit the window
1794 around panel items, for example.
1796 \wxheading{Parameters
}
1798 \docparam{width
}{The required client area width.
}
1800 \docparam{height
}{The required client area height.
}
1802 \docparam{size
}{The required client size.
}
1804 \pythonnote{In place of a single overloaded method name, wxPython
1805 implements the following methods:
\par
1806 \indented{2cm
}{\begin{twocollist
}
1807 \twocolitem{{\bf SetClientSize(size)
}}{Accepts a wxSize
}
1808 \twocolitem{{\bf SetClientSizeWH(width, height)
}}{}
1812 \membersection{wxWindow::SetCursor
}\label{wxwindowsetcursor
}
1814 \func{virtual void
}{SetCursor
}{\param{const wxCursor\&
}{cursor
}}
1816 Sets the window's cursor. Notice that setting the cursor for this window does
1817 not set it for its children so you'll need to explicitly call SetCursor() for
1818 them too if you need it.
1820 \wxheading{Parameters
}
1822 \docparam{cursor
}{Specifies the cursor that the window should normally display.
}
1824 \wxheading{See also
}
1826 \helpref{::wxSetCursor
}{wxsetcursor
},
\helpref{wxCursor
}{wxcursor
}
1828 \membersection{wxWindow::SetEventHandler
}\label{wxwindowseteventhandler
}
1830 \func{void
}{SetEventHandler
}{\param{wxEvtHandler*
}{handler
}}
1832 Sets the event handler for this window.
1834 \wxheading{Parameters
}
1836 \docparam{handler
}{Specifies the handler to be set.
}
1840 An event handler is an object that is capable of processing the events
1841 sent to a window. By default, the window is its own event handler, but
1842 an application may wish to substitute another, for example to allow
1843 central implementation of event-handling for a variety of different
1846 It is usually better to use
\helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
} since
1847 this sets up a chain of event handlers, where an event not handled by one event handler is
1848 handed to the next one in the chain.
1850 \wxheading{See also
}
1852 \helpref{wxWindow::GetEventHandler
}{wxwindowgeteventhandler
},
\rtfsp
1853 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1854 \helpref{wxWindow::PopEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1855 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
1856 \helpref{wxEvtHandler
}{wxevthandler
}
1858 \membersection{wxWindow::SetConstraints
}\label{wxwindowsetconstraints
}
1860 \func{void
}{SetConstraints
}{\param{wxLayoutConstraints*
}{constraints
}}
1862 Sets the window to have the given layout constraints. The window
1863 will then own the object, and will take care of its deletion.
1864 If an existing layout constraints object is already owned by the
1865 window, it will be deleted.
1867 \wxheading{Parameters
}
1869 \docparam{constraints
}{The constraints to set. Pass NULL to disassociate and delete the window's
1874 You must call
\helpref{wxWindow::SetAutoLayout
}{wxwindowsetautolayout
} to tell a window to use
1875 the constraints automatically in OnSize; otherwise, you must override OnSize and call Layout()
1876 explicitly. When setting both a wxLayoutConstraints and a
\helpref{wxSizer
}{wxsizer
}, only the
1877 sizer will have effect.
1879 \membersection{wxWindow::SetDropTarget
}\label{wxwindowsetdroptarget
}
1881 \func{void
}{SetDropTarget
}{\param{wxDropTarget*
}{ target
}}
1883 Associates a drop target with this window.
1885 If the window already has a drop target, it is deleted.
1887 \wxheading{See also
}
1889 \helpref{wxWindow::GetDropTarget
}{wxwindowgetdroptarget
},
1890 \helpref{Drag and drop overview
}{wxdndoverview
}
1892 \membersection{wxWindow::SetExtraStyle
}\label{wxwindowsetextrastyle
}
1894 \func{void
}{SetExtraStyle
}{\param{long
}{exStyle
}}
1896 Sets the extra style bits for the window. The currently defined extra style
1900 \begin{twocollist
}\itemsep=
0pt
1901 \twocolitem{\windowstyle{wxWS
\_EX\_VALIDATE\_RECURSIVELY}}{TransferDataTo/FromWindow()
1902 and Validate() methods will recursively descend into all children of the
1903 window if it has this style flag set.
}
1906 \membersection{wxWindow::SetFocus
}\label{wxwindowsetfocus
}
1908 \func{virtual void
}{SetFocus
}{\void}
1910 This sets the window to receive keyboard input.
1912 \membersection{wxWindow::SetFont
}\label{wxwindowsetfont
}
1914 \func{void
}{SetFont
}{\param{const wxFont\&
}{font
}}
1916 Sets the font for this window.
1918 \wxheading{Parameters
}
1920 \docparam{font
}{Font to associate with this window.
}
1922 \wxheading{See also
}
1924 \helpref{wxWindow::GetFont
}{wxwindowgetfont
}
1926 \membersection{wxWindow::SetForegroundColour
}\label{wxwindowsetforegroundcolour
}
1928 \func{virtual void
}{SetForegroundColour
}{\param{const wxColour\&
}{colour
}}
1930 Sets the foreground colour of the window.
1932 \wxheading{Parameters
}
1934 \docparam{colour
}{The colour to be used as the foreground colour.
}
1938 The interpretation of foreground colour is open to interpretation according
1939 to the window class; it may be the text colour or other colour, or it may not
1942 Note that when using this functions under GTK, you will disable the so called "themes",
1943 i.e. the user chosen apperance of windows and controls, including the themes of
1944 their parent windows.
1946 \wxheading{See also
}
1948 \helpref{wxWindow::GetForegroundColour
}{wxwindowgetforegroundcolour
},
\rtfsp
1949 \helpref{wxWindow::SetBackgroundColour
}{wxwindowsetbackgroundcolour
},
\rtfsp
1950 \helpref{wxWindow::GetBackgroundColour
}{wxwindowgetbackgroundcolour
}
1952 \membersection{wxWindow::SetId
}\label{wxwindowsetid
}
1954 \func{void
}{SetId
}{\param{int
}{ id
}}
1956 Sets the identifier of the window.
1960 Each window has an integer identifier. If the application has not provided one,
1961 an identifier will be generated. Normally, the identifier should be provided
1962 on creation and should not be modified subsequently.
1964 \wxheading{See also
}
1966 \helpref{wxWindow::GetId
}{wxwindowgetid
},
\rtfsp
1967 \helpref{Window identifiers
}{windowids
}
1969 \membersection{wxWindow::SetName
}\label{wxwindowsetname
}
1971 \func{virtual void
}{SetName
}{\param{const wxString\&
}{name
}}
1973 Sets the window's name.
1975 \wxheading{Parameters
}
1977 \docparam{name
}{A name to set for the window.
}
1979 \wxheading{See also
}
1981 \helpref{wxWindow::GetName
}{wxwindowgetname
}
1983 \membersection{wxWindow::SetPalette
}\label{wxwindowsetpalette
}
1985 \func{virtual void
}{SetPalette
}{\param{wxPalette*
}{palette
}}
1987 Obsolete - use
\helpref{wxDC::SetPalette
}{wxdcsetpalette
} instead.
1989 \membersection{wxWindow::SetScrollbar
}\label{wxwindowsetscrollbar
}
1991 \func{virtual void
}{SetScrollbar
}{\param{int
}{orientation
},
\param{int
}{position
},
\rtfsp
1992 \param{int
}{thumbSize
},
\param{int
}{range
},
\rtfsp
1993 \param{bool
}{refresh = TRUE
}}
1995 Sets the scrollbar properties of a built-in scrollbar.
1997 \wxheading{Parameters
}
1999 \docparam{orientation
}{Determines the scrollbar whose page size is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
2001 \docparam{position
}{The position of the scrollbar in scroll units.
}
2003 \docparam{thumbSize
}{The size of the thumb, or visible portion of the scrollbar, in scroll units.
}
2005 \docparam{range
}{The maximum position of the scrollbar.
}
2007 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
2011 Let's say you wish to display
50 lines of text, using the same font.
2012 The window is sized so that you can only see
16 lines at a time.
2018 SetScrollbar(wxVERTICAL,
0,
16,
50);
2022 Note that with the window at this size, the thumb position can never go
2023 above
50 minus
16, or
34.
2025 You can determine how many lines are currently visible by dividing the current view
2026 size by the character height in pixels.
2028 When defining your own scrollbar behaviour, you will always need to recalculate
2029 the scrollbar settings when the window size changes. You could therefore put your
2030 scrollbar calculations and SetScrollbar
2031 call into a function named AdjustScrollbars, which can be called initially and also
2032 from your
\helpref{wxWindow::OnSize
}{wxwindowonsize
} event handler function.
2034 \wxheading{See also
}
2036 \helpref{Scrolling overview
}{scrollingoverview
},
\rtfsp
2037 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
2040 \membersection{wxWindow::SetScrollPage
}\label{wxwindowsetscrollpage
}
2042 \func{virtual void
}{SetScrollPage
}{\param{int
}{orientation
},
\param{int
}{pageSize
},
\param{bool
}{refresh = TRUE
}}
2044 Sets the page size of one of the built-in scrollbars.
2046 \wxheading{Parameters
}
2048 \docparam{orientation
}{Determines the scrollbar whose page size is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
2050 \docparam{pageSize
}{Page size in scroll units.
}
2052 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
2056 The page size of a scrollbar is the number of scroll units that the scroll thumb travels when you
2057 click on the area above/left of or below/right of the thumb. Normally you will want a whole visible
2058 page to be scrolled, i.e. the size of the current view (perhaps the window client size). This
2059 value has to be adjusted when the window is resized, since the page size will have changed.
2061 In addition to specifying how far the scroll thumb travels when paging, in Motif and some versions of Windows
2062 the thumb changes size to reflect the page size relative to the length of the
document. When the
2063 document size is only slightly bigger than the current view (window) size, almost all of the scrollbar
2064 will be taken up by the thumb. When the two values become the same, the scrollbar will (on some systems)
2067 Currently, this function should be called before SetPageRange, because of a quirk in the Windows
2068 handling of pages and ranges.
2070 \wxheading{See also
}
2072 \helpref{wxWindow::SetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
2073 \helpref{wxWindow::GetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
2074 \helpref{wxWindow::GetScrollPage
}{wxwindowsetscrollpage
},
\rtfsp
2075 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
2078 \membersection{wxWindow::SetScrollPos
}\label{wxwindowsetscrollpos
}
2080 \func{virtual void
}{SetScrollPos
}{\param{int
}{orientation
},
\param{int
}{pos
},
\param{bool
}{refresh = TRUE
}}
2082 Sets the position of one of the built-in scrollbars.
2084 \wxheading{Parameters
}
2086 \docparam{orientation
}{Determines the scrollbar whose position is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
2088 \docparam{pos
}{Position in scroll units.
}
2090 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
2094 This function does not directly affect the contents of the window: it is up to the
2095 application to take note of scrollbar attributes and redraw contents accordingly.
2097 \wxheading{See also
}
2099 \helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
},
\rtfsp
2100 \helpref{wxWindow::GetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
2101 \helpref{wxWindow::GetScrollThumb
}{wxwindowgetscrollthumb
},
\rtfsp
2102 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
2105 \membersection{wxWindow::SetScrollRange
}\label{wxwindowsetscrollrange
}
2107 \func{virtual void
}{SetScrollRange
}{\param{int
}{orientation
},
\param{int
}{range
},
\param{bool
}{refresh = TRUE
}}
2109 Sets the range of one of the built-in scrollbars.
2111 \wxheading{Parameters
}
2113 \docparam{orientation
}{Determines the scrollbar whose range is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
2115 \docparam{range
}{Scroll range.
}
2117 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
2121 The range of a scrollbar is the number of steps that the thumb may travel, rather than the total
2122 object length of the scrollbar. If you are implementing a scrolling window, for example, you
2123 would adjust the scroll range when the window is resized, by subtracting the window view size from the
2124 total virtual window size. When the two sizes are the same (all the window is visible), the range goes to zero
2125 and usually the scrollbar will be automatically hidden.
2127 \wxheading{See also
}
2129 \helpref{wxWindow::SetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
2130 \helpref{wxWindow::SetScrollPage
}{wxwindowsetscrollpage
},
\rtfsp
2131 \helpref{wxWindow::GetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
2132 \helpref{wxWindow::GetScrollPage
}{wxwindowsetscrollpage
},
\rtfsp
2133 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
2136 \membersection{wxWindow::SetSize
}\label{wxwindowsetsize
}
2138 \func{virtual void
}{SetSize
}{\param{int
}{ x
},
\param{int
}{ y
},
\param{int
}{ width
},
\param{int
}{ height
},
2139 \param{int
}{ sizeFlags = wxSIZE
\_AUTO}}
2141 \func{virtual void
}{SetSize
}{\param{const wxRect\&
}{ rect
}}
2143 Sets the size and position of the window in pixels.
2145 \func{virtual void
}{SetSize
}{\param{int
}{ width
},
\param{int
}{ height
}}
2147 \func{virtual void
}{SetSize
}{\param{const wxSize\&
}{ size
}}
2149 Sets the size of the window in pixels.
2151 \wxheading{Parameters
}
2153 \docparam{x
}{Required x position in pixels, or -
1 to indicate that the existing
2154 value should be used.
}
2156 \docparam{y
}{Required y position in pixels, or -
1 to indicate that the existing
2157 value should be used.
}
2159 \docparam{width
}{Required width in pixels, or -
1 to indicate that the existing
2160 value should be used.
}
2162 \docparam{height
}{Required height position in pixels, or -
1 to indicate that the existing
2163 value should be used.
}
2165 \docparam{size
}{\helpref{wxSize
}{wxsize
} object for setting the size.
}
2167 \docparam{rect
}{\helpref{wxRect
}{wxrect
} object for setting the position and size.
}
2169 \docparam{sizeFlags
}{Indicates the interpretation of other parameters. It is a bit list of the following:
2171 {\bf wxSIZE
\_AUTO\_WIDTH}: a -
1 width value is taken to indicate
2172 a wxWindows-supplied default width.\\
2173 {\bf wxSIZE
\_AUTO\_HEIGHT}: a -
1 height value is taken to indicate
2174 a wxWindows-supplied default width.\\
2175 {\bf wxSIZE
\_AUTO}: -
1 size values are taken to indicate
2176 a wxWindows-supplied default size.\\
2177 {\bf wxSIZE
\_USE\_EXISTING}: existing dimensions should be used
2178 if -
1 values are supplied.\\
2179 {\bf wxSIZE
\_ALLOW\_MINUS\_ONE}: allow dimensions of -
1 and less to be interpreted
2180 as real dimensions, not default values.
2185 The second form is a convenience for calling the first form with default
2186 x and y parameters, and must be used with non-default width and height values.
2188 The first form sets the position and optionally size, of the window.
2189 Parameters may be -
1 to indicate either that a default should be supplied
2190 by wxWindows, or that the current value of the dimension should be used.
2192 \wxheading{See also
}
2194 \helpref{wxWindow::Move
}{wxwindowmove
}
2196 \pythonnote{In place of a single overloaded method name, wxPython
2197 implements the following methods:
\par
2198 \indented{2cm
}{\begin{twocollist
}
2199 \twocolitem{{\bf SetDimensions(x, y, width, height, sizeFlags=wxSIZE
\_AUTO)
}}{}
2200 \twocolitem{{\bf SetSize(size)
}}{}
2201 \twocolitem{{\bf SetPosition(point)
}}{}
2205 \membersection{wxWindow::SetSizeHints
}\label{wxwindowsetsizehints
}
2207 \func{virtual void
}{SetSizeHints
}{\param{int
}{ minW=-
1},
\param{int
}{ minH=-
1},
\param{int
}{ maxW=-
1},
\param{int
}{ maxH=-
1},
2208 \param{int
}{ incW=-
1},
\param{int
}{ incH=-
1}}
2210 Allows specification of minimum and maximum window sizes, and window size increments.
2211 If a pair of values is not set (or set to -
1), the default values will be used.
2213 \wxheading{Parameters
}
2215 \docparam{minW
}{Specifies the minimum width allowable.
}
2217 \docparam{minH
}{Specifies the minimum height allowable.
}
2219 \docparam{maxW
}{Specifies the maximum width allowable.
}
2221 \docparam{maxH
}{Specifies the maximum height allowable.
}
2223 \docparam{incW
}{Specifies the increment for sizing the width (Motif/Xt only).
}
2225 \docparam{incH
}{Specifies the increment for sizing the height (Motif/Xt only).
}
2229 If this function is called, the user will not be able to size the window outside the
2232 The resizing increments are only significant under Motif or Xt.
2234 \membersection{wxWindow::SetSizer
}\label{wxwindowsetsizer
}
2236 \func{void
}{SetSizer
}{\param{wxSizer*
}{sizer
}}
2238 Sets the window to have the given layout sizer. The window
2239 will then own the object, and will take care of its deletion.
2240 If an existing layout constraints object is already owned by the
2241 window, it will be deleted.
2243 \wxheading{Parameters
}
2245 \docparam{sizer
}{The sizer to set. Pass NULL to disassociate and delete the window's
2250 You must call
\helpref{wxWindow::SetAutoLayout
}{wxwindowsetautolayout
} to tell a window to use
2251 the sizer automatically in OnSize; otherwise, you must override OnSize and call Layout()
2252 explicitly. When setting both a wxSizer and a
\helpref{wxLayoutConstraints
}{wxlayoutconstraints
},
2253 only the sizer will have effect.
2255 \membersection{wxWindow::SetTitle
}\label{wxwindowsettitle
}
2257 \func{virtual void
}{SetTitle
}{\param{const wxString\&
}{title
}}
2259 Sets the window's title. Applicable only to frames and dialogs.
2261 \wxheading{Parameters
}
2263 \docparam{title
}{The window's title.
}
2265 \wxheading{See also
}
2267 \helpref{wxWindow::GetTitle
}{wxwindowgettitle
}
2269 \membersection{wxWindow::SetValidator
}\label{wxwindowsetvalidator
}
2271 \func{virtual void
}{SetValidator
}{\param{const wxValidator\&
}{ validator
}}
2273 Deletes the current validator (if any) and sets the window validator, having called wxValidator::Clone to
2274 create a new validator of this type.
2276 \membersection{wxWindow::SetWindowStyleFlag
}\label{wxwindowsetwindowstyleflag
}
2278 \func{virtual void
}{SetWindowStyleFlag
}{\param{long
}{ style
}}
2280 \membersection{wxWindow::SetWindowStyle
}\label{wxwindowsetwindowstyle
}
2282 \func{void
}{SetWindowStyle
}{\param{long
}{ style
}}
2284 Identical to
\helpref{SetWindowStyleFlag
}{wxwindowsetwindowstyleflag
}.
2286 \membersection{wxWindow::SetWindowStyleFlag
}\label{wxwindowsetwindowstyleflag
}
2288 \func{virtual void
}{SetWindowStyleFlag
}{\param{long
}{ style
}}
2290 Sets the style of the window. Please note that some styles cannot be changed
2291 after the window creation and that
\helpref{Refresh()
}{wxwindowrefresh
} might
2292 be called after changing the others for the change to take place immediately.
2294 See
\helpref{Windowstyles
}{windowstyles
} for more information about flags.
2296 \wxheading{See also
}
2298 \helpref{GetWindowStyleFlag
}{wxwindowgetwindowstyleflag
}
2300 \membersection{wxWindow::Show
}\label{wxwindowshow
}
2302 \func{virtual bool
}{Show
}{\param{bool
}{ show
}}
2304 Shows or hides the window.
2306 \wxheading{Parameters
}
2308 \docparam{show
}{If TRUE, displays the window and brings it to the front. Otherwise,
2311 \wxheading{See also
}
2313 \helpref{wxWindow::IsShown
}{wxwindowisshown
}
2315 \membersection{wxWindow::TransferDataFromWindow
}\label{wxwindowtransferdatafromwindow
}
2317 \func{virtual bool
}{TransferDataFromWindow
}{\void}
2319 Transfers values from child controls to data areas specified by their validators. Returns
2320 FALSE if a transfer failed.
2322 If the window has
{\tt wxWS
\_EX\_VALIDATE\_RECURSIVELY} extra style flag set,
2323 the method will also call TransferDataFromWindow() of all child windows.
2325 \wxheading{See also
}
2327 \helpref{wxWindow::TransferDataToWindow
}{wxwindowtransferdatatowindow
},
\rtfsp
2328 \helpref{wxValidator
}{wxvalidator
},
\helpref{wxWindow::Validate
}{wxwindowvalidate
}
2330 \membersection{wxWindow::TransferDataToWindow
}\label{wxwindowtransferdatatowindow
}
2332 \func{virtual bool
}{TransferDataToWindow
}{\void}
2334 Transfers values to child controls from data areas specified by their validators.
2336 If the window has
{\tt wxWS
\_EX\_VALIDATE\_RECURSIVELY} extra style flag set,
2337 the method will also call TransferDataToWindow() of all child windows.
2339 \wxheading{Return value
}
2341 Returns FALSE if a transfer failed.
2343 \wxheading{See also
}
2345 \helpref{wxWindow::TransferDataFromWindow
}{wxwindowtransferdatafromwindow
},
\rtfsp
2346 \helpref{wxValidator
}{wxvalidator
},
\helpref{wxWindow::Validate
}{wxwindowvalidate
}
2348 \membersection{wxWindow::Validate
}\label{wxwindowvalidate
}
2350 \func{virtual bool
}{Validate
}{\void}
2352 Validates the current values of the child controls using their validators.
2354 If the window has
{\tt wxWS
\_EX\_VALIDATE\_RECURSIVELY} extra style flag set,
2355 the method will also call Validate() of all child windows.
2357 \wxheading{Return value
}
2359 Returns FALSE if any of the validations failed.
2361 \wxheading{See also
}
2363 \helpref{wxWindow::TransferDataFromWindow
}{wxwindowtransferdatafromwindow
},
\rtfsp
2364 \helpref{wxWindow::TransferDataFromWindow
}{wxwindowtransferdatafromwindow
},
\rtfsp
2365 \helpref{wxValidator
}{wxvalidator
}
2367 \membersection{wxWindow::WarpPointer
}\label{wxwindowwarppointer
}
2369 \func{void
}{WarpPointer
}{\param{int
}{ x
},
\param{int
}{ y
}}
2371 Moves the pointer to the given position on the window.
2373 \wxheading{Parameters
}
2375 \docparam{x
}{The new x position for the cursor.
}
2377 \docparam{y
}{The new y position for the cursor.
}