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{const 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{const 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{const 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.
435 \membersection{wxWindow::GetBackgroundColour
}\label{wxwindowgetbackgroundcolour
}
437 \constfunc{virtual wxColour
}{GetBackgroundColour
}{\void}
439 Returns the background colour of the window.
443 \helpref{wxWindow::SetBackgroundColour
}{wxwindowsetbackgroundcolour
},
\rtfsp
444 \helpref{wxWindow::SetForegroundColour
}{wxwindowsetforegroundcolour
},
\rtfsp
445 \helpref{wxWindow::GetForegroundColour
}{wxwindowgetforegroundcolour
},
\rtfsp
446 \helpref{wxWindow::OnEraseBackground
}{wxwindowonerasebackground
}
448 \membersection{wxWindow::GetCharHeight
}
450 \constfunc{virtual int
}{GetCharHeight
}{\void}
452 Returns the character height for this window.
454 \membersection{wxWindow::GetCharWidth
}
456 \constfunc{virtual int
}{GetCharWidth
}{\void}
458 Returns the average character width for this window.
460 \membersection{wxWindow::GetChildren
}
462 \func{wxList\&
}{GetChildren
}{\void}
464 Returns a reference to the list of the window's children.
466 \membersection{wxWindow::GetClientSize
}\label{wxwindowgetclientsize
}
468 \constfunc{virtual void
}{GetClientSize
}{\param{int*
}{width
},
\param{int*
}{height
}}
470 \constfunc{virtual wxSize
}{GetClientSize
}{\void}
472 This gets the size of the window `client area' in pixels. The client area is the
473 area which may be drawn on by the programmer, excluding title bar, border etc.
475 \wxheading{Parameters
}
477 \docparam{width
}{Receives the client width in pixels.
}
479 \docparam{height
}{Receives the client height in pixels.
}
481 \pythonnote{In place of a single overloaded method name, wxPython
482 implements the following methods:
\par
483 \indented{2cm
}{\begin{twocollist
}
484 \twocolitem{\bf{wxGetClientSizeTuple()
}}{Returns a
2-tuple of (width, height)
}
485 \twocolitem{\bf{wxGetClientSize()
}}{Returns a wxSize object
}
489 \membersection{wxWindow::GetConstraints
}\label{wxwindowgetconstraints
}
491 \constfunc{wxLayoutConstraints*
}{GetConstraints
}{\void}
493 Returns a pointer to the window's layout constraints, or NULL if there are none.
495 \membersection{wxWindow::GetDefaultItem
}\label{wxwindowgetdefaultitem
}
497 \constfunc{wxButton*
}{GetDefaultItem
}{\void}
499 Returns a pointer to the button which is the default for this window, or NULL.
501 \membersection{wxWindow::GetDropTarget
}\label{wxwindowgetdroptarget
}
503 \constfunc{wxDropTarget*
}{GetDropTarget
}{\void}
505 Returns the associated drop target, which may be NULL.
509 \helpref{wxWindow::SetDropTarget
}{wxwindowsetdroptarget
},
510 \helpref{Drag and drop overview
}{wxdndoverview
}
512 \membersection{wxWindow::GetEventHandler
}\label{wxwindowgeteventhandler
}
514 \constfunc{wxEvtHandler*
}{GetEventHandler
}{\void}
516 Returns the event handler for this window. By default, the window is its
521 \helpref{wxWindow::SetEventHandler
}{wxwindowseteventhandler
},
\rtfsp
522 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
523 \helpref{wxWindow::PopEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
524 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
525 \helpref{wxEvtHandler
}{wxevthandler
}\rtfsp
527 \membersection{wxWindow::GetFont
}\label{wxwindowgetfont
}
529 \constfunc{wxFont\&
}{GetFont
}{\void}
531 Returns a reference to the font for this window.
535 \helpref{wxWindow::SetFont
}{wxwindowsetfont
}
537 \membersection{wxWindow::GetForegroundColour
}\label{wxwindowgetforegroundcolour
}
539 \func{virtual wxColour
}{GetForegroundColour
}{\void}
541 Returns the foreground colour of the window.
545 The interpretation of foreground colour is open to interpretation according
546 to the window class; it may be the text colour or other colour, or it may not
551 \helpref{wxWindow::SetForegroundColour
}{wxwindowsetforegroundcolour
},
\rtfsp
552 \helpref{wxWindow::SetBackgroundColour
}{wxwindowsetbackgroundcolour
},
\rtfsp
553 \helpref{wxWindow::GetBackgroundColour
}{wxwindowgetbackgroundcolour
}
555 \membersection{wxWindow::GetGrandParent
}
557 \constfunc{wxWindow*
}{GetGrandParent
}{\void}
559 Returns the grandparent of a window, or NULL if there isn't one.
561 \membersection{wxWindow::GetHandle
}
563 \constfunc{void*
}{GetHandle
}{\void}
565 Returns the platform-specific handle of the physical window. Cast it to an appropriate
566 handle, such as
{\bf HWND
} for Windows,
{\bf Widget
} for Motif or
{\bf GtkWidget
} for GTK.
568 \pythonnote{This method will return an integer in wxPython.
}
570 \membersection{wxWindow::GetId
}\label{wxwindowgetid
}
572 \constfunc{int
}{GetId
}{\void}
574 Returns the identifier of the window.
578 Each window has an integer identifier. If the application has not provided one
579 (or the default Id -
1) an unique identifier with a negative value will be generated.
583 \helpref{wxWindow::SetId
}{wxwindowsetid
}\rtfsp
584 \helpref{Window identifiers
}{windowids
}
586 \membersection{wxWindow::GetPosition
}
588 \constfunc{virtual void
}{GetPosition
}{\param{int*
}{x
},
\param{int*
}{y
}}
590 This gets the position of the window in pixels, relative to the parent window or
591 if no parent, relative to the whole display.
593 \wxheading{Parameters
}
595 \docparam{x
}{Receives the x position of the window.
}
597 \docparam{y
}{Receives the y position of the window.
}
599 \pythonnote{In place of a single overloaded method name, wxPython
600 implements the following methods:
\par
601 \indented{2cm
}{\begin{twocollist
}
602 \twocolitem{\bf{GetPosition()
}}{Returns a wxPoint
}
603 \twocolitem{\bf{GetPositionTuple()
}}{Returns a tuple (x, y)
}
607 \membersection{wxWindow::GetLabel
}
609 \constfunc{virtual wxString
}{GetLabel
}{\void}
611 Generic way of getting a label from any window, for
612 identification purposes.
616 The interpretation of this function differs from class to class.
617 For frames and dialogs, the value returned is the title. For buttons or static text controls, it is
618 the button text. This function can be useful for meta-programs (such as testing
619 tools or special-needs access programs) which need to identify windows
622 \membersection{wxWindow::GetName
}\label{wxwindowgetname
}
624 \constfunc{virtual wxString
}{GetName
}{\void}
626 Returns the window's name.
630 This name is not guaranteed to be unique; it is up to the programmer to supply an appropriate
631 name in the window constructor or via
\helpref{wxWindow::SetName
}{wxwindowsetname
}.
635 \helpref{wxWindow::SetName
}{wxwindowsetname
}
637 \membersection{wxWindow::GetParent
}
639 \constfunc{virtual wxWindow*
}{GetParent
}{\void}
641 Returns the parent of the window, or NULL if there is no parent.
643 \membersection{wxWindow::GetRect
}\label{wxwindowgetrect
}
645 \constfunc{virtual wxRect
}{GetRect
}{\void}
647 Returns the size and position of the window as a
\helpref{wxRect
}{wxrect
} object.
649 \membersection{wxWindow::GetScrollThumb
}\label{wxwindowgetscrollthumb
}
651 \func{virtual int
}{GetScrollThumb
}{\param{int
}{orientation
}}
653 Returns the built-in scrollbar thumb size.
657 \helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
}
659 \membersection{wxWindow::GetScrollPos
}\label{wxwindowgetscrollpos
}
661 \func{virtual int
}{GetScrollPos
}{\param{int
}{orientation
}}
663 Returns the built-in scrollbar position.
667 See
\helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
}
669 \membersection{wxWindow::GetScrollRange
}\label{wxwindowgetscrollrange
}
671 \func{virtual int
}{GetScrollRange
}{\param{int
}{orientation
}}
673 Returns the built-in scrollbar range.
677 \helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
}
679 \membersection{wxWindow::GetSize
}\label{wxwindowgetsize
}
681 \constfunc{virtual void
}{GetSize
}{\param{int*
}{width
},
\param{int*
}{height
}}
683 \constfunc{virtual wxSize
}{GetSize
}{\void}
685 This gets the size of the entire window in pixels.
687 \wxheading{Parameters
}
689 \docparam{width
}{Receives the window width.
}
691 \docparam{height
}{Receives the window height.
}
693 \pythonnote{In place of a single overloaded method name, wxPython
694 implements the following methods:
\par
695 \indented{2cm
}{\begin{twocollist
}
696 \twocolitem{\bf{GetSize()
}}{Returns a wxSize
}
697 \twocolitem{\bf{GetSizeTuple()
}}{Returns a
2-tuple (width, height)
}
701 \membersection{wxWindow::GetTextExtent
}
703 \constfunc{virtual void
}{GetTextExtent
}{\param{const wxString\&
}{string
},
\param{int*
}{x
},
\param{int*
}{y
},
704 \param{int*
}{descent = NULL
},
\param{int*
}{externalLeading = NULL
},
705 \param{const wxFont*
}{font = NULL
},
\param{const bool
}{ use16 = FALSE
}}
707 Gets the dimensions of the string as it would be drawn on the
708 window with the currently selected font.
710 \wxheading{Parameters
}
712 \docparam{string
}{String whose extent is to be measured.
}
714 \docparam{x
}{Return value for width.
}
716 \docparam{y
}{Return value for height.
}
718 \docparam{descent
}{Return value for descent (optional).
}
720 \docparam{externalLeading
}{Return value for external leading (optional).
}
722 \docparam{font
}{Font to use instead of the current window font (optional).
}
724 \docparam{use16
}{If TRUE,
{\it string
} contains
16-bit characters. The default is FALSE.
}
727 \pythonnote{In place of a single overloaded method name, wxPython
728 implements the following methods:
\par
729 \indented{2cm
}{\begin{twocollist
}
730 \twocolitem{\bf{GetTextExtent(string)
}}{Returns a
2-tuple, (width, height)
}
731 \twocolitem{\bf{GetFullTextExtent(string, font=NULL)
}}{Returns a
732 4-tuple, (width, height, descent, externalLeading)
}
737 \membersection{wxWindow::GetTitle
}\label{wxwindowgettitle
}
739 \func{virtual wxString
}{GetTitle
}{\void}
741 Gets the window's title. Applicable only to frames and dialogs.
745 \helpref{wxWindow::SetTitle
}{wxwindowsettitle
}
747 \membersection{wxWindow::GetUpdateRegion
}\label{wxwindowgetupdateregion
}
749 \constfunc{virtual wxRegion
}{GetUpdateRegion
}{\void}
751 Returns the region specifying which parts of the window have been damaged. Should
752 only be called within an
\helpref{OnPaint
}{wxwindowonpaint
} event handler.
756 \helpref{wxRegion
}{wxregion
},
\helpref{wxRegionIterator
}{wxregioniterator
},
\helpref{wxWindow::OnPaint
}{wxwindowonpaint
}
758 \membersection{wxWindow::GetValidator
}\label{wxwindowgetvalidator
}
760 \constfunc{wxValidator*
}{GetValidator
}{\void}
762 Returns a pointer to the current validator for the window, or NULL if there is none.
764 \membersection{wxWindow::GetWindowStyleFlag
}
766 \constfunc{long
}{GetWindowStyleFlag
}{\void}
768 Gets the window style that was passed to the consructor or
{\bf Create
} member.
769 {\bf GetWindowStyle
} is synonymous.
771 \membersection{wxWindow::InitDialog
}\label{wxwindowinitdialog
}
773 \func{void
}{InitDialog
}{\void}
775 Sends an
\helpref{wxWindow::OnInitDialog
}{wxwindowoninitdialog
} event, which
776 in turn transfers data to the dialog via validators.
780 \helpref{wxWindow::OnInitDialog
}{wxwindowoninitdialog
}
782 \membersection{wxWindow::IsEnabled
}\label{wxwindowisenabled
}
784 \constfunc{virtual bool
}{IsEnabled
}{\void}
786 Returns TRUE if the window is enabled for input, FALSE otherwise.
790 \helpref{wxWindow::Enable
}{wxwindowenable
}
792 \membersection{wxWindow:IsExposed
}\label{wxwindowisexposed
}
794 \constfunc{bool
}{IsExposed
}{\param{int
}{x
},
\param{int
}{y
}}
796 \constfunc{bool
}{IsExposed
}{\param{wxPoint
}{&pt
}}
798 \constfunc{bool
}{IsExposed
}{\param{int
}{x
},
\param{int
}{y
},
\param{int
}{w
},
\param{int
}{h
}}
800 \constfunc{bool
}{IsExposed
}{\param{wxRect
}{&rect
}}
802 Returns TRUE if the given point or rectange area has been exposed since the
803 last repaint. Call this in an paint event handler to optimize redrawing by
804 only redrawing those areas, which have been exposed.
806 \membersection{wxWindow::IsRetained
}\label{wxwindowisretained
}
808 \constfunc{virtual bool
}{IsRetained
}{\void}
810 Returns TRUE if the window is retained, FALSE otherwise.
814 Retained windows are only available on X platforms.
816 \membersection{wxWindow::IsShown
}\label{wxwindowisshown
}
818 \constfunc{virtual bool
}{IsShown
}{\void}
820 Returns TRUE if the window is shown, FALSE if it has been hidden.
822 \membersection{wxWindow::IsTopLevel
}\label{wxwindowistoplevel
}
824 \constfunc{bool
}{IsTopLevel
}{\void}
826 Returns TRUE if the given window is a top-level one. Currently all frames and
827 dialogs are considered to be top-level windows (even if they have a parent
830 \membersection{wxWindow::Layout
}\label{wxwindowlayout
}
832 \func{void
}{Layout
}{\void}
834 Invokes the constraint-based layout algorithm or the sizer-based algorithm
837 See
\helpref{wxWindow::SetAutoLayout
}{wxwindowsetautolayout
} on when
838 this function gets called automatically using auto layout.
840 \membersection{wxWindow::LoadFromResource
}\label{wxwindowloadfromresource
}
842 \func{virtual bool
}{LoadFromResource
}{\param{wxWindow*
}{parent
},
\rtfsp
843 \param{const wxString\&
}{resourceName
},
\param{const wxResourceTable*
}{resourceTable = NULL
}}
845 Loads a panel or dialog from a resource file.
847 \wxheading{Parameters
}
849 \docparam{parent
}{Parent window.
}
851 \docparam{resourceName
}{The name of the resource to load.
}
853 \docparam{resourceTable
}{The resource table to load it from. If this is NULL, the
854 default resource table will be used.
}
856 \wxheading{Return value
}
858 TRUE if the operation succeeded, otherwise FALSE.
860 \membersection{wxWindow::Lower
}\label{wxwindowlower
}
862 \func{void
}{Lower
}{\void}
864 Lowers the window to the bottom of the window hierarchy if it is a managed window (dialog
867 \membersection{wxWindow::MakeModal
}\label{wxwindowmakemodal
}
869 \func{virtual void
}{MakeModal
}{\param{const bool
}{flag
}}
871 Disables all other windows in the application so that
872 the user can only interact with this window. (This function
873 is not implemented anywhere).
875 \wxheading{Parameters
}
877 \docparam{flag
}{If TRUE, this call disables all other windows in the application so that
878 the user can only interact with this window. If FALSE, the effect is reversed.
}
880 \membersection{wxWindow::Move
}\label{wxwindowmove
}
882 \func{void
}{Move
}{\param{int
}{ x
},
\param{int
}{ y
}}
884 \func{void
}{Move
}{\param{const wxPoint\&
}{ pt
}}
886 Moves the window to the given position.
888 \wxheading{Parameters
}
890 \docparam{x
}{Required x position.
}
892 \docparam{y
}{Required y position.
}
894 \docparam{pt
}{\helpref{wxPoint
}{wxpoint
} object representing the position.
}
898 Implementations of SetSize can also implicitly implement the
899 wxWindow::Move function, which is defined in the base wxWindow class
903 SetSize(x, y, -
1, -
1, wxSIZE_USE_EXISTING);
908 \helpref{wxWindow::SetSize
}{wxwindowsetsize
}
910 \pythonnote{In place of a single overloaded method name, wxPython
911 implements the following methods:
\par
912 \indented{2cm
}{\begin{twocollist
}
913 \twocolitem{\bf{Move(point)
}}{Accepts a wxPoint
}
914 \twocolitem{\bf{MoveXY(x, y)
}}{Accepts a pair of integers
}
918 \membersection{wxWindow::OnActivate
}\label{wxwindowonactivate
}
920 \func{void
}{OnActivate
}{\param{wxActivateEvent\&
}{ event
}}
922 Called when a window is activated or deactivated.
924 \wxheading{Parameters
}
926 \docparam{event
}{Object containing activation information.
}
930 If the window is being activated,
\helpref{wxActivateEvent::GetActive
}{wxactivateeventgetactive
} returns TRUE,
931 otherwise it returns FALSE (it is being deactivated).
935 \helpref{wxActivateEvent
}{wxactivateevent
},
\rtfsp
936 \helpref{Event handling overview
}{eventhandlingoverview
}
938 \membersection{wxWindow::OnChar
}\label{wxwindowonchar
}
940 \func{void
}{OnChar
}{\param{wxKeyEvent\&
}{ event
}}
942 Called when the user has pressed a key that is not a modifier (SHIFT, CONTROL or ALT).
944 \wxheading{Parameters
}
946 \docparam{event
}{Object containing keypress information. See
\helpref{wxKeyEvent
}{wxkeyevent
} for
947 details about this class.
}
951 This member function is called in response to a keypress. To intercept this event,
952 use the EVT
\_CHAR macro in an event table definition. Your
{\bf OnChar
} handler may call this
953 default function to achieve default keypress functionality.
955 Note that the ASCII values do not have explicit key codes: they are passed as ASCII
958 Note that not all keypresses can be intercepted this way. If you wish to intercept modifier
959 keypresses, then you will need to use
\helpref{wxWindow::OnKeyDown
}{wxwindowonkeydown
} or
960 \helpref{wxWindow::OnKeyUp
}{wxwindowonkeyup
}.
962 Most, but not all, windows allow keypresses to be intercepted.
966 \helpref{wxWindow::OnKeyDown
}{wxwindowonkeydown
},
\helpref{wxWindow::OnKeyUp
}{wxwindowonkeyup
},
\rtfsp
967 \helpref{wxKeyEvent
}{wxkeyevent
},
\helpref{wxWindow::OnCharHook
}{wxwindowoncharhook
},
\rtfsp
968 \helpref{Event handling overview
}{eventhandlingoverview
}
970 \membersection{wxWindow::OnCharHook
}\label{wxwindowoncharhook
}
972 \func{void
}{OnCharHook
}{\param{wxKeyEvent\&
}{ event
}}
974 This member is called to allow the window to intercept keyboard events
975 before they are processed by child windows.
977 \wxheading{Parameters
}
979 \docparam{event
}{Object containing keypress information. See
\helpref{wxKeyEvent
}{wxkeyevent
} for
980 details about this class.
}
984 This member function is called in response to a keypress, if the window is active. To intercept this event,
985 use the EVT
\_CHAR\_HOOK macro in an event table definition. If you do not process a particular
986 keypress, call
\helpref{wxEvent::Skip
}{wxeventskip
} to allow default processing.
988 An example of using this function is in the implementation of escape-character processing for wxDialog,
989 where pressing ESC dismisses the dialog by
{\bf OnCharHook
} 'forging' a cancel button press event.
991 Note that the ASCII values do not have explicit key codes: they are passed as ASCII
994 This function is only relevant to top-level windows (frames and dialogs), and under
995 Windows only. Under GTK the normal EVT
\_CHAR\_ event has the functionality, i.e.
996 you can intercepts it and if you don't call
\helpref{wxEvent::Skip
}{wxeventskip
}
997 the window won't get the event.
1001 \helpref{wxKeyEvent
}{wxkeyevent
},
\helpref{wxWindow::OnCharHook
}{wxwindowoncharhook
},
\rtfsp
1002 \helpref{wxApp::OnCharHook
}{wxapponcharhook
},
\rtfsp
1003 \helpref{Event handling overview
}{eventhandlingoverview
}
1005 \membersection{wxWindow::OnCommand
}\label{wxwindowoncommand
}
1007 \func{virtual void
}{OnCommand
}{\param{wxEvtHandler\&
}{object
},
\param{wxCommandEvent\&
}{event
}}
1009 This virtual member function is called if the control does not handle the command event.
1011 \wxheading{Parameters
}
1013 \docparam{object
}{Object receiving the command event.
}
1015 \docparam{event
}{Command event
}
1019 This virtual function is provided mainly for backward compatibility. You can also intercept commands
1020 from child controls by using an event table, with identifiers or identifier ranges to identify
1021 the control(s) in question.
1023 \wxheading{See also
}
1025 \helpref{wxCommandEvent
}{wxcommandevent
},
\rtfsp
1026 \helpref{Event handling overview
}{eventhandlingoverview
}
1028 \membersection{wxWindow::OnClose
}\label{wxwindowonclose
}
1030 \func{virtual bool
}{OnClose
}{\void}
1032 Called when the user has tried to close a a frame
1033 or dialog box using the window manager (X) or system menu (Windows).
1035 {\bf Note:
} This is an obsolete function.
1036 It is superceded by the
\helpref{wxWindow::OnCloseWindow
}{wxwindowonclosewindow
} event
1039 \wxheading{Return value
}
1041 If TRUE is returned by OnClose, the window will be deleted by the system, otherwise the
1042 attempt will be ignored. Do not delete the window from within this handler, although
1043 you may delete other windows.
1045 \wxheading{See also
}
1047 \helpref{Window deletion overview
}{windowdeletionoverview
},
\rtfsp
1048 \helpref{wxWindow::Close
}{wxwindowclose
},
\rtfsp
1049 \helpref{wxWindow::OnCloseWindow
}{wxwindowonclosewindow
},
\rtfsp
1050 \helpref{wxCloseEvent
}{wxcloseevent
}
1052 \membersection{wxWindow::OnCloseWindow
}\label{wxwindowonclosewindow
}
1054 \func{void
}{OnCloseWindow
}{\param{wxCloseEvent\&
}{event
}}
1056 This is an event handler function called when the user has tried to close a a frame
1057 or dialog box using the window manager (X) or system menu (Windows). It is
1058 called via the
\helpref{wxWindow::Close
}{wxwindowclose
} function, so
1059 that the application can also invoke the handler programmatically.
1061 Use the EVT
\_CLOSE event table macro to handle close events.
1063 You should check whether the application is forcing the deletion of the window
1064 using
\helpref{wxCloseEvent::GetForce
}{wxcloseeventgetforce
}. If this is TRUE,
1065 destroy the window using
\helpref{wxWindow::Destroy
}{wxwindowdestroy
}.
1066 If not, it is up to you whether you respond by destroying the window.
1068 (Note: GetForce is now superceded by CanVeto. So to test whether forced destruction of
1069 the window is required, test for the negative of CanVeto. If CanVeto returns FALSE,
1070 it is not possible to skip window deletion.)
1072 If you don't destroy the window, you should call
\helpref{wxCloseEvent::Veto
}{wxcloseeventveto
} to
1073 let the calling code know that you did not destroy the window. This allows the
\helpref{wxWindow::Close
}{wxwindowclose
} function
1074 to return TRUE or FALSE depending on whether the close instruction was honoured or not.
1078 The
\helpref{wxWindow::OnClose
}{wxwindowonclose
} virtual function remains
1079 for backward compatibility with earlier versions of wxWindows. The
1080 default
{\bf OnCloseWindow
} handler for wxFrame and wxDialog will call
{\bf OnClose
},
1081 destroying the window if it returns TRUE or if the close is being forced.
1083 \wxheading{See also
}
1085 \helpref{Window deletion overview
}{windowdeletionoverview
},
\rtfsp
1086 \helpref{wxWindow::Close
}{wxwindowclose
},
\rtfsp
1087 \helpref{wxWindow::OnClose
}{wxwindowonclose
},
\rtfsp
1088 \helpref{wxWindow::Destroy
}{wxwindowdestroy
},
\rtfsp
1089 \helpref{wxCloseEvent
}{wxcloseevent
},
\rtfsp
1090 \helpref{wxApp::OnQueryEndSession
}{wxapponqueryendsession
},
\rtfsp
1091 \helpref{wxApp::OnEndSession
}{wxapponendsession
}
1093 \membersection{wxWindow::OnDropFiles
}\label{wxwindowondropfiles
}
1095 \func{void
}{OnDropFiles
}{\param{wxDropFilesEvent\&
}{ event
}}
1097 Called when files have been dragged from the file manager to the window.
1099 \wxheading{Parameters
}
1101 \docparam{event
}{Drop files event. For more information, see
\helpref{wxDropFilesEvent
}{wxdropfilesevent
}.
}
1105 The window must have previously been enabled for dropping by calling
1106 \rtfsp\helpref{wxWindow::DragAcceptFiles
}{wxwindowdragacceptfiles
}.
1108 This event is only generated under Windows.
1110 To intercept this event, use the EVT
\_DROP\_FILES macro in an event table definition.
1112 \wxheading{See also
}
1114 \helpref{wxDropFilesEvent
}{wxdropfilesevent
},
\helpref{wxWindow::DragAcceptFiles
}{wxwindowdragacceptfiles
},
\rtfsp
1115 \helpref{Event handling overview
}{eventhandlingoverview
}
1117 \membersection{wxWindow::OnEraseBackground
}\label{wxwindowonerasebackground
}
1119 \func{void
}{OnEraseBackground
}{\param{wxEraseEvent\&
}{ event
}}
1121 Called when the background of the window needs to be erased.
1123 \wxheading{Parameters
}
1125 \docparam{event
}{Erase background event. For more information, see
\helpref{wxEraseEvent
}{wxeraseevent
}.
}
1129 This event is only generated under Windows. It is therefore recommended that
1130 you set the text background colour explicitly in order to prevent flicker.
1131 The default background colour under GTK is grey.
1133 To intercept this event, use the EVT
\_ERASE\_BACKGROUND macro in an event table definition.
1135 \wxheading{See also
}
1137 \helpref{wxEraseEvent
}{wxeraseevent
},
\helpref{Event handling overview
}{eventhandlingoverview
}
1139 \membersection{wxWindow::OnKeyDown
}\label{wxwindowonkeydown
}
1141 \func{void
}{OnKeyDown
}{\param{wxKeyEvent\&
}{ event
}}
1143 Called when the user has pressed a key, before it is translated into an ASCII value using other
1144 modifier keys that might be pressed at the same time.
1146 \wxheading{Parameters
}
1148 \docparam{event
}{Object containing keypress information. See
\helpref{wxKeyEvent
}{wxkeyevent
} for
1149 details about this class.
}
1153 This member function is called in response to a key down event. To intercept this event,
1154 use the EVT
\_KEY\_DOWN macro in an event table definition. Your
{\bf OnKeyDown
} handler may call this
1155 default function to achieve default keypress functionality.
1157 Note that not all keypresses can be intercepted this way. If you wish to intercept special
1158 keys, such as shift, control, and function keys, then you will need to use
\helpref{wxWindow::OnKeyDown
}{wxwindowonkeydown
} or
1159 \helpref{wxWindow::OnKeyUp
}{wxwindowonkeyup
}.
1161 Most, but not all, windows allow keypresses to be intercepted.
1163 \wxheading{See also
}
1165 \helpref{wxWindow::OnChar
}{wxwindowonchar
},
\helpref{wxWindow::OnKeyUp
}{wxwindowonkeyup
},
\rtfsp
1166 \helpref{wxKeyEvent
}{wxkeyevent
},
\helpref{wxWindow::OnCharHook
}{wxwindowoncharhook
},
\rtfsp
1167 \helpref{Event handling overview
}{eventhandlingoverview
}
1169 \membersection{wxWindow::OnKeyUp
}\label{wxwindowonkeyup
}
1171 \func{void
}{OnKeyUp
}{\param{wxKeyEvent\&
}{ event
}}
1173 Called when the user has released a key.
1175 \wxheading{Parameters
}
1177 \docparam{event
}{Object containing keypress information. See
\helpref{wxKeyEvent
}{wxkeyevent
} for
1178 details about this class.
}
1182 This member function is called in response to a key up event. To intercept this event,
1183 use the EVT
\_KEY\_UP macro in an event table definition. Your
{\bf OnKeyUp
} handler may call this
1184 default function to achieve default keypress functionality.
1186 Note that not all keypresses can be intercepted this way. If you wish to intercept special
1187 keys, such as shift, control, and function keys, then you will need to use
\helpref{wxWindow::OnKeyDown
}{wxwindowonkeydown
} or
1188 \helpref{wxWindow::OnKeyUp
}{wxwindowonkeyup
}.
1190 Most, but not all, windows allow key up events to be intercepted.
1192 \wxheading{See also
}
1194 \helpref{wxWindow::OnChar
}{wxwindowonchar
},
\helpref{wxWindow::OnKeyDown
}{wxwindowonkeydown
},
\rtfsp
1195 \helpref{wxKeyEvent
}{wxkeyevent
},
\helpref{wxWindow::OnCharHook
}{wxwindowoncharhook
},
\rtfsp
1196 \helpref{Event handling overview
}{eventhandlingoverview
}
1198 \membersection{wxWindow::OnKillFocus
}\label{wxwindowonkillfocus
}
1200 \func{void
}{OnKillFocus
}{\param{wxFocusEvent\&
}{event
}}
1202 Called when a window's focus is being killed.
1204 \wxheading{Parameters
}
1206 \docparam{event
}{The focus event. For more information, see
\helpref{wxFocusEvent
}{wxfocusevent
}.
}
1210 To intercept this event, use the macro EVT
\_KILL\_FOCUS in an event table definition.
1212 Most, but not all, windows respond to this event.
1214 \wxheading{See also
}
1216 \helpref{wxFocusEvent
}{wxfocusevent
},
\helpref{wxWindow::OnSetFocus
}{wxwindowonsetfocus
},
\rtfsp
1217 \helpref{Event handling overview
}{eventhandlingoverview
}
1219 \membersection{wxWindow::OnIdle
}\label{wxwindowonidle
}
1221 \func{void
}{OnIdle
}{\param{wxIdleEvent\&
}{event
}}
1223 Provide this member function for any processing which needs to be done
1224 when the application is idle.
1226 \wxheading{See also
}
1228 \helpref{wxApp::OnIdle
}{wxapponidle
},
\helpref{wxIdleEvent
}{wxidleevent
}
1230 \membersection{wxWindow::OnInitDialog
}\label{wxwindowoninitdialog
}
1232 \func{void
}{OnInitDialog
}{\param{wxInitDialogEvent\&
}{ event
}}
1234 Default handler for the wxEVT
\_INIT\_DIALOG event. Calls
\helpref{wxWindow::TransferDataToWindow
}{wxwindowtransferdatatowindow
}.
1236 \wxheading{Parameters
}
1238 \docparam{event
}{Dialog initialisation event.
}
1242 Gives the window the default behaviour of transferring data to child controls via
1243 the validator that each control has.
1245 \wxheading{See also
}
1247 \helpref{wxValidator
}{wxvalidator
},
\helpref{wxWindow::TransferDataToWindow
}{wxwindowtransferdatatowindow
}
1249 \membersection{wxWindow::OnMenuCommand
}\label{wxwindowonmenucommand
}
1251 \func{void
}{OnMenuCommand
}{\param{wxCommandEvent\&
}{event
}}
1253 Called when a menu command is received from a menu bar.
1255 \wxheading{Parameters
}
1257 \docparam{event
}{The menu command event. For more information, see
\helpref{wxCommandEvent
}{wxcommandevent
}.
}
1261 A function with this name doesn't actually exist; you can choose any member function to receive
1262 menu command events, using the EVT
\_COMMAND macro for individual commands or EVT
\_COMMAND\_RANGE for
1263 a range of commands.
1265 \wxheading{See also
}
1267 \helpref{wxCommandEvent
}{wxcommandevent
},
\rtfsp
1268 \helpref{wxWindow::OnMenuHighlight
}{wxwindowonmenuhighlight
},
\rtfsp
1269 \helpref{Event handling overview
}{eventhandlingoverview
}
1271 \membersection{wxWindow::OnMenuHighlight
}\label{wxwindowonmenuhighlight
}
1273 \func{void
}{OnMenuHighlight
}{\param{wxMenuEvent\&
}{event
}}
1275 Called when a menu select is received from a menu bar: that is, the
1276 mouse cursor is over a menu item, but the left mouse button has not been
1279 \wxheading{Parameters
}
1281 \docparam{event
}{The menu highlight event. For more information, see
\helpref{wxMenuEvent
}{wxmenuevent
}.
}
1285 You can choose any member function to receive
1286 menu select events, using the EVT
\_MENU\_HIGHLIGHT macro for individual menu items or EVT
\_MENU\_HIGHLIGHT\_ALL macro
1289 The default implementation for
\helpref{wxFrame::OnMenuHighlight
}{wxframeonmenuhighlight
} displays help
1290 text in the first field of the status bar.
1292 This function was known as
{\bf OnMenuSelect
} in earlier versions of wxWindows, but this was confusing
1293 since a selection is normally a left-click action.
1295 \wxheading{See also
}
1297 \helpref{wxMenuEvent
}{wxmenuevent
},
\rtfsp
1298 \helpref{wxWindow::OnMenuCommand
}{wxwindowonmenucommand
},
\rtfsp
1299 \helpref{Event handling overview
}{eventhandlingoverview
}
1302 \membersection{wxWindow::OnMouseEvent
}\label{wxwindowonmouseevent
}
1304 \func{void
}{OnMouseEvent
}{\param{wxMouseEvent\&
}{ event
}}
1306 Called when the user has initiated an event with the
1309 \wxheading{Parameters
}
1311 \docparam{event
}{The mouse event. See
\helpref{wxMouseEvent
}{wxmouseevent
} for
1316 Most, but not all, windows respond to this event.
1318 To intercept this event, use the EVT
\_MOUSE\_EVENTS macro in an event table definition, or individual
1319 mouse event macros such as EVT
\_LEFT\_DOWN.
1321 \wxheading{See also
}
1323 \helpref{wxMouseEvent
}{wxmouseevent
},
\rtfsp
1324 \helpref{Event handling overview
}{eventhandlingoverview
}
1326 \membersection{wxWindow::OnMove
}\label{wxwindowonmove
}
1328 \func{void
}{OnMove
}{\param{wxMoveEvent\&
}{event
}}
1330 Called when a window is moved.
1332 \wxheading{Parameters
}
1334 \docparam{event
}{The move event. For more information, see
\helpref{wxMoveEvent
}{wxmoveevent
}.
}
1338 Use the EVT
\_MOVE macro to intercept move events.
1342 Not currently implemented.
1344 \wxheading{See also
}
1346 \helpref{wxMoveEvent
}{wxmoveevent
},
\rtfsp
1347 \helpref{wxFrame::OnSize
}{wxframeonsize
},
\rtfsp
1348 \helpref{Event handling overview
}{eventhandlingoverview
}
1350 \membersection{wxWindow::OnPaint
}\label{wxwindowonpaint
}
1352 \func{void
}{OnPaint
}{\param{wxPaintEvent\&
}{event
}}
1354 Sent to the event handler when the window must be refreshed.
1356 \wxheading{Parameters
}
1358 \docparam{event
}{Paint event. For more information, see
\helpref{wxPaintEvent
}{wxpaintevent
}.
}
1362 Use the EVT
\_PAINT macro in an event table definition to intercept paint events.
1364 In a paint event handler, the application should always create a
\helpref{wxPaintDC
}{wxpaintdc
} object.
1370 void MyWindow::OnPaint(wxPaintEvent& event)
1379 You can optimize painting by retrieving the rectangles
1380 that have been damaged and only repainting these. The rectangles are in
1381 terms of the client area, and are unscrolled, so you will need to do
1382 some calculations using the current view position to obtain logical,
1385 Here is an example of using the
\helpref{wxRegionIterator
}{wxregioniterator
} class:
1389 // Called when window needs to be repainted.
1390 void MyWindow::OnPaint(wxPaintEvent& event)
1394 // Find Out where the window is scrolled to
1395 int vbX,vbY; // Top left corner of client
1396 ViewStart(&vbX,&vbY);
1398 int vX,vY,vW,vH; // Dimensions of client area in pixels
1399 wxRegionIterator upd(GetUpdateRegion()); // get the update rect list
1408 // Alternatively we can do this:
1410 // upd.GetRect(&rect);
1412 // Repaint this rectangle
1421 \wxheading{See also
}
1423 \helpref{wxPaintEvent
}{wxpaintevent
},
\rtfsp
1424 \helpref{wxPaintDC
}{wxpaintdc
},
\rtfsp
1425 \helpref{Event handling overview
}{eventhandlingoverview
}
1427 \membersection{wxWindow::OnScroll
}\label{wxwindowonscroll
}
1429 \func{void
}{OnScroll
}{\param{wxScrollWinEvent\&
}{event
}}
1431 Called when a scroll window event is received from one of the window's built-in scrollbars.
1433 \wxheading{Parameters
}
1435 \docparam{event
}{Command event. Retrieve the new scroll position by
1436 calling
\helpref{wxScrollEvent::GetPosition
}{wxscrolleventgetposition
}, and the
1437 scrollbar orientation by calling
\helpref{wxScrollEvent::GetOrientation
}{wxscrolleventgetorientation
}.
}
1441 Note that it is not possible to distinguish between horizontal and vertical scrollbars
1442 until the function is executing (you can't have one function for vertical, another
1443 for horizontal events).
1445 \wxheading{See also
}
1447 \helpref{wxScrollWinEvent
}{wxscrollwinevent
},
\rtfsp
1448 \helpref{Event handling overview
}{eventhandlingoverview
}
1450 \membersection{wxWindow::OnSetFocus
}\label{wxwindowonsetfocus
}
1452 \func{void
}{OnSetFocus
}{\param{wxFocusEvent\&
}{event
}}
1454 Called when a window's focus is being set.
1456 \wxheading{Parameters
}
1458 \docparam{event
}{The focus event. For more information, see
\helpref{wxFocusEvent
}{wxfocusevent
}.
}
1462 To intercept this event, use the macro EVT
\_SET\_FOCUS in an event table definition.
1464 Most, but not all, windows respond to this event.
1466 \wxheading{See also
}
1468 \helpref{wxFocusEvent
}{wxfocusevent
},
\helpref{wxWindow::OnKillFocus
}{wxwindowonkillfocus
},
\rtfsp
1469 \helpref{Event handling overview
}{eventhandlingoverview
}
1471 \membersection{wxWindow::OnSize
}\label{wxwindowonsize
}
1473 \func{void
}{OnSize
}{\param{wxSizeEvent\&
}{event
}}
1475 Called when the window has been resized.
1477 \wxheading{Parameters
}
1479 \docparam{event
}{Size event. For more information, see
\helpref{wxSizeEvent
}{wxsizeevent
}.
}
1483 You may wish to use this for frames to resize their child windows as appropriate.
1485 Note that the size passed is of
1486 the whole window: call
\helpref{wxWindow::GetClientSize
}{wxwindowgetclientsize
} for the area which may be
1487 used by the application.
1489 \wxheading{See also
}
1491 \helpref{wxSizeEvent
}{wxsizeevent
},
\rtfsp
1492 \helpref{Event handling overview
}{eventhandlingoverview
}
1494 \membersection{wxWindow::OnSysColourChanged
}\label{wxwindowonsyscolourchanged
}
1496 \func{void
}{OnSysColourChanged
}{\param{wxOnSysColourChangedEvent\&
}{event
}}
1498 Called when the user has changed the system colours. Windows only.
1500 \wxheading{Parameters
}
1502 \docparam{event
}{System colour change event. For more information, see
\helpref{wxSysColourChangedEvent
}{wxsyscolourchangedevent
}.
}
1504 \wxheading{See also
}
1506 \helpref{wxSysColourChangedEvent
}{wxsyscolourchangedevent
},
\rtfsp
1507 \helpref{Event handling overview
}{eventhandlingoverview
}
1509 \membersection{wxWindow::PopEventHandler
}\label{wxwindowpopeventhandler
}
1511 \constfunc{wxEvtHandler*
}{PopEventHandler
}{\param{bool
}{deleteHandler = FALSE
}}
1513 Removes and returns the top-most event handler on the event handler stack.
1515 \wxheading{Parameters
}
1517 \docparam{deleteHandler
}{If this is TRUE, the handler will be deleted after it is removed. The
1518 default value is FALSE.
}
1520 \wxheading{See also
}
1522 \helpref{wxWindow::SetEventHandler
}{wxwindowseteventhandler
},
\rtfsp
1523 \helpref{wxWindow::GetEventHandler
}{wxwindowgeteventhandler
},
\rtfsp
1524 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1525 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
1526 \helpref{wxEvtHandler
}{wxevthandler
}\rtfsp
1528 \membersection{wxWindow::PopupMenu
}\label{wxwindowpopupmenu
}
1530 \func{bool
}{PopupMenu
}{\param{wxMenu*
}{menu
},
\param{const wxPoint&
}{pos
}}
1532 \func{bool
}{PopupMenu
}{\param{wxMenu*
}{menu
},
\param{int
}{x
},
\param{int
}{y
}}
1534 Pops up the given menu at the specified coordinates, relative to this
1535 window, and returns control when the user has dismissed the menu. If a
1536 menu item is selected, the corresponding menu event is generated and will be
1537 processed as usually.
1539 \wxheading{Parameters
}
1541 \docparam{menu
}{Menu to pop up.
}
1543 \docparam{pos
}{The position where the menu will appear.
}
1545 \docparam{x
}{Required x position for the menu to appear.
}
1547 \docparam{y
}{Required y position for the menu to appear.
}
1549 \wxheading{See also
}
1551 \helpref{wxMenu
}{wxmenu
}
1555 Just before the menu is popped up,
\helpref{wxMenu::UpdateUI
}{wxmenuupdateui
} is called
1556 to ensure that the menu items are in the correct state. The menu does not get deleted
1559 \pythonnote{In place of a single overloaded method name, wxPython
1560 implements the following methods:
\par
1561 \indented{2cm
}{\begin{twocollist
}
1562 \twocolitem{\bf{PopupMenu(menu, point)
}}{Specifies position with a wxPoint
}
1563 \twocolitem{\bf{PopupMenuXY(menu, x, y)
}}{Specifies position with two integers (x, y)
}
1567 \membersection{wxWindow::PushEventHandler
}\label{wxwindowpusheventhandler
}
1569 \func{void
}{PushEventHandler
}{\param{wxEvtHandler*
}{handler
}}
1571 Pushes this event handler onto the event stack for the window.
1573 \wxheading{Parameters
}
1575 \docparam{handler
}{Specifies the handler to be pushed.
}
1579 An event handler is an object that is capable of processing the events
1580 sent to a window. By default, the window is its own event handler, but
1581 an application may wish to substitute another, for example to allow
1582 central implementation of event-handling for a variety of different
1585 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
} allows
1586 an application to set up a chain of event handlers, where an event not handled by one event handler is
1587 handed to the next one in the chain. Use
\helpref{wxWindow::PopEventHandler
}{wxwindowpopeventhandler
} to
1588 remove the event handler.
1590 \wxheading{See also
}
1592 \helpref{wxWindow::SetEventHandler
}{wxwindowseteventhandler
},
\rtfsp
1593 \helpref{wxWindow::GetEventHandler
}{wxwindowgeteventhandler
},
\rtfsp
1594 \helpref{wxWindow::PopEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1595 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
1596 \helpref{wxEvtHandler
}{wxevthandler
}
1598 \membersection{wxWindow::Raise
}\label{wxwindowraise
}
1600 \func{void
}{Raise
}{\void}
1602 Raises the window to the top of the window hierarchy if it is a managed window (dialog
1605 \membersection{wxWindow::Refresh
}\label{wxwindowrefresh
}
1607 \func{virtual void
}{Refresh
}{\param{const bool
}{ eraseBackground = TRUE
},
\param{const wxRect*
}{rect
1610 Causes a message or event to be generated to repaint the
1613 \wxheading{Parameters
}
1615 \docparam{eraseBackground
}{If TRUE, the background will be
1618 \docparam{rect
}{If non-NULL, only the given rectangle will
1619 be treated as damaged.
}
1621 \membersection{wxWindow::ReleaseMouse
}\label{wxwindowreleasemouse
}
1623 \func{virtual void
}{ReleaseMouse
}{\void}
1625 Releases mouse input captured with
\helpref{wxWindow::CaptureMouse
}{wxwindowcapturemouse
}.
1627 \wxheading{See also
}
1629 \helpref{wxWindow::CaptureMouse
}{wxwindowcapturemouse
}
1631 \membersection{wxWindow::RemoveChild
}\label{wxwindowremovechild
}
1633 \func{virtual void
}{RemoveChild
}{\param{wxWindow*
}{child
}}
1635 Removes a child window. This is called automatically by window deletion
1636 functions so should not be required by the application programmer.
1638 \wxheading{Parameters
}
1640 \docparam{child
}{Child window to remove.
}
1642 \membersection{wxWindow::Reparent
}\label{wxwindowreparent
}
1644 \func{virtual bool
}{Reparent
}{\param{wxWindow*
}{newParent
}}
1646 Reparents the window, i.e the window will be removed from its
1647 current parent window (e.g. a non-standard toolbar in a wxFrame)
1648 and then re-inserted into another (e.g. a wxMiniFrame for a
1649 floating toolbar). Available on Windows and GTK+.
1651 \wxheading{Parameters
}
1653 \docparam{newParent
}{New parent.
}
1655 \membersection{wxWindow::ScreenToClient
}\label{wxwindowscreentoclient
}
1657 \constfunc{virtual void
}{ScreenToClient
}{\param{int*
}{x
},
\param{int*
}{y
}}
1659 \constfunc{virtual wxPoint
}{ScreenToClient
}{\param{const wxPoint\&
}{pt
}}
1661 Converts from screen to client window coordinates.
1663 \wxheading{Parameters
}
1665 \docparam{x
}{Stores the screen x coordinate and receives the client x coordinate.
}
1667 \docparam{y
}{Stores the screen x coordinate and receives the client x coordinate.
}
1669 \docparam{pt
}{The screen position for the second form of the function.
}
1671 \pythonnote{In place of a single overloaded method name, wxPython
1672 implements the following methods:
\par
1673 \indented{2cm
}{\begin{twocollist
}
1674 \twocolitem{\bf{ScreenToClient(point)
}}{Accepts and returns a wxPoint
}
1675 \twocolitem{\bf{ScreenToClientXY(x, y)
}}{Returns a
2-tuple, (x, y)
}
1680 \membersection{wxWindow::ScrollWindow
}\label{wxwindowscrollwindow
}
1682 \func{virtual void
}{ScrollWindow
}{\param{int
}{dx
},
\param{int
}{dy
},
\param{const wxRect*
}{ rect = NULL
}}
1684 Physically scrolls the pixels in the window and move child windows accordingly.
1686 \wxheading{Parameters
}
1688 \docparam{dx
}{Amount to scroll horizontally.
}
1690 \docparam{dy
}{Amount to scroll vertically.
}
1692 \docparam{rect
}{Rectangle to invalidate. If this is NULL, the whole window is invalidated. If you
1693 pass a rectangle corresponding to the area of the window exposed by the scroll, your painting handler
1694 can optimise painting by checking for the invalidated region. This paramter is ignored under GTK,
1695 instead the regions to be invalidated are calculated automatically.
}
1699 Use this function to optimise your scrolling implementations, to minimise the area that must be
1700 redrawn. Note that it is rarely required to call this function from a user program.
1702 \membersection{wxWindow::SetAcceleratorTable
}\label{wxwindowsetacceleratortable
}
1704 \func{virtual void
}{SetAcceleratorTable
}{\param{const wxAcceleratorTable\&
}{ accel
}}
1706 Sets the accelerator table for this window. See
\helpref{wxAcceleratorTable
}{wxacceleratortable
}.
1708 \membersection{wxWindow::SetAutoLayout
}\label{wxwindowsetautolayout
}
1710 \func{void
}{SetAutoLayout
}{\param{const bool
}{ autoLayout
}}
1712 Determines whether the
\helpref{wxWindow::Layout
}{wxwindowlayout
} function will
1713 be called automatically when the window is resized. Use in connection with
1714 \helpref{wxWindow::SetSizer
}{wxwindowsetsizer
} and
1715 \helpref{wxWindow::SetConstraints
}{wxwindowsetconstraints
} for layouting subwindows.
1717 \wxheading{Parameters
}
1719 \docparam{autoLayout
}{Set this to TRUE if you wish the Layout function to be called
1720 from within wxWindow::OnSize functions.
}
1724 Note that this function is actually disabled for wxWindow. It has
1725 effect for wxDialog, wxFrame, wxPanel and wxScrolledWindow. Windows
1726 of other types that need to invoke the Layout algorithm should provide
1727 an EVT_SIZE handler and call
1728 \helpref{wxWindow::Layout
}{wxwindowlayout
} from within it.
1730 \wxheading{See also
}
1732 \helpref{wxWindow::SetConstraints
}{wxwindowsetconstraints
}
1734 \membersection{wxWindow::SetBackgroundColour
}\label{wxwindowsetbackgroundcolour
}
1736 \func{virtual void
}{SetBackgroundColour
}{\param{const wxColour\&
}{colour
}}
1738 Sets the background colour of the window.
1740 \wxheading{Parameters
}
1742 \docparam{colour
}{The colour to be used as the background colour.
}
1746 The background colour is usually painted by the default
\rtfsp
1747 \helpref{wxWindow::OnEraseBackground
}{wxwindowonerasebackground
} event handler function
1748 under Windows and automatically under GTK.
1750 Note that setting the background colour does not cause an immediate refresh, so you
1751 may wish to call
\helpref{wxWindow::Clear
}{wxwindowclear
} or
\helpref{wxWindow::Refresh
}{wxwindowrefresh
} after
1752 calling this function.
1754 Note that when using this functions under GTK, you will disable the so called "themes",
1755 i.e. the user chosen apperance of windows and controls, including the themes of
1756 their parent windows.
1758 \wxheading{See also
}
1760 \helpref{wxWindow::GetBackgroundColour
}{wxwindowgetbackgroundcolour
},
\rtfsp
1761 \helpref{wxWindow::SetForegroundColour
}{wxwindowsetforegroundcolour
},
\rtfsp
1762 \helpref{wxWindow::GetForegroundColour
}{wxwindowgetforegroundcolour
},
\rtfsp
1763 \helpref{wxWindow::Clear
}{wxwindowclear
},
\rtfsp
1764 \helpref{wxWindow::Refresh
}{wxwindowrefresh
},
\rtfsp
1765 \helpref{wxWindow::OnEraseBackground
}{wxwindowonerasebackground
}
1767 \membersection{wxWindow::SetClientSize
}\label{wxwindowsetclientsize
}
1769 \func{virtual void
}{SetClientSize
}{\param{int
}{ width
},
\param{int
}{ height
}}
1771 \func{virtual void
}{SetClientSize
}{\param{const wxSize\&
}{ size
}}
1773 This sets the size of the window client area in pixels. Using this function to size a window
1774 tends to be more device-independent than
\helpref{wxWindow::SetSize
}{wxwindowsetsize
}, since the application need not
1775 worry about what dimensions the border or title bar have when trying to fit the window
1776 around panel items, for example.
1778 \wxheading{Parameters
}
1780 \docparam{width
}{The required client area width.
}
1782 \docparam{height
}{The required client area height.
}
1784 \docparam{size
}{The required client size.
}
1786 \pythonnote{In place of a single overloaded method name, wxPython
1787 implements the following methods:
\par
1788 \indented{2cm
}{\begin{twocollist
}
1789 \twocolitem{\bf{SetClientSize(size)
}}{Accepts a wxSize
}
1790 \twocolitem{\bf{SetClientSizeWH(width, height)
}}{}
1794 \membersection{wxWindow::SetCursor
}\label{wxwindowsetcursor
}
1796 \func{virtual void
}{SetCursor
}{\param{const wxCursor\&
}{cursor
}}
1798 Sets the window's cursor. Notice that setting the cursor for this window does
1799 not set it for its children so you'll need to explicitly call SetCursor() for
1800 them too if you need it.
1802 \wxheading{Parameters
}
1804 \docparam{cursor
}{Specifies the cursor that the window should normally display.
}
1806 \wxheading{See also
}
1808 \helpref{::wxSetCursor
}{wxsetcursor
},
\helpref{wxCursor
}{wxcursor
}
1810 \membersection{wxWindow::SetEventHandler
}\label{wxwindowseteventhandler
}
1812 \func{void
}{SetEventHandler
}{\param{wxEvtHandler*
}{handler
}}
1814 Sets the event handler for this window.
1816 \wxheading{Parameters
}
1818 \docparam{handler
}{Specifies the handler to be set.
}
1822 An event handler is an object that is capable of processing the events
1823 sent to a window. By default, the window is its own event handler, but
1824 an application may wish to substitute another, for example to allow
1825 central implementation of event-handling for a variety of different
1828 It is usually better to use
\helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
} since
1829 this sets up a chain of event handlers, where an event not handled by one event handler is
1830 handed to the next one in the chain.
1832 \wxheading{See also
}
1834 \helpref{wxWindow::GetEventHandler
}{wxwindowgeteventhandler
},
\rtfsp
1835 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1836 \helpref{wxWindow::PopEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1837 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
1838 \helpref{wxEvtHandler
}{wxevthandler
}
1840 \membersection{wxWindow::SetConstraints
}\label{wxwindowsetconstraints
}
1842 \func{void
}{SetConstraints
}{\param{wxLayoutConstraints*
}{constraints
}}
1844 Sets the window to have the given layout constraints. The window
1845 will then own the object, and will take care of its deletion.
1846 If an existing layout constraints object is already owned by the
1847 window, it will be deleted.
1849 \wxheading{Parameters
}
1851 \docparam{constraints
}{The constraints to set. Pass NULL to disassociate and delete the window's
1856 You must call
\helpref{wxWindow::SetAutoLayout
}{wxwindowsetautolayout
} to tell a window to use
1857 the constraints automatically in OnSize; otherwise, you must override OnSize and call Layout()
1858 explicitly. When setting both a wxLayoutConstraints and a
\helpref{wxSizer
}{wxsizer
}, only the
1859 sizer will have effect.
1861 \membersection{wxWindow::SetDropTarget
}\label{wxwindowsetdroptarget
}
1863 \func{void
}{SetDropTarget
}{\param{wxDropTarget*
}{ target
}}
1865 Associates a drop target with this window.
1867 If the window already has a drop target, it is deleted.
1869 \wxheading{See also
}
1871 \helpref{wxWindow::GetDropTarget
}{wxwindowgetdroptarget
},
1872 \helpref{Drag and drop overview
}{wxdndoverview
}
1874 \membersection{wxWindow::SetFocus
}\label{wxwindowsetfocus
}
1876 \func{virtual void
}{SetFocus
}{\void}
1878 This sets the window to receive keyboard input.
1880 \membersection{wxWindow::SetFont
}\label{wxwindowsetfont
}
1882 \func{void
}{SetFont
}{\param{const wxFont\&
}{font
}}
1884 Sets the font for this window.
1886 \wxheading{Parameters
}
1888 \docparam{font
}{Font to associate with this window.
}
1890 \wxheading{See also
}
1892 \helpref{wxWindow::GetFont
}{wxwindowgetfont
}
1894 \membersection{wxWindow::SetForegroundColour
}\label{wxwindowsetforegroundcolour
}
1896 \func{virtual void
}{SetForegroundColour
}{\param{const wxColour\&
}{colour
}}
1898 Sets the foreground colour of the window.
1900 \wxheading{Parameters
}
1902 \docparam{colour
}{The colour to be used as the foreground colour.
}
1906 The interpretation of foreground colour is open to interpretation according
1907 to the window class; it may be the text colour or other colour, or it may not
1910 Note that when using this functions under GTK, you will disable the so called "themes",
1911 i.e. the user chosen apperance of windows and controls, including the themes of
1912 their parent windows.
1914 \wxheading{See also
}
1916 \helpref{wxWindow::GetForegroundColour
}{wxwindowgetforegroundcolour
},
\rtfsp
1917 \helpref{wxWindow::SetBackgroundColour
}{wxwindowsetbackgroundcolour
},
\rtfsp
1918 \helpref{wxWindow::GetBackgroundColour
}{wxwindowgetbackgroundcolour
}
1920 \membersection{wxWindow::SetId
}\label{wxwindowsetid
}
1922 \func{void
}{SetId
}{\param{int
}{ id
}}
1924 Sets the identifier of the window.
1928 Each window has an integer identifier. If the application has not provided one,
1929 an identifier will be generated. Normally, the identifier should be provided
1930 on creation and should not be modified subsequently.
1932 \wxheading{See also
}
1934 \helpref{wxWindow::GetId
}{wxwindowgetid
},
\rtfsp
1935 \helpref{Window identifiers
}{windowids
}
1937 \membersection{wxWindow::SetName
}\label{wxwindowsetname
}
1939 \func{virtual void
}{SetName
}{\param{const wxString\&
}{name
}}
1941 Sets the window's name.
1943 \wxheading{Parameters
}
1945 \docparam{name
}{A name to set for the window.
}
1947 \wxheading{See also
}
1949 \helpref{wxWindow::GetName
}{wxwindowgetname
}
1951 \membersection{wxWindow::SetPalette
}\label{wxwindowsetpalette
}
1953 \func{virtual void
}{SetPalette
}{\param{wxPalette*
}{palette
}}
1955 Obsolete - use
\helpref{wxDC::SetPalette
}{wxdcsetpalette
} instead.
1957 \membersection{wxWindow::SetScrollbar
}\label{wxwindowsetscrollbar
}
1959 \func{virtual void
}{SetScrollbar
}{\param{int
}{orientation
},
\param{int
}{position
},
\rtfsp
1960 \param{int
}{thumbSize
},
\param{int
}{range
},
\rtfsp
1961 \param{const bool
}{refresh = TRUE
}}
1963 Sets the scrollbar properties of a built-in scrollbar.
1965 \wxheading{Parameters
}
1967 \docparam{orientation
}{Determines the scrollbar whose page size is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
1969 \docparam{position
}{The position of the scrollbar in scroll units.
}
1971 \docparam{thumbSize
}{The size of the thumb, or visible portion of the scrollbar, in scroll units.
}
1973 \docparam{range
}{The maximum position of the scrollbar.
}
1975 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
1979 Let's say you wish to display
50 lines of text, using the same font.
1980 The window is sized so that you can only see
16 lines at a time.
1986 SetScrollbar(wxVERTICAL,
0,
16,
50);
1990 Note that with the window at this size, the thumb position can never go
1991 above
50 minus
16, or
34.
1993 You can determine how many lines are currently visible by dividing the current view
1994 size by the character height in pixels.
1996 When defining your own scrollbar behaviour, you will always need to recalculate
1997 the scrollbar settings when the window size changes. You could therefore put your
1998 scrollbar calculations and SetScrollbar
1999 call into a function named AdjustScrollbars, which can be called initially and also
2000 from your
\helpref{wxWindow::OnSize
}{wxwindowonsize
} event handler function.
2002 \wxheading{See also
}
2004 \helpref{Scrolling overview
}{scrollingoverview
},
\rtfsp
2005 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
2008 \membersection{wxWindow::SetScrollPage
}\label{wxwindowsetscrollpage
}
2010 \func{virtual void
}{SetScrollPage
}{\param{int
}{orientation
},
\param{int
}{pageSize
},
\param{const bool
}{refresh = TRUE
}}
2012 Sets the page size of one of the built-in scrollbars.
2014 \wxheading{Parameters
}
2016 \docparam{orientation
}{Determines the scrollbar whose page size is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
2018 \docparam{pageSize
}{Page size in scroll units.
}
2020 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
2024 The page size of a scrollbar is the number of scroll units that the scroll thumb travels when you
2025 click on the area above/left of or below/right of the thumb. Normally you will want a whole visible
2026 page to be scrolled, i.e. the size of the current view (perhaps the window client size). This
2027 value has to be adjusted when the window is resized, since the page size will have changed.
2029 In addition to specifying how far the scroll thumb travels when paging, in Motif and some versions of Windows
2030 the thumb changes size to reflect the page size relative to the length of the
document. When the
2031 document size is only slightly bigger than the current view (window) size, almost all of the scrollbar
2032 will be taken up by the thumb. When the two values become the same, the scrollbar will (on some systems)
2035 Currently, this function should be called before SetPageRange, because of a quirk in the Windows
2036 handling of pages and ranges.
2038 \wxheading{See also
}
2040 \helpref{wxWindow::SetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
2041 \helpref{wxWindow::GetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
2042 \helpref{wxWindow::GetScrollPage
}{wxwindowsetscrollpage
},
\rtfsp
2043 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
2046 \membersection{wxWindow::SetScrollPos
}\label{wxwindowsetscrollpos
}
2048 \func{virtual void
}{SetScrollPos
}{\param{int
}{orientation
},
\param{int
}{pos
},
\param{const bool
}{refresh = TRUE
}}
2050 Sets the position of one of the built-in scrollbars.
2052 \wxheading{Parameters
}
2054 \docparam{orientation
}{Determines the scrollbar whose position is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
2056 \docparam{pos
}{Position in scroll units.
}
2058 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
2062 This function does not directly affect the contents of the window: it is up to the
2063 application to take note of scrollbar attributes and redraw contents accordingly.
2065 \wxheading{See also
}
2067 \helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
},
\rtfsp
2068 \helpref{wxWindow::GetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
2069 \helpref{wxWindow::GetScrollThumb
}{wxwindowgetscrollthumb
},
\rtfsp
2070 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
2073 \membersection{wxWindow::SetScrollRange
}\label{wxwindowsetscrollrange
}
2075 \func{virtual void
}{SetScrollRange
}{\param{int
}{orientation
},
\param{int
}{range
},
\param{const bool
}{refresh = TRUE
}}
2077 Sets the range of one of the built-in scrollbars.
2079 \wxheading{Parameters
}
2081 \docparam{orientation
}{Determines the scrollbar whose range is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
2083 \docparam{range
}{Scroll range.
}
2085 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
2089 The range of a scrollbar is the number of steps that the thumb may travel, rather than the total
2090 object length of the scrollbar. If you are implementing a scrolling window, for example, you
2091 would adjust the scroll range when the window is resized, by subtracting the window view size from the
2092 total virtual window size. When the two sizes are the same (all the window is visible), the range goes to zero
2093 and usually the scrollbar will be automatically hidden.
2095 \wxheading{See also
}
2097 \helpref{wxWindow::SetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
2098 \helpref{wxWindow::SetScrollPage
}{wxwindowsetscrollpage
},
\rtfsp
2099 \helpref{wxWindow::GetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
2100 \helpref{wxWindow::GetScrollPage
}{wxwindowsetscrollpage
},
\rtfsp
2101 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
2104 \membersection{wxWindow::SetSize
}\label{wxwindowsetsize
}
2106 \func{virtual void
}{SetSize
}{\param{int
}{ x
},
\param{int
}{ y
},
\param{int
}{ width
},
\param{int
}{ height
},
2107 \param{int
}{ sizeFlags = wxSIZE
\_AUTO}}
2109 \func{virtual void
}{SetSize
}{\param{const wxRect\&
}{ rect
}}
2111 Sets the size and position of the window in pixels.
2113 \func{virtual void
}{SetSize
}{\param{int
}{ width
},
\param{int
}{ height
}}
2115 \func{virtual void
}{SetSize
}{\param{const wxSize\&
}{ size
}}
2117 Sets the size of the window in pixels.
2119 \wxheading{Parameters
}
2121 \docparam{x
}{Required x position in pixels, or -
1 to indicate that the existing
2122 value should be used.
}
2124 \docparam{y
}{Required y position in pixels, or -
1 to indicate that the existing
2125 value should be used.
}
2127 \docparam{width
}{Required width in pixels, or -
1 to indicate that the existing
2128 value should be used.
}
2130 \docparam{height
}{Required height position in pixels, or -
1 to indicate that the existing
2131 value should be used.
}
2133 \docparam{size
}{\helpref{wxSize
}{wxsize
} object for setting the size.
}
2135 \docparam{rect
}{\helpref{wxRect
}{wxrect
} object for setting the position and size.
}
2137 \docparam{sizeFlags
}{Indicates the interpretation of other parameters. It is a bit list of the following:
2139 {\bf wxSIZE
\_AUTO\_WIDTH}: a -
1 width value is taken to indicate
2140 a wxWindows-supplied default width.\\
2141 {\bf wxSIZE
\_AUTO\_HEIGHT}: a -
1 height value is taken to indicate
2142 a wxWindows-supplied default width.\\
2143 {\bf wxSIZE
\_AUTO}: -
1 size values are taken to indicate
2144 a wxWindows-supplied default size.\\
2145 {\bf wxSIZE
\_USE\_EXISTING}: existing dimensions should be used
2146 if -
1 values are supplied.\\
2147 {\bf wxSIZE
\_ALLOW\_MINUS\_ONE}: allow dimensions of -
1 and less to be interpreted
2148 as real dimensions, not default values.
2153 The second form is a convenience for calling the first form with default
2154 x and y parameters, and must be used with non-default width and height values.
2156 The first form sets the position and optionally size, of the window.
2157 Parameters may be -
1 to indicate either that a default should be supplied
2158 by wxWindows, or that the current value of the dimension should be used.
2160 \wxheading{See also
}
2162 \helpref{wxWindow::Move
}{wxwindowmove
}
2164 \pythonnote{In place of a single overloaded method name, wxPython
2165 implements the following methods:
\par
2166 \indented{2cm
}{\begin{twocollist
}
2167 \twocolitem{\bf{SetDimensions(x, y, width, height, sizeFlags=wxSIZE_AUTO)
}}{}
2168 \twocolitem{\bf{SetSize(size)
}}{}
2169 \twocolitem{\bf{SetPosition(point)
}}{}
2173 \membersection{wxWindow::SetSizeHints
}\label{wxwindowsetsizehints
}
2175 \func{virtual void
}{SetSizeHints
}{\param{int
}{ minW=-
1},
\param{int
}{ minH=-
1},
\param{int
}{ maxW=-
1},
\param{int
}{ maxH=-
1},
2176 \param{int
}{ incW=-
1},
\param{int
}{ incH=-
1}}
2178 Allows specification of minimum and maximum window sizes, and window size increments.
2179 If a pair of values is not set (or set to -
1), the default values will be used.
2181 \wxheading{Parameters
}
2183 \docparam{minW
}{Specifies the minimum width allowable.
}
2185 \docparam{minH
}{Specifies the minimum height allowable.
}
2187 \docparam{maxW
}{Specifies the maximum width allowable.
}
2189 \docparam{maxH
}{Specifies the maximum height allowable.
}
2191 \docparam{incW
}{Specifies the increment for sizing the width (Motif/Xt only).
}
2193 \docparam{incH
}{Specifies the increment for sizing the height (Motif/Xt only).
}
2197 If this function is called, the user will not be able to size the window outside the
2200 The resizing increments are only significant under Motif or Xt.
2202 \membersection{wxWindow::SetSizer
}\label{wxwindowsetsizer
}
2204 \func{void
}{SetSizer
}{\param{wxSizer*
}{sizer
}}
2206 Sets the window to have the given layout sizer. The window
2207 will then own the object, and will take care of its deletion.
2208 If an existing layout constraints object is already owned by the
2209 window, it will be deleted.
2211 \wxheading{Parameters
}
2213 \docparam{sizer
}{The sizer to set. Pass NULL to disassociate and delete the window's
2218 You must call
\helpref{wxWindow::SetAutoLayout
}{wxwindowsetautolayout
} to tell a window to use
2219 the sizer automatically in OnSize; otherwise, you must override OnSize and call Layout()
2220 explicitly. When setting both a wxSizer and a
\helpref{wxLayoutConstraints
}{wxlayoutconstraints
},
2221 only the sizer will have effect.
2223 \membersection{wxWindow::SetTitle
}\label{wxwindowsettitle
}
2225 \func{virtual void
}{SetTitle
}{\param{const wxString\&
}{title
}}
2227 Sets the window's title. Applicable only to frames and dialogs.
2229 \wxheading{Parameters
}
2231 \docparam{title
}{The window's title.
}
2233 \wxheading{See also
}
2235 \helpref{wxWindow::GetTitle
}{wxwindowgettitle
}
2237 \membersection{wxWindow::SetValidator
}\label{wxwindowsetvalidator
}
2239 \func{virtual void
}{SetValidator
}{\param{const wxValidator\&
}{ validator
}}
2241 Deletes the current validator (if any) and sets the window validator, having called wxValidator::Clone to
2242 create a new validator of this type.
2244 \membersection{wxWindow::Show
}\label{wxwindowshow
}
2246 \func{virtual bool
}{Show
}{\param{const bool
}{ show
}}
2248 Shows or hides the window.
2250 \wxheading{Parameters
}
2252 \docparam{show
}{If TRUE, displays the window and brings it to the front. Otherwise,
2255 \wxheading{See also
}
2257 \helpref{wxWindow::IsShown
}{wxwindowisshown
}
2259 \membersection{wxWindow::TransferDataFromWindow
}\label{wxwindowtransferdatafromwindow
}
2261 \func{virtual bool
}{TransferDataFromWindow
}{\void}
2263 Transfers values from child controls to data areas specified by their validators. Returns
2264 FALSE if a transfer failed.
2266 \wxheading{See also
}
2268 \helpref{wxWindow::TransferDataToWindow
}{wxwindowtransferdatatowindow
},
\rtfsp
2269 \helpref{wxValidator
}{wxvalidator
},
\helpref{wxWindow::Validate
}{wxwindowvalidate
}
2271 \membersection{wxWindow::TransferDataToWindow
}\label{wxwindowtransferdatatowindow
}
2273 \func{virtual bool
}{TransferDataToWindow
}{\void}
2275 Transfers values to child controls from data areas specified by their validators.
2277 \wxheading{Return value
}
2279 Returns FALSE if a transfer failed.
2281 \wxheading{See also
}
2283 \helpref{wxWindow::TransferDataFromWindow
}{wxwindowtransferdatafromwindow
},
\rtfsp
2284 \helpref{wxValidator
}{wxvalidator
},
\helpref{wxWindow::Validate
}{wxwindowvalidate
}
2286 \membersection{wxWindow::Validate
}\label{wxwindowvalidate
}
2288 \func{virtual bool
}{Validate
}{\void}
2290 Validates the current values of the child controls using their validators.
2292 \wxheading{Return value
}
2294 Returns FALSE if any of the validations failed.
2296 \wxheading{See also
}
2298 \helpref{wxWindow::TransferDataFromWindow
}{wxwindowtransferdatafromwindow
},
\rtfsp
2299 \helpref{wxWindow::TransferDataFromWindow
}{wxwindowtransferdatafromwindow
},
\rtfsp
2300 \helpref{wxValidator
}{wxvalidator
}
2302 \membersection{wxWindow::WarpPointer
}\label{wxwindowwarppointer
}
2304 \func{void
}{WarpPointer
}{\param{int
}{ x
},
\param{int
}{ y
}}
2306 Moves the pointer to the given position on the window.
2308 \wxheading{Parameters
}
2310 \docparam{x
}{The new x position for the cursor.
}
2312 \docparam{y
}{The new y position for the cursor.
}