1 \section{\class{wxWindow
}}\label{wxwindow
}
3 wxWindow is the base class for all windows. Any
4 children of the window will be deleted automatically by the destructor
5 before the window itself is deleted.
7 \wxheading{Derived from
}
9 \helpref{wxEvtHandler
}{wxevthandler
}\\
10 \helpref{wxObject
}{wxobject
}
12 \wxheading{Include files
}
16 \wxheading{Window styles
}
18 The following styles can apply to all windows, although they will not always make sense for a particular
22 \begin{twocollist
}\itemsep=
0pt
23 \twocolitem{\windowstyle{wxSIMPLE
\_BORDER}}{Displays a thin border around the window. wxBORDER is the old name
24 for this style. Windows only.
}
25 \twocolitem{\windowstyle{wxDOUBLE
\_BORDER}}{Displays a double border. Windows only.
}
26 \twocolitem{\windowstyle{wxSUNKEN
\_BORDER}}{Displays a sunken border.
}
27 \twocolitem{\windowstyle{wxRAISED
\_BORDER}}{Displays a raised border.
}
28 \twocolitem{\windowstyle{wxSTATIC
\_BORDER}}{Displays a border suitable for a static control. Windows only.
}
29 \twocolitem{\windowstyle{wxTRANSPARENT
\_WINDOW}}{The window is transparent, that is, it will not receive paint
30 events. Windows only.
}
31 \twocolitem{\windowstyle{wxNO
\_3D}}{Prevents the children of this window taking on
3D styles, even though
32 the application-wide policy is for
3D controls. Windows only.
}
33 \twocolitem{\windowstyle{wxTAB
\_TRAVERSAL}}{Use this to enable tab traversal for non-dialog windows.
}
34 \twocolitem{\windowstyle{wxVSCROLL
}}{Use this style to enable a vertical scrollbar. (Still used?)
}
35 \twocolitem{\windowstyle{wxHSCROLL
}}{Use this style to enable a horizontal scrollbar. (Still used?)
}
36 \twocolitem{\windowstyle{wxCLIP
\_CHILDREN}}{Use this style to eliminate flicker caused by the background being
37 repainted, then children being painted over them. Windows only.
}
40 See also
\helpref{window styles overview
}{windowstyles
}.
44 \helpref{Event handling overview
}{eventhandlingoverview
}
46 \latexignore{\rtfignore{\wxheading{Members
}}}
48 \membersection{wxWindow::wxWindow
}
50 \func{}{wxWindow
}{\void}
54 \func{}{wxWindow
}{\param{wxWindow*
}{ parent
},
\param{wxWindowID
}{id
},
55 \param{const wxPoint\&
}{pos = wxDefaultPosition
},
56 \param{const wxSize\&
}{size = wxDefaultSize
},
57 \param{long
}{style =
0},
58 \param{const wxString\&
}{name = wxPanelNameStr
}}
60 Constructs a window, which can be a child of a frame, dialog or any other non-control window.
62 \wxheading{Parameters
}
64 \docparam{parent
}{Pointer to a parent window.
}
66 \docparam{id
}{Window identifier. If -
1, will automatically create an identifier.
}
68 \docparam{pos
}{Window position. wxDefaultPosition is (-
1, -
1) which indicates that wxWindows
69 should generate a default position for the window. If using the wxWindow class directly, supply
72 \docparam{size
}{Window size. wxDefaultSize is (-
1, -
1) which indicates that wxWindows
73 should generate a default size for the window. If no suitable size can be found, the
74 window will be sized to
20x20 pixels so that the window is visible but obviously not
77 \docparam{style
}{Window style. For generic window styles, please see
\helpref{wxWindow
}{wxwindow
}.
}
79 \docparam{name
}{Window name.
}
81 \membersection{wxWindow::
\destruct{wxWindow
}}
83 \func{}{\destruct{wxWindow
}}{\void}
85 Destructor. Deletes all subwindows, then deletes itself. Instead of using
86 the
{\bf delete
} operator explicitly, you should normally
87 use
\helpref{wxWindow::Destroy
}{wxwindowdestroy
} so that wxWindows
88 can delete a window only when it is safe to do so, in idle time.
92 \helpref{Window deletion overview
}{windowdeletionoverview
},
\rtfsp
93 \helpref{wxWindow::OnCloseWindow
}{wxwindowonclosewindow
},
\rtfsp
94 \helpref{wxWindow::Destroy
}{wxwindowdestroy
},
\rtfsp
95 \helpref{wxCloseEvent
}{wxcloseevent
}
97 \membersection{wxWindow::AddChild
}
99 \func{virtual void
}{AddChild
}{\param{wxWindow*
}{child
}}
101 Adds a child window. This is called automatically by window creation
102 functions so should not be required by the application programmer.
104 \wxheading{Parameters
}
106 \docparam{child
}{Child window to add.
}
108 \membersection{wxWindow::CaptureMouse
}\label{wxwindowcapturemouse
}
110 \func{virtual void
}{CaptureMouse
}{\void}
112 Directs all mouse input to this window. Call
\helpref{wxWindow::ReleaseMouse
}{wxwindowreleasemouse
} to
117 \helpref{wxWindow::ReleaseMouse
}{wxwindowreleasemouse
}
119 \membersection{wxWindow::Center
}\label{wxwindowcenter
}
121 \func{void
}{Center
}{\param{int
}{ direction
}}
123 A synonym for
\helpref{Centre
}{wxwindowcentre
}.
125 \membersection{wxWindow::Centre
}\label{wxwindowcentre
}
127 \func{virtual void
}{Centre
}{\param{int
}{ direction = wxHORIZONTAL
}}
131 \wxheading{Parameters
}
133 \docparam{direction
}{Specifies the direction for the centering. May be
{\tt wxHORIZONTAL
},
{\tt wxVERTICAL
}\rtfsp
138 The actual behaviour depends on the derived window. For a frame or dialog box,
139 centring is relative to the whole display. For a panel item, centring is
140 relative to the panel.
144 \helpref{wxWindow::Center
}{wxwindowcenter
}
146 \membersection{wxWindow::Clear
}\label{wxwindowclear
}
148 \func{void
}{Clear
}{\void}
150 Clears the window by filling it with the current background colour. Does not
151 cause an erase background event to be generated.
153 \membersection{wxWindow::ClientToScreen
}
155 \constfunc{virtual void
}{ClientToScreen
}{\param{int*
}{x
},
\param{int*
}{y
}}
157 \constfunc{virtual wxPoint
}{ClientToScreen
}{\param{const wxPoint\&
}{ pt
}}
159 Converts to screen coordinates from coordinates relative to this window.
161 \docparam{x
}{A pointer to a integer value for the x coordinate. Pass the client coordinate in, and
162 a screen coordinate will be passed out.
}
164 \docparam{y
}{A pointer to a integer value for the y coordinate. Pass the client coordinate in, and
165 a screen coordinate will be passed out.
}
167 \docparam{pt
}{The client position for the second form of the function.
}
169 \pythonnote{In place of a single overloaded method name, wxPython
170 implements the following methods:
\par
171 \indented{2cm
}{\begin{twocollist
}
172 \twocolitem{\bf{ClientToScreen(point)
}}{Accepts and returns a wxPoint
}
173 \twocolitem{\bf{ClientToScreenXY(x, y)
}}{Returns a
2-tuple, (x, y)
}
178 \membersection{wxWindow::Close
}\label{wxwindowclose
}
180 \func{virtual bool
}{Close
}{\param{const bool
}{ force = FALSE
}}
182 The purpose of this call is to provide a safer way of destroying a window than using
183 the
{\it delete
} operator.
185 \wxheading{Parameters
}
187 \docparam{force
}{FALSE if the window's close handler should be able to veto the destruction
188 of this window, TRUE if it cannot.
}
192 Close calls the
\helpref{close handler
}{wxcloseevent
} for the window, providing an opportunity for the window to
193 choose whether to destroy the window.
195 The close handler should check whether the window is being deleted forcibly,
196 using
\helpref{wxCloseEvent::GetForce
}{wxcloseeventgetforce
}, in which case it should
197 destroy the window using
\helpref{wxWindow::Destroy
}{wxwindowdestroy
}.
199 Applies to managed windows (wxFrame and wxDialog classes) only.
201 {\it Note
} that calling Close does not guarantee that the window will be destroyed; but it
202 provides a way to simulate a manual close of a window, which may or may not be implemented by
203 destroying the window. The default implementation of wxDialog::OnCloseWindow does not
204 necessarily delete the dialog, since it will simply simulate an wxID
\_CANCEL event which
205 itself only hides the dialog.
207 To guarantee that the window will be destroyed, call
\helpref{wxWindow::Destroy
}{wxwindowdestroy
} instead.
211 \helpref{Window deletion overview
}{windowdeletionoverview
},
\rtfsp
212 \helpref{wxWindow::OnCloseWindow
}{wxwindowonclosewindow
},
\rtfsp
213 \helpref{wxWindow::Destroy
}{wxwindowdestroy
},
\rtfsp
214 \helpref{wxCloseEvent
}{wxcloseevent
}
216 \membersection{wxWindow::ConvertDialogToPixels
}\label{wxwindowconvertdialogtopixels
}
218 \func{wxPoint
}{ConvertDialogToPixels
}{\param{const wxPoint\&
}{ pt
}}
220 \func{wxSize
}{ConvertDialogToPixels
}{\param{const wxSize\&
}{ sz
}}
222 Converts a point or size from dialog units to pixels.
224 For the x dimension, the dialog units are multiplied by the average character width
225 and then divided by
4.
227 For the y dimension, the dialog units are multiplied by the average character height
228 and then divided by
8.
232 Dialog units are used for maintaining a dialog's proportions even if the font changes.
233 Dialogs created using Dialog Editor optionally use dialog units.
235 You can also use these functions programmatically. A convenience macro is defined:
239 #define wxDLG_UNIT(parent, pt) parent->ConvertDialogToPixels(pt)
245 \helpref{wxWindow::ConvertPixelsToDialog
}{wxwindowconvertpixelstodialog
}
247 \pythonnote{In place of a single overloaded method name, wxPython
248 implements the following methods:
\par
249 \indented{2cm
}{\begin{twocollist
}
250 \twocolitem{\bf{ConvertDialogPointToPixels(point)
}}{Accepts and returns a wxPoint
}
251 \twocolitem{\bf{ConvertDialogSizeToPixels(size)
}}{Accepts and returns a wxSize
}
254 Additionally, the following helper functions are defined:
\par
255 \indented{2cm
}{\begin{twocollist
}
256 \twocolitem{\bf{wxDLG
\_PNT(win, point)
}}{Converts a wxPoint from dialog
258 \twocolitem{\bf{wxDLG
\_SZE(win, size)
}}{Converts a wxSize from dialog
264 \membersection{wxWindow::ConvertPixelsToDialog
}\label{wxwindowconvertpixelstodialog
}
266 \func{wxPoint
}{ConvertPixelsToDialog
}{\param{const wxPoint\&
}{ pt
}}
268 \func{wxSize
}{ConvertPixelsToDialog
}{\param{const wxSize\&
}{ sz
}}
270 Converts a point or size from pixels to dialog units.
272 For the x dimension, the pixels are multiplied by
4 and then divided by the average
275 For the y dimension, the pixels are multipled by
8 and then divided by the average
280 Dialog units are used for maintaining a dialog's proportions even if the font changes.
281 Dialogs created using Dialog Editor optionally use dialog units.
285 \helpref{wxWindow::ConvertDialogToPixels
}{wxwindowconvertdialogtopixels
}
288 \pythonnote{In place of a single overloaded method name, wxPython
289 implements the following methods:
\par
290 \indented{2cm
}{\begin{twocollist
}
291 \twocolitem{\bf{ConvertDialogPointToPixels(point)
}}{Accepts and returns a wxPoint
}
292 \twocolitem{\bf{ConvertDialogSizeToPixels(size)
}}{Accepts and returns a wxSize
}
296 \membersection{wxWindow::Destroy
}\label{wxwindowdestroy
}
298 \func{virtual bool
}{Destroy
}{\void}
300 Destroys the window safely. Use this function instead of the delete operator, since
301 different window classes can be destroyed differently. Frames and dialogs
302 are not destroyed immediately when this function is called - they are added
303 to a list of windows to be deleted on idle time, when all the window's events
304 have been processed. This prevents problems with events being sent to non-existant
307 \wxheading{Return value
}
309 TRUE if the window has either been successfully deleted, or it has been added
310 to the list of windows pending real deletion.
312 \membersection{wxWindow::DestroyChildren
}
314 \func{virtual void
}{DestroyChildren
}{\void}
316 Destroys all children of a window. Called automatically by the destructor.
318 \membersection{wxWindow::DragAcceptFiles
}\label{wxwindowdragacceptfiles
}
320 \func{virtual void
}{DragAcceptFiles
}{\param{const bool
}{ accept
}}
322 Enables or disables elibility for drop file events (OnDropFiles).
324 \wxheading{Parameters
}
326 \docparam{accept
}{If TRUE, the window is eligible for drop file events. If FALSE, the window
327 will not accept drop file events.
}
335 \helpref{wxWindow::OnDropFiles
}{wxwindowondropfiles
}
337 \membersection{wxWindow::Enable
}\label{wxwindowenable
}
339 \func{virtual void
}{Enable
}{\param{const bool
}{ enable
}}
341 Enable or disable the window for user input.
343 \wxheading{Parameters
}
345 \docparam{enable
}{If TRUE, enables the window for input. If FALSE, disables the window.
}
349 \helpref{wxWindow::IsEnabled
}{wxwindowisenabled
}
351 \membersection{wxWindow::FindFocus
}\label{wxwindowfindfocus
}
353 \func{static wxWindow*
}{FindFocus
}{\void}
355 Finds the window or control which currently has the keyboard focus.
359 Note that this is a static function, so it can be called without needing a wxWindow pointer.
363 \helpref{wxWindow::SetFocus
}{wxwindowsetfocus
}
365 \membersection{wxWindow::FindWindow
}\label{wxwindowfindwindow
}
367 \func{wxWindow*
}{FindWindow
}{\param{long
}{ id
}}
369 Find a child of this window, by identifier.
371 \func{wxWindow*
}{FindWindow
}{\param{const wxString\&
}{ name
}}
373 Find a child of this window, by name.
375 \pythonnote{In place of a single overloaded method name, wxPython
376 implements the following methods:
\par
377 \indented{2cm
}{\begin{twocollist
}
378 \twocolitem{\bf{FindWindowById(id)
}}{Accepts an integer
}
379 \twocolitem{\bf{FindWindowByName(name)
}}{Accepts a string
}
383 \membersection{wxWindow::Fit
}\label{wxwindowfit
}
385 \func{virtual void
}{Fit
}{\void}
387 Sizes the window so that it fits around its subwindows.
389 \membersection{wxWindow::GetBackgroundColour
}\label{wxwindowgetbackgroundcolour
}
391 \constfunc{virtual wxColour
}{GetBackgroundColour
}{\void}
393 Returns the background colour of the window.
397 \helpref{wxWindow::SetBackgroundColour
}{wxwindowsetbackgroundcolour
},
\rtfsp
398 \helpref{wxWindow::SetForegroundColour
}{wxwindowsetforegroundcolour
},
\rtfsp
399 \helpref{wxWindow::GetForegroundColour
}{wxwindowgetforegroundcolour
},
\rtfsp
400 \helpref{wxWindow::OnEraseBackground
}{wxwindowonerasebackground
}
402 \membersection{wxWindow::GetCharHeight
}
404 \constfunc{virtual int
}{GetCharHeight
}{\void}
406 Returns the character height for this window.
408 \membersection{wxWindow::GetCharWidth
}
410 \constfunc{virtual int
}{GetCharWidth
}{\void}
412 Returns the average character width for this window.
414 \membersection{wxWindow::GetChildren
}
416 \func{wxList\&
}{GetChildren
}{\void}
418 Returns a reference to the list of the window's children.
420 \membersection{wxWindow::GetClientSize
}\label{wxwindowgetclientsize
}
422 \constfunc{virtual void
}{GetClientSize
}{\param{int*
}{width
},
\param{int*
}{height
}}
424 \constfunc{virtual wxSize
}{GetClientSize
}{\void}
426 This gets the size of the window `client area' in pixels. The client area is the
427 area which may be drawn on by the programmer, excluding title bar, border etc.
429 \wxheading{Parameters
}
431 \docparam{width
}{Receives the client width in pixels.
}
433 \docparam{height
}{Receives the client height in pixels.
}
435 \pythonnote{In place of a single overloaded method name, wxPython
436 implements the following methods:
\par
437 \indented{2cm
}{\begin{twocollist
}
438 \twocolitem{\bf{wxGetClientSizeTuple()
}}{Returns a
2-tuple of (width, height)
}
439 \twocolitem{\bf{wxGetClientSize()
}}{Returns a wxSize object
}
443 \membersection{wxWindow::GetConstraints
}\label{wxwindowgetconstraints
}
445 \constfunc{wxLayoutConstraints*
}{GetConstraints
}{\void}
447 Returns a pointer to the window's layout constraints, or NULL if there are none.
449 \membersection{wxWindow::GetDefaultItem
}\label{wxwindowgetdefaultitem
}
451 \constfunc{wxButton*
}{GetDefaultItem
}{\void}
453 Returns a pointer to the button which is the default for this window, or NULL.
455 \membersection{wxWindow::GetDropTarget
}\label{wxwindowgetdroptarget
}
457 \constfunc{wxDropTarget*
}{GetDropTarget
}{\void}
459 Returns the associated drop target, which may be NULL.
463 \helpref{wxWindow::SetDropTarget
}{wxwindowsetdroptarget
},
464 \helpref{Drag and drop overview
}{wxdndoverview
}
466 \membersection{wxWindow::GetEventHandler
}\label{wxwindowgeteventhandler
}
468 \constfunc{wxEvtHandler*
}{GetEventHandler
}{\void}
470 Returns the event handler for this window. By default, the window is its
475 \helpref{wxWindow::SetEventHandler
}{wxwindowseteventhandler
},
\rtfsp
476 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
477 \helpref{wxWindow::PopEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
478 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
479 \helpref{wxEvtHandler
}{wxevthandler
}\rtfsp
481 \membersection{wxWindow::GetFont
}\label{wxwindowgetfont
}
483 \constfunc{wxFont\&
}{GetFont
}{\void}
485 Returns a reference to the font for this window.
489 \helpref{wxWindow::SetFont
}{wxwindowsetfont
}
491 \membersection{wxWindow::GetForegroundColour
}\label{wxwindowgetforegroundcolour
}
493 \func{virtual wxColour
}{GetForegroundColour
}{\void}
495 Returns the foreground colour of the window.
499 The interpretation of foreground colour is open to interpretation according
500 to the window class; it may be the text colour or other colour, or it may not
505 \helpref{wxWindow::SetForegroundColour
}{wxwindowsetforegroundcolour
},
\rtfsp
506 \helpref{wxWindow::SetBackgroundColour
}{wxwindowsetbackgroundcolour
},
\rtfsp
507 \helpref{wxWindow::GetBackgroundColour
}{wxwindowgetbackgroundcolour
}
509 \membersection{wxWindow::GetGrandParent
}
511 \constfunc{wxWindow*
}{GetGrandParent
}{\void}
513 Returns the grandparent of a window, or NULL if there isn't one.
515 \membersection{wxWindow::GetHandle
}
517 \constfunc{void*
}{GetHandle
}{\void}
519 Returns the platform-specific handle of the physical window. Cast it to an appropriate
520 handle, such as
{\bf HWND
} for Windows,
{\bf Widget
} for Motif or
{\bf GtkWidget
} for GTK.
522 \membersection{wxWindow::GetId
}\label{wxwindowgetid
}
524 \constfunc{int
}{GetId
}{\void}
526 Returns the identifier of the window.
530 Each window has an integer identifier. If the application has not provided one
531 (or the default Id -
1) an unique identifier with a negative value will be generated.
535 \helpref{wxWindow::SetId
}{wxwindowsetid
}\rtfsp
536 \helpref{Window identifiers
}{windowids
}
538 \membersection{wxWindow::GetPosition
}
540 \constfunc{virtual void
}{GetPosition
}{\param{int*
}{x
},
\param{int*
}{y
}}
542 This gets the position of the window in pixels, relative to the parent window or
543 if no parent, relative to the whole display.
545 \wxheading{Parameters
}
547 \docparam{x
}{Receives the x position of the window.
}
549 \docparam{y
}{Receives the y position of the window.
}
551 \pythonnote{In place of a single overloaded method name, wxPython
552 implements the following methods:
\par
553 \indented{2cm
}{\begin{twocollist
}
554 \twocolitem{\bf{GetPosition()
}}{Returns a wxPoint
}
555 \twocolitem{\bf{GetPositionTuple()
}}{Returns a tuple (x, y)
}
559 \membersection{wxWindow::GetLabel
}
561 \constfunc{virtual wxString
}{GetLabel
}{\void}
563 Generic way of getting a label from any window, for
564 identification purposes.
568 The interpretation of this function differs from class to class.
569 For frames and dialogs, the value returned is the title. For buttons or static text controls, it is
570 the button text. This function can be useful for meta-programs (such as testing
571 tools or special-needs access programs) which need to identify windows
574 \membersection{wxWindow::GetName
}\label{wxwindowgetname
}
576 \constfunc{virtual wxString
}{GetName
}{\void}
578 Returns the window's name.
582 This name is not guaranteed to be unique; it is up to the programmer to supply an appropriate
583 name in the window constructor or via
\helpref{wxWindow::SetName
}{wxwindowsetname
}.
587 \helpref{wxWindow::SetName
}{wxwindowsetname
}
589 \membersection{wxWindow::GetParent
}
591 \constfunc{virtual wxWindow*
}{GetParent
}{\void}
593 Returns the parent of the window, or NULL if there is no parent.
595 \membersection{wxWindow::GetRect
}\label{wxwindowgetrect
}
597 \constfunc{virtual wxRect
}{GetRect
}{\void}
599 Returns the size and position of the window as a
\helpref{wxRect
}{wxrect
} object.
601 \membersection{wxWindow::GetScrollThumb
}\label{wxwindowgetscrollthumb
}
603 \func{virtual int
}{GetScrollThumb
}{\param{int
}{orientation
}}
605 Returns the built-in scrollbar thumb size.
609 \helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
}
611 \membersection{wxWindow::GetScrollPos
}\label{wxwindowgetscrollpos
}
613 \func{virtual int
}{GetScrollPos
}{\param{int
}{orientation
}}
615 Returns the built-in scrollbar position.
619 See
\helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
}
621 \membersection{wxWindow::GetScrollRange
}\label{wxwindowgetscrollrange
}
623 \func{virtual int
}{GetScrollRange
}{\param{int
}{orientation
}}
625 Returns the built-in scrollbar range.
629 \helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
}
631 \membersection{wxWindow::GetSize
}\label{wxwindowgetsize
}
633 \constfunc{virtual void
}{GetSize
}{\param{int*
}{width
},
\param{int*
}{height
}}
635 \constfunc{virtual wxSize
}{GetSize
}{\void}
637 This gets the size of the entire window in pixels.
639 \wxheading{Parameters
}
641 \docparam{width
}{Receives the window width.
}
643 \docparam{height
}{Receives the window height.
}
645 \pythonnote{In place of a single overloaded method name, wxPython
646 implements the following methods:
\par
647 \indented{2cm
}{\begin{twocollist
}
648 \twocolitem{\bf{GetSize()
}}{Returns a wxSize
}
649 \twocolitem{\bf{GetSizeTuple()
}}{Returns a
2-tuple (width, height)
}
653 \membersection{wxWindow::GetTextExtent
}
655 \constfunc{virtual void
}{GetTextExtent
}{\param{const wxString\&
}{string
},
\param{int*
}{x
},
\param{int*
}{y
},
656 \param{int*
}{descent = NULL
},
\param{int*
}{externalLeading = NULL
},
657 \param{const wxFont*
}{font = NULL
},
\param{const bool
}{ use16 = FALSE
}}
659 Gets the dimensions of the string as it would be drawn on the
660 window with the currently selected font.
662 \wxheading{Parameters
}
664 \docparam{string
}{String whose extent is to be measured.
}
666 \docparam{x
}{Return value for width.
}
668 \docparam{y
}{Return value for height.
}
670 \docparam{descent
}{Return value for descent (optional).
}
672 \docparam{externalLeading
}{Return value for external leading (optional).
}
674 \docparam{font
}{Font to use instead of the current window font (optional).
}
676 \docparam{use16
}{If TRUE,
{\it string
} contains
16-bit characters. The default is FALSE.
}
679 \pythonnote{In place of a single overloaded method name, wxPython
680 implements the following methods:
\par
681 \indented{2cm
}{\begin{twocollist
}
682 \twocolitem{\bf{GetTextExtent(string)
}}{Returns a
2-tuple, (width, height)
}
683 \twocolitem{\bf{GetFullTextExtent(string, font=NULL)
}}{Returns a
684 4-tuple, (width, height, descent, externalLeading)
}
689 \membersection{wxWindow::GetTitle
}\label{wxwindowgettitle
}
691 \func{virtual wxString
}{GetTitle
}{\void}
693 Gets the window's title. Applicable only to frames and dialogs.
697 \helpref{wxWindow::SetTitle
}{wxwindowsettitle
}
699 \membersection{wxWindow::GetUpdateRegion
}\label{wxwindowgetupdateregion
}
701 \constfunc{virtual wxRegion
}{GetUpdateRegion
}{\void}
703 Returns the region specifying which parts of the window have been damaged. Should
704 only be called within an
\helpref{OnPaint
}{wxwindowonpaint
} event handler.
708 \helpref{wxRegion
}{wxregion
},
\helpref{wxRegionIterator
}{wxregioniterator
},
\helpref{wxWindow::OnPaint
}{wxwindowonpaint
}
710 \membersection{wxWindow::GetValidator
}\label{wxwindowgetvalidator
}
712 \constfunc{wxValidator*
}{GetValidator
}{\void}
714 Returns a pointer to the current validator for the window, or NULL if there is none.
716 \membersection{wxWindow::GetWindowStyleFlag
}
718 \constfunc{long
}{GetWindowStyleFlag
}{\void}
720 Gets the window style that was passed to the consructor or
{\bf Create
} member.
721 {\bf GetWindowStyle
} is synonymous.
723 \membersection{wxWindow::InitDialog
}\label{wxwindowinitdialog
}
725 \func{void
}{InitDialog
}{\void}
727 Sends an
\helpref{wxWindow::OnInitDialog
}{wxwindowoninitdialog
} event, which
728 in turn transfers data to the dialog via validators.
732 \helpref{wxWindow::OnInitDialog
}{wxwindowoninitdialog
}
734 \membersection{wxWindow::IsEnabled
}\label{wxwindowisenabled
}
736 \constfunc{virtual bool
}{IsEnabled
}{\void}
738 Returns TRUE if the window is enabled for input, FALSE otherwise.
742 \helpref{wxWindow::Enable
}{wxwindowenable
}
744 \membersection{wxWindow::IsRetained
}\label{wxwindowisretained
}
746 \constfunc{virtual bool
}{IsRetained
}{\void}
748 Returns TRUE if the window is retained, FALSE otherwise.
752 Retained windows are only available on X platforms.
754 \membersection{wxWindow::IsShown
}\label{wxwindowisshown
}
756 \constfunc{virtual bool
}{IsShown
}{\void}
758 Returns TRUE if the window is shown, FALSE if it has been hidden.
760 \membersection{wxWindow::IsTopLevel
}\label{wxwindowistoplevel
}
762 \constfunc{bool
}{IsTopLevel
}{\void}
764 Returns TRUE if the given window is a top-level one. Currently all frames and
765 dialogs are considered to be top-level windows (even if they have a parent
768 \membersection{wxWindow::Layout
}\label{wxwindowlayout
}
770 \func{void
}{Layout
}{\void}
772 Invokes the constraint-based layout algorithm for this window.
774 See
\helpref{wxWindow::SetAutoLayout
}{wxwindowsetautolayout
} on when
775 this function gets called automatically using auto layout.
777 \membersection{wxWindow::LoadFromResource
}\label{wxwindowloadfromresource
}
779 \func{virtual bool
}{LoadFromResource
}{\param{wxWindow*
}{parent
},
\rtfsp
780 \param{const wxString\&
}{resourceName
},
\param{const wxResourceTable*
}{resourceTable = NULL
}}
782 Loads a panel or dialog from a resource file.
784 \wxheading{Parameters
}
786 \docparam{parent
}{Parent window.
}
788 \docparam{resourceName
}{The name of the resource to load.
}
790 \docparam{resourceTable
}{The resource table to load it from. If this is NULL, the
791 default resource table will be used.
}
793 \wxheading{Return value
}
795 TRUE if the operation succeeded, otherwise FALSE.
797 \membersection{wxWindow::Lower
}\label{wxwindowlower
}
799 \func{void
}{Lower
}{\void}
801 Lowers the window to the bottom of the window hierarchy if it is a managed window (dialog
804 \membersection{wxWindow::MakeModal
}\label{wxwindowmakemodal
}
806 \func{virtual void
}{MakeModal
}{\param{const bool
}{flag
}}
808 Disables all other windows in the application so that
809 the user can only interact with this window. (This function
810 is not implemented anywhere).
812 \wxheading{Parameters
}
814 \docparam{flag
}{If TRUE, this call disables all other windows in the application so that
815 the user can only interact with this window. If FALSE, the effect is reversed.
}
817 \membersection{wxWindow::Move
}\label{wxwindowmove
}
819 \func{void
}{Move
}{\param{int
}{ x
},
\param{int
}{ y
}}
821 \func{void
}{Move
}{\param{const wxPoint\&
}{ pt
}}
823 Moves the window to the given position.
825 \wxheading{Parameters
}
827 \docparam{x
}{Required x position.
}
829 \docparam{y
}{Required y position.
}
831 \docparam{pt
}{\helpref{wxPoint
}{wxpoint
} object representing the position.
}
835 Implementations of SetSize can also implicitly implement the
836 wxWindow::Move function, which is defined in the base wxWindow class
840 SetSize(x, y, -
1, -
1, wxSIZE_USE_EXISTING);
845 \helpref{wxWindow::SetSize
}{wxwindowsetsize
}
847 \pythonnote{In place of a single overloaded method name, wxPython
848 implements the following methods:
\par
849 \indented{2cm
}{\begin{twocollist
}
850 \twocolitem{\bf{Move(point)
}}{Accepts a wxPoint
}
851 \twocolitem{\bf{MoveXY(x, y)
}}{Accepts a pair of integers
}
855 \membersection{wxWindow::OnActivate
}\label{wxwindowonactivate
}
857 \func{void
}{OnActivate
}{\param{wxActivateEvent\&
}{ event
}}
859 Called when a window is activated or deactivated.
861 \wxheading{Parameters
}
863 \docparam{event
}{Object containing activation information.
}
867 If the window is being activated,
\helpref{wxActivateEvent::GetActive
}{wxactivateeventgetactive
} returns TRUE,
868 otherwise it returns FALSE (it is being deactivated).
872 \helpref{wxActivateEvent
}{wxactivateevent
},
\rtfsp
873 \helpref{Event handling overview
}{eventhandlingoverview
}
875 \membersection{wxWindow::OnChar
}\label{wxwindowonchar
}
877 \func{void
}{OnChar
}{\param{wxKeyEvent\&
}{ event
}}
879 Called when the user has pressed a key that is not a modifier (SHIFT, CONTROL or ALT).
881 \wxheading{Parameters
}
883 \docparam{event
}{Object containing keypress information. See
\helpref{wxKeyEvent
}{wxkeyevent
} for
884 details about this class.
}
888 This member function is called in response to a keypress. To intercept this event,
889 use the EVT
\_CHAR macro in an event table definition. Your
{\bf OnChar
} handler may call this
890 default function to achieve default keypress functionality.
892 Note that the ASCII values do not have explicit key codes: they are passed as ASCII
895 Note that not all keypresses can be intercepted this way. If you wish to intercept modifier
896 keypresses, then you will need to use
\helpref{wxWindow::OnKeyDown
}{wxwindowonkeydown
} or
897 \helpref{wxWindow::OnKeyUp
}{wxwindowonkeyup
}.
899 Most, but not all, windows allow keypresses to be intercepted.
903 \helpref{wxWindow::OnKeyDown
}{wxwindowonkeydown
},
\helpref{wxWindow::OnKeyUp
}{wxwindowonkeyup
},
\rtfsp
904 \helpref{wxKeyEvent
}{wxkeyevent
},
\helpref{wxWindow::OnCharHook
}{wxwindowoncharhook
},
\rtfsp
905 \helpref{Event handling overview
}{eventhandlingoverview
}
907 \membersection{wxWindow::OnCharHook
}\label{wxwindowoncharhook
}
909 \func{void
}{OnCharHook
}{\param{wxKeyEvent\&
}{ event
}}
911 This member is called to allow the window to intercept keyboard events
912 before they are processed by child windows.
914 \wxheading{Parameters
}
916 \docparam{event
}{Object containing keypress information. See
\helpref{wxKeyEvent
}{wxkeyevent
} for
917 details about this class.
}
921 This member function is called in response to a keypress, if the window is active. To intercept this event,
922 use the EVT
\_CHAR\_HOOK macro in an event table definition. If you do not process a particular
923 keypress, call
\helpref{wxEvent::Skip
}{wxeventskip
} to allow default processing.
925 An example of using this function is in the implementation of escape-character processing for wxDialog,
926 where pressing ESC dismisses the dialog by
{\bf OnCharHook
} 'forging' a cancel button press event.
928 Note that the ASCII values do not have explicit key codes: they are passed as ASCII
931 This function is only relevant to top-level windows (frames and dialogs), and under
932 Windows only. Under GTK the normal EVT
\_CHAR\_ event has the functionality, i.e.
933 you can intercepts it and if you don't call
\helpref{wxEvent::Skip
}{wxeventskip
}
934 the window won't get the event.
938 \helpref{wxKeyEvent
}{wxkeyevent
},
\helpref{wxWindow::OnCharHook
}{wxwindowoncharhook
},
\rtfsp
939 \helpref{wxApp::OnCharHook
}{wxapponcharhook
},
\rtfsp
940 \helpref{Event handling overview
}{eventhandlingoverview
}
942 \membersection{wxWindow::OnCommand
}\label{wxwindowoncommand
}
944 \func{virtual void
}{OnCommand
}{\param{wxEvtHandler\&
}{object
},
\param{wxCommandEvent\&
}{event
}}
946 This virtual member function is called if the control does not handle the command event.
948 \wxheading{Parameters
}
950 \docparam{object
}{Object receiving the command event.
}
952 \docparam{event
}{Command event
}
956 This virtual function is provided mainly for backward compatibility. You can also intercept commands
957 from child controls by using an event table, with identifiers or identifier ranges to identify
958 the control(s) in question.
962 \helpref{wxCommandEvent
}{wxcommandevent
},
\rtfsp
963 \helpref{Event handling overview
}{eventhandlingoverview
}
965 \membersection{wxWindow::OnClose
}\label{wxwindowonclose
}
967 \func{virtual bool
}{OnClose
}{\void}
969 Called when the user has tried to close a a frame
970 or dialog box using the window manager (X) or system menu (Windows).
972 {\bf Note:
} This is an obsolete function.
973 It is superceded by the
\helpref{wxWindow::OnCloseWindow
}{wxwindowonclosewindow
} event
976 \wxheading{Return value
}
978 If TRUE is returned by OnClose, the window will be deleted by the system, otherwise the
979 attempt will be ignored. Do not delete the window from within this handler, although
980 you may delete other windows.
984 \helpref{Window deletion overview
}{windowdeletionoverview
},
\rtfsp
985 \helpref{wxWindow::Close
}{wxwindowclose
},
\rtfsp
986 \helpref{wxWindow::OnCloseWindow
}{wxwindowonclosewindow
},
\rtfsp
987 \helpref{wxCloseEvent
}{wxcloseevent
}
989 \membersection{wxWindow::OnCloseWindow
}\label{wxwindowonclosewindow
}
991 \func{void
}{OnCloseWindow
}{\param{wxCloseEvent\&
}{event
}}
993 This is an event handler function called when the user has tried to close a a frame
994 or dialog box using the window manager (X) or system menu (Windows). It is
995 called via the
\helpref{wxWindow::Close
}{wxwindowclose
} function, so
996 that the application can also invoke the handler programmatically.
998 Use the EVT
\_CLOSE event table macro to handle close events.
1000 You should check whether the application is forcing the deletion of the window
1001 using
\helpref{wxCloseEvent::GetForce
}{wxcloseeventgetforce
}. If this is TRUE,
1002 destroy the window using
\helpref{wxWindow::Destroy
}{wxwindowdestroy
}.
1003 If not, it is up to you whether you respond by destroying the window.
1005 (Note: GetForce is now superceded by CanVeto. So to test whether forced destruction of
1006 the window is required, test for the negative of CanVeto. If CanVeto returns FALSE,
1007 it is not possible to skip window deletion.)
1009 If you don't destroy the window, you should call
\helpref{wxCloseEvent::Veto
}{wxcloseeventveto
} to
1010 let the calling code know that you did not destroy the window. This allows the
\helpref{wxWindow::Close
}{wxwindowclose
} function
1011 to return TRUE or FALSE depending on whether the close instruction was honoured or not.
1015 The
\helpref{wxWindow::OnClose
}{wxwindowonclose
} virtual function remains
1016 for backward compatibility with earlier versions of wxWindows. The
1017 default
{\bf OnCloseWindow
} handler for wxFrame and wxDialog will call
{\bf OnClose
},
1018 destroying the window if it returns TRUE or if the close is being forced.
1020 \wxheading{See also
}
1022 \helpref{Window deletion overview
}{windowdeletionoverview
},
\rtfsp
1023 \helpref{wxWindow::Close
}{wxwindowclose
},
\rtfsp
1024 \helpref{wxWindow::OnClose
}{wxwindowonclose
},
\rtfsp
1025 \helpref{wxWindow::Destroy
}{wxwindowdestroy
},
\rtfsp
1026 \helpref{wxCloseEvent
}{wxcloseevent
},
\rtfsp
1027 \helpref{wxApp::OnQueryEndSession
}{wxapponqueryendsession
},
\rtfsp
1028 \helpref{wxApp::OnEndSession
}{wxapponendsession
}
1030 \membersection{wxWindow::OnDropFiles
}\label{wxwindowondropfiles
}
1032 \func{void
}{OnDropFiles
}{\param{wxDropFilesEvent\&
}{ event
}}
1034 Called when files have been dragged from the file manager to the window.
1036 \wxheading{Parameters
}
1038 \docparam{event
}{Drop files event. For more information, see
\helpref{wxDropFilesEvent
}{wxdropfilesevent
}.
}
1042 The window must have previously been enabled for dropping by calling
1043 \rtfsp\helpref{wxWindow::DragAcceptFiles
}{wxwindowdragacceptfiles
}.
1045 This event is only generated under Windows.
1047 To intercept this event, use the EVT
\_DROP\_FILES macro in an event table definition.
1049 \wxheading{See also
}
1051 \helpref{wxDropFilesEvent
}{wxdropfilesevent
},
\helpref{wxWindow::DragAcceptFiles
}{wxwindowdragacceptfiles
},
\rtfsp
1052 \helpref{Event handling overview
}{eventhandlingoverview
}
1054 \membersection{wxWindow::OnEraseBackground
}\label{wxwindowonerasebackground
}
1056 \func{void
}{OnEraseBackground
}{\param{wxEraseEvent\&
}{ event
}}
1058 Called when the background of the window needs to be erased.
1060 \wxheading{Parameters
}
1062 \docparam{event
}{Erase background event. For more information, see
\helpref{wxEraseEvent
}{wxeraseevent
}.
}
1066 This event is only generated under Windows. It is therefore recommended that
1067 you set the text background colour explicitly in order to prevent flicker.
1068 The default background colour under GTK is grey.
1070 To intercept this event, use the EVT
\_ERASE\_BACKGROUND macro in an event table definition.
1072 \wxheading{See also
}
1074 \helpref{wxEraseEvent
}{wxeraseevent
},
\helpref{Event handling overview
}{eventhandlingoverview
}
1076 \membersection{wxWindow::OnKeyDown
}\label{wxwindowonkeydown
}
1078 \func{void
}{OnKeyDown
}{\param{wxKeyEvent\&
}{ event
}}
1080 Called when the user has pressed a key, before it is translated into an ASCII value using other
1081 modifier keys that might be pressed at the same time.
1083 \wxheading{Parameters
}
1085 \docparam{event
}{Object containing keypress information. See
\helpref{wxKeyEvent
}{wxkeyevent
} for
1086 details about this class.
}
1090 This member function is called in response to a key down event. To intercept this event,
1091 use the EVT
\_KEY\_DOWN macro in an event table definition. Your
{\bf OnKeyDown
} handler may call this
1092 default function to achieve default keypress functionality.
1094 Note that not all keypresses can be intercepted this way. If you wish to intercept special
1095 keys, such as shift, control, and function keys, then you will need to use
\helpref{wxWindow::OnKeyDown
}{wxwindowonkeydown
} or
1096 \helpref{wxWindow::OnKeyUp
}{wxwindowonkeyup
}.
1098 Most, but not all, windows allow keypresses to be intercepted.
1100 \wxheading{See also
}
1102 \helpref{wxWindow::OnChar
}{wxwindowonchar
},
\helpref{wxWindow::OnKeyUp
}{wxwindowonkeyup
},
\rtfsp
1103 \helpref{wxKeyEvent
}{wxkeyevent
},
\helpref{wxWindow::OnCharHook
}{wxwindowoncharhook
},
\rtfsp
1104 \helpref{Event handling overview
}{eventhandlingoverview
}
1106 \membersection{wxWindow::OnKeyUp
}\label{wxwindowonkeyup
}
1108 \func{void
}{OnKeyUp
}{\param{wxKeyEvent\&
}{ event
}}
1110 Called when the user has released a key.
1112 \wxheading{Parameters
}
1114 \docparam{event
}{Object containing keypress information. See
\helpref{wxKeyEvent
}{wxkeyevent
} for
1115 details about this class.
}
1119 This member function is called in response to a key up event. To intercept this event,
1120 use the EVT
\_KEY\_UP macro in an event table definition. Your
{\bf OnKeyUp
} handler may call this
1121 default function to achieve default keypress functionality.
1123 Note that not all keypresses can be intercepted this way. If you wish to intercept special
1124 keys, such as shift, control, and function keys, then you will need to use
\helpref{wxWindow::OnKeyDown
}{wxwindowonkeydown
} or
1125 \helpref{wxWindow::OnKeyUp
}{wxwindowonkeyup
}.
1127 Most, but not all, windows allow key up events to be intercepted.
1129 \wxheading{See also
}
1131 \helpref{wxWindow::OnChar
}{wxwindowonchar
},
\helpref{wxWindow::OnKeyDown
}{wxwindowonkeydown
},
\rtfsp
1132 \helpref{wxKeyEvent
}{wxkeyevent
},
\helpref{wxWindow::OnCharHook
}{wxwindowoncharhook
},
\rtfsp
1133 \helpref{Event handling overview
}{eventhandlingoverview
}
1135 \membersection{wxWindow::OnKillFocus
}\label{wxwindowonkillfocus
}
1137 \func{void
}{OnKillFocus
}{\param{wxFocusEvent\&
}{event
}}
1139 Called when a window's focus is being killed.
1141 \wxheading{Parameters
}
1143 \docparam{event
}{The focus event. For more information, see
\helpref{wxFocusEvent
}{wxfocusevent
}.
}
1147 To intercept this event, use the macro EVT
\_KILL\_FOCUS in an event table definition.
1149 Most, but not all, windows respond to this event.
1151 \wxheading{See also
}
1153 \helpref{wxFocusEvent
}{wxfocusevent
},
\helpref{wxWindow::OnSetFocus
}{wxwindowonsetfocus
},
\rtfsp
1154 \helpref{Event handling overview
}{eventhandlingoverview
}
1156 \membersection{wxWindow::OnIdle
}\label{wxwindowonidle
}
1158 \func{void
}{OnIdle
}{\param{wxIdleEvent\&
}{event
}}
1160 Provide this member function for any processing which needs to be done
1161 when the application is idle.
1163 \wxheading{See also
}
1165 \helpref{wxApp::OnIdle
}{wxapponidle
},
\helpref{wxIdleEvent
}{wxidleevent
}
1167 \membersection{wxWindow::OnInitDialog
}\label{wxwindowoninitdialog
}
1169 \func{void
}{OnInitDialog
}{\param{wxInitDialogEvent\&
}{ event
}}
1171 Default handler for the wxEVT
\_INIT\_DIALOG event. Calls
\helpref{wxWindow::TransferDataToWindow
}{wxwindowtransferdatatowindow
}.
1173 \wxheading{Parameters
}
1175 \docparam{event
}{Dialog initialisation event.
}
1179 Gives the window the default behaviour of transferring data to child controls via
1180 the validator that each control has.
1182 \wxheading{See also
}
1184 \helpref{wxValidator
}{wxvalidator
},
\helpref{wxWindow::TransferDataToWindow
}{wxwindowtransferdatatowindow
}
1186 \membersection{wxWindow::OnMenuCommand
}\label{wxwindowonmenucommand
}
1188 \func{void
}{OnMenuCommand
}{\param{wxCommandEvent\&
}{event
}}
1190 Called when a menu command is received from a menu bar.
1192 \wxheading{Parameters
}
1194 \docparam{event
}{The menu command event. For more information, see
\helpref{wxCommandEvent
}{wxcommandevent
}.
}
1198 A function with this name doesn't actually exist; you can choose any member function to receive
1199 menu command events, using the EVT
\_COMMAND macro for individual commands or EVT
\_COMMAND\_RANGE for
1200 a range of commands.
1202 \wxheading{See also
}
1204 \helpref{wxCommandEvent
}{wxcommandevent
},
\rtfsp
1205 \helpref{wxWindow::OnMenuHighlight
}{wxwindowonmenuhighlight
},
\rtfsp
1206 \helpref{Event handling overview
}{eventhandlingoverview
}
1208 \membersection{wxWindow::OnMenuHighlight
}\label{wxwindowonmenuhighlight
}
1210 \func{void
}{OnMenuHighlight
}{\param{wxMenuEvent\&
}{event
}}
1212 Called when a menu select is received from a menu bar: that is, the
1213 mouse cursor is over a menu item, but the left mouse button has not been
1216 \wxheading{Parameters
}
1218 \docparam{event
}{The menu highlight event. For more information, see
\helpref{wxMenuEvent
}{wxmenuevent
}.
}
1222 You can choose any member function to receive
1223 menu select events, using the EVT
\_MENU\_HIGHLIGHT macro for individual menu items or EVT
\_MENU\_HIGHLIGHT\_ALL macro
1226 The default implementation for
\helpref{wxFrame::OnMenuHighlight
}{wxframeonmenuhighlight
} displays help
1227 text in the first field of the status bar.
1229 This function was known as
{\bf OnMenuSelect
} in earlier versions of wxWindows, but this was confusing
1230 since a selection is normally a left-click action.
1232 \wxheading{See also
}
1234 \helpref{wxMenuEvent
}{wxmenuevent
},
\rtfsp
1235 \helpref{wxWindow::OnMenuCommand
}{wxwindowonmenucommand
},
\rtfsp
1236 \helpref{Event handling overview
}{eventhandlingoverview
}
1239 \membersection{wxWindow::OnMouseEvent
}\label{wxwindowonmouseevent
}
1241 \func{void
}{OnMouseEvent
}{\param{wxMouseEvent\&
}{ event
}}
1243 Called when the user has initiated an event with the
1246 \wxheading{Parameters
}
1248 \docparam{event
}{The mouse event. See
\helpref{wxMouseEvent
}{wxmouseevent
} for
1253 Most, but not all, windows respond to this event.
1255 To intercept this event, use the EVT
\_MOUSE\_EVENTS macro in an event table definition, or individual
1256 mouse event macros such as EVT
\_LEFT\_DOWN.
1258 \wxheading{See also
}
1260 \helpref{wxMouseEvent
}{wxmouseevent
},
\rtfsp
1261 \helpref{Event handling overview
}{eventhandlingoverview
}
1263 \membersection{wxWindow::OnMove
}\label{wxwindowonmove
}
1265 \func{void
}{OnMove
}{\param{wxMoveEvent\&
}{event
}}
1267 Called when a window is moved.
1269 \wxheading{Parameters
}
1271 \docparam{event
}{The move event. For more information, see
\helpref{wxMoveEvent
}{wxmoveevent
}.
}
1275 Use the EVT
\_MOVE macro to intercept move events.
1279 Not currently implemented.
1281 \wxheading{See also
}
1283 \helpref{wxMoveEvent
}{wxmoveevent
},
\rtfsp
1284 \helpref{wxFrame::OnSize
}{wxframeonsize
},
\rtfsp
1285 \helpref{Event handling overview
}{eventhandlingoverview
}
1287 \membersection{wxWindow::OnPaint
}\label{wxwindowonpaint
}
1289 \func{void
}{OnPaint
}{\param{wxPaintEvent\&
}{event
}}
1291 Sent to the event handler when the window must be refreshed.
1293 \wxheading{Parameters
}
1295 \docparam{event
}{Paint event. For more information, see
\helpref{wxPaintEvent
}{wxpaintevent
}.
}
1299 Use the EVT
\_PAINT macro in an event table definition to intercept paint events.
1301 In a paint event handler, the application should always create a
\helpref{wxPaintDC
}{wxpaintdc
} object.
1307 void MyWindow::OnPaint(wxPaintEvent& event)
1316 You can optimize painting by retrieving the rectangles
1317 that have been damaged and only repainting these. The rectangles are in
1318 terms of the client area, and are unscrolled, so you will need to do
1319 some calculations using the current view position to obtain logical,
1322 Here is an example of using the
\helpref{wxRegionIterator
}{wxregioniterator
} class:
1326 // Called when window needs to be repainted.
1327 void MyWindow::OnPaint(wxPaintEvent& event)
1331 // Find Out where the window is scrolled to
1332 int vbX,vbY; // Top left corner of client
1333 ViewStart(&vbX,&vbY);
1335 int vX,vY,vW,vH; // Dimensions of client area in pixels
1336 wxRegionIterator upd(GetUpdateRegion()); // get the update rect list
1345 // Alternatively we can do this:
1347 // upd.GetRect(&rect);
1349 // Repaint this rectangle
1358 \wxheading{See also
}
1360 \helpref{wxPaintEvent
}{wxpaintevent
},
\rtfsp
1361 \helpref{wxPaintDC
}{wxpaintdc
},
\rtfsp
1362 \helpref{Event handling overview
}{eventhandlingoverview
}
1364 \membersection{wxWindow::OnScroll
}\label{wxwindowonscroll
}
1366 \func{void
}{OnScroll
}{\param{wxScrollEvent\&
}{event
}}
1368 Called when a scroll event is received from one of the window's built-in scrollbars.
1370 \wxheading{Parameters
}
1372 \docparam{event
}{Command event. Retrieve the new scroll position by
1373 calling
\helpref{wxScrollEvent::GetPosition
}{wxscrolleventgetposition
}, and the
1374 scrollbar orientation by calling
\helpref{wxScrollEvent::GetOrientation
}{wxscrolleventgetorientation
}.
}
1378 Note that it is not possible to distinguish between horizontal and vertical scrollbars
1379 until the function is executing (you can't have one function for vertical, another
1380 for horizontal events).
1382 \wxheading{See also
}
1384 \helpref{wxScrollEvent
}{wxscrollevent
},
\rtfsp
1385 \helpref{Event handling overview
}{eventhandlingoverview
}
1387 \membersection{wxWindow::OnSetFocus
}\label{wxwindowonsetfocus
}
1389 \func{void
}{OnSetFocus
}{\param{wxFocusEvent\&
}{event
}}
1391 Called when a window's focus is being set.
1393 \wxheading{Parameters
}
1395 \docparam{event
}{The focus event. For more information, see
\helpref{wxFocusEvent
}{wxfocusevent
}.
}
1399 To intercept this event, use the macro EVT
\_SET\_FOCUS in an event table definition.
1401 Most, but not all, windows respond to this event.
1403 \wxheading{See also
}
1405 \helpref{wxFocusEvent
}{wxfocusevent
},
\helpref{wxWindow::OnKillFocus
}{wxwindowonkillfocus
},
\rtfsp
1406 \helpref{Event handling overview
}{eventhandlingoverview
}
1408 \membersection{wxWindow::OnSize
}\label{wxwindowonsize
}
1410 \func{void
}{OnSize
}{\param{wxSizeEvent\&
}{event
}}
1412 Called when the window has been resized.
1414 \wxheading{Parameters
}
1416 \docparam{event
}{Size event. For more information, see
\helpref{wxSizeEvent
}{wxsizeevent
}.
}
1420 You may wish to use this for frames to resize their child windows as appropriate.
1422 Note that the size passed is of
1423 the whole window: call
\helpref{wxWindow::GetClientSize
}{wxwindowgetclientsize
} for the area which may be
1424 used by the application.
1426 \wxheading{See also
}
1428 \helpref{wxSizeEvent
}{wxsizeevent
},
\rtfsp
1429 \helpref{Event handling overview
}{eventhandlingoverview
}
1431 \membersection{wxWindow::OnSysColourChanged
}\label{wxwindowonsyscolourchanged
}
1433 \func{void
}{OnSysColourChanged
}{\param{wxOnSysColourChangedEvent\&
}{event
}}
1435 Called when the user has changed the system colours. Windows only.
1437 \wxheading{Parameters
}
1439 \docparam{event
}{System colour change event. For more information, see
\helpref{wxSysColourChangedEvent
}{wxsyscolourchangedevent
}.
}
1441 \wxheading{See also
}
1443 \helpref{wxSysColourChangedEvent
}{wxsyscolourchangedevent
},
\rtfsp
1444 \helpref{Event handling overview
}{eventhandlingoverview
}
1446 \membersection{wxWindow::PopEventHandler
}\label{wxwindowpopeventhandler
}
1448 \constfunc{wxEvtHandler*
}{PopEventHandler
}{\param{bool
}{deleteHandler = FALSE
}}
1450 Removes and returns the top-most event handler on the event handler stack.
1452 \wxheading{Parameters
}
1454 \docparam{deleteHandler
}{If this is TRUE, the handler will be deleted after it is removed. The
1455 default value is FALSE.
}
1457 \wxheading{See also
}
1459 \helpref{wxWindow::SetEventHandler
}{wxwindowseteventhandler
},
\rtfsp
1460 \helpref{wxWindow::GetEventHandler
}{wxwindowgeteventhandler
},
\rtfsp
1461 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1462 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
1463 \helpref{wxEvtHandler
}{wxevthandler
}\rtfsp
1465 \membersection{wxWindow::PopupMenu
}\label{wxwindowpopupmenu
}
1467 \func{virtual bool
}{PopupMenu
}{\param{wxMenu*
}{menu
},
\param{int
}{x
},
\param{int
}{y
}}
1469 Pops up the given menu at the specified coordinates, relative to this
1470 window, and returns control when the user has dismissed the menu. If a
1471 menu item is selected, the callback defined for the menu is called with
1472 wxMenu and wxCommandEvent reference arguments. The callback should access
1473 the commandInt member of the event to check the selected menu identifier.
1475 \wxheading{Parameters
}
1477 \docparam{menu
}{Menu to pop up.
}
1479 \docparam{x
}{Required x position for the menu to appear.
}
1481 \docparam{y
}{Required y position for the menu to appear.
}
1483 \wxheading{See also
}
1485 \helpref{wxMenu
}{wxmenu
}
1489 Just before the menu is popped up,
\helpref{wxMenu::UpdateUI
}{wxmenuupdateui
} is called
1490 to ensure that the menu items are in the correct state.
1492 \membersection{wxWindow::PushEventHandler
}\label{wxwindowpusheventhandler
}
1494 \func{void
}{PushEventHandler
}{\param{wxEvtHandler*
}{handler
}}
1496 Pushes this event handler onto the event stack for the window.
1498 \wxheading{Parameters
}
1500 \docparam{handler
}{Specifies the handler to be pushed.
}
1504 An event handler is an object that is capable of processing the events
1505 sent to a window. By default, the window is its own event handler, but
1506 an application may wish to substitute another, for example to allow
1507 central implementation of event-handling for a variety of different
1510 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
} allows
1511 an application to set up a chain of event handlers, where an event not handled by one event handler is
1512 handed to the next one in the chain. Use
\helpref{wxWindow::PopEventHandler
}{wxwindowpopeventhandler
} to
1513 remove the event handler.
1515 \wxheading{See also
}
1517 \helpref{wxWindow::SetEventHandler
}{wxwindowseteventhandler
},
\rtfsp
1518 \helpref{wxWindow::GetEventHandler
}{wxwindowgeteventhandler
},
\rtfsp
1519 \helpref{wxWindow::PopEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1520 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
1521 \helpref{wxEvtHandler
}{wxevthandler
}
1523 \membersection{wxWindow::Raise
}\label{wxwindowraise
}
1525 \func{void
}{Raise
}{\void}
1527 Raises the window to the top of the window hierarchy if it is a managed window (dialog
1530 \membersection{wxWindow::Refresh
}\label{wxwindowrefresh
}
1532 \func{virtual void
}{Refresh
}{\param{const bool
}{ eraseBackground = TRUE
},
\param{const wxRect*
}{rect
1535 Causes a message or event to be generated to repaint the
1538 \wxheading{Parameters
}
1540 \docparam{eraseBackground
}{If TRUE, the background will be
1543 \docparam{rect
}{If non-NULL, only the given rectangle will
1544 be treated as damaged.
}
1546 \membersection{wxWindow::ReleaseMouse
}\label{wxwindowreleasemouse
}
1548 \func{virtual void
}{ReleaseMouse
}{\void}
1550 Releases mouse input captured with
\helpref{wxWindow::CaptureMouse
}{wxwindowcapturemouse
}.
1552 \wxheading{See also
}
1554 \helpref{wxWindow::CaptureMouse
}{wxwindowcapturemouse
}
1556 \membersection{wxWindow::RemoveChild
}\label{wxwindowremovechild
}
1558 \func{virtual void
}{RemoveChild
}{\param{wxWindow*
}{child
}}
1560 Removes a child window. This is called automatically by window deletion
1561 functions so should not be required by the application programmer.
1563 \wxheading{Parameters
}
1565 \docparam{child
}{Child window to remove.
}
1567 \membersection{wxWindow::ScreenToClient
}\label{wxwindowscreentoclient
}
1569 \constfunc{virtual void
}{ScreenToClient
}{\param{int*
}{x
},
\param{int*
}{y
}}
1571 \constfunc{virtual wxPoint
}{ScreenToClient
}{\param{const wxPoint\&
}{pt
}}
1573 Converts from screen to client window coordinates.
1575 \wxheading{Parameters
}
1577 \docparam{x
}{Stores the screen x coordinate and receives the client x coordinate.
}
1579 \docparam{y
}{Stores the screen x coordinate and receives the client x coordinate.
}
1581 \docparam{pt
}{The screen position for the second form of the function.
}
1583 \pythonnote{In place of a single overloaded method name, wxPython
1584 implements the following methods:
\par
1585 \indented{2cm
}{\begin{twocollist
}
1586 \twocolitem{\bf{ScreenToClient(point)
}}{Accepts and returns a wxPoint
}
1587 \twocolitem{\bf{ScreenToClientXY(x, y)
}}{Returns a
2-tuple, (x, y)
}
1592 \membersection{wxWindow::ScrollWindow
}\label{wxwindowscrollwindow
}
1594 \func{virtual void
}{ScrollWindow
}{\param{int
}{dx
},
\param{int
}{dy
},
\param{const wxRect*
}{ rect = NULL
}}
1596 Physically scrolls the pixels in the window and move child windows accordingly.
1598 \wxheading{Parameters
}
1600 \docparam{dx
}{Amount to scroll horizontally.
}
1602 \docparam{dy
}{Amount to scroll vertically.
}
1604 \docparam{rect
}{Rectangle to invalidate. If this is NULL, the whole window is invalidated. If you
1605 pass a rectangle corresponding to the area of the window exposed by the scroll, your painting handler
1606 can optimise painting by checking for the invalidated region. This paramter is ignored under GTK,
1607 instead the regions to be invalidated are calculated automatically.
}
1611 Use this function to optimise your scrolling implementations, to minimise the area that must be
1612 redrawn. Note that it is rarely required to call this function from a user program.
1614 \membersection{wxWindow::SetAcceleratorTable
}\label{wxwindowsetacceleratortable
}
1616 \func{virtual void
}{SetAcceleratorTable
}{\param{const wxAcceleratorTable\&
}{ accel
}}
1618 Sets the accelerator table for this window. See
\helpref{wxAcceleratorTable
}{wxacceleratortable
}.
1620 \membersection{wxWindow::SetAutoLayout
}\label{wxwindowsetautolayout
}
1622 \func{void
}{SetAutoLayout
}{\param{const bool
}{ autoLayout
}}
1624 Determines whether the
\helpref{wxWindow::Layout
}{wxwindowlayout
} function will
1625 be called automatically when the window is resized.
1627 \wxheading{Parameters
}
1629 \docparam{autoLayout
}{Set this to TRUE if you wish the Layout function to be called
1630 from within wxWindow::OnSize functions.
}
1634 Note that this function is actually disabled for wxWindow and only indirectly
1635 takes affect for children of wxDialog, wxFrame, wxNotebook and wxSplitterWindow.
1637 \wxheading{See also
}
1639 \helpref{wxWindow::SetConstraints
}{wxwindowsetconstraints
}
1641 \membersection{wxWindow::SetBackgroundColour
}\label{wxwindowsetbackgroundcolour
}
1643 \func{virtual void
}{SetBackgroundColour
}{\param{const wxColour\&
}{colour
}}
1645 Sets the background colour of the window.
1647 \wxheading{Parameters
}
1649 \docparam{colour
}{The colour to be used as the background colour.
}
1653 The background colour is usually painted by the default
\rtfsp
1654 \helpref{wxWindow::OnEraseBackground
}{wxwindowonerasebackground
} event handler function
1655 under Windows and automatically under GTK.
1657 Note that setting the background colour does not cause an immediate refresh, so you
1658 may wish to call
\helpref{wxWindow::Clear
}{wxwindowclear
} or
\helpref{wxWindow::Refresh
}{wxwindowrefresh
} after
1659 calling this function.
1661 Note that when using this functions under GTK, you will disable the so called "themes",
1662 i.e. the user chosen apperance of windows and controls, including the themes of
1663 their parent windows.
1665 \wxheading{See also
}
1667 \helpref{wxWindow::GetBackgroundColour
}{wxwindowgetbackgroundcolour
},
\rtfsp
1668 \helpref{wxWindow::SetForegroundColour
}{wxwindowsetforegroundcolour
},
\rtfsp
1669 \helpref{wxWindow::GetForegroundColour
}{wxwindowgetforegroundcolour
},
\rtfsp
1670 \helpref{wxWindow::Clear
}{wxwindowclear
},
\rtfsp
1671 \helpref{wxWindow::Refresh
}{wxwindowrefresh
},
\rtfsp
1672 \helpref{wxWindow::OnEraseBackground
}{wxwindowonerasebackground
}
1674 \membersection{wxWindow::SetClientSize
}\label{wxwindowsetclientsize
}
1676 \func{virtual void
}{SetClientSize
}{\param{int
}{ width
},
\param{int
}{ height
}}
1678 \func{virtual void
}{SetClientSize
}{\param{const wxSize\&
}{ size
}}
1680 This sets the size of the window client area in pixels. Using this function to size a window
1681 tends to be more device-independent than
\helpref{wxWindow::SetSize
}{wxwindowsetsize
}, since the application need not
1682 worry about what dimensions the border or title bar have when trying to fit the window
1683 around panel items, for example.
1685 \wxheading{Parameters
}
1687 \docparam{width
}{The required client area width.
}
1689 \docparam{height
}{The required client area height.
}
1691 \docparam{size
}{The required client size.
}
1693 \pythonnote{In place of a single overloaded method name, wxPython
1694 implements the following methods:
\par
1695 \indented{2cm
}{\begin{twocollist
}
1696 \twocolitem{\bf{SetClientSize(size)
}}{Accepts a wxSize
}
1697 \twocolitem{\bf{SetClientSizeWH(width, height)
}}{}
1701 \membersection{wxWindow::SetCursor
}\label{wxwindowsetcursor
}
1703 \func{virtual void
}{SetCursor
}{\param{const wxCursor\&
}{cursor
}}
1705 Sets the window's cursor. Notice that setting the cursor for this window does
1706 not set it for its children so you'll need to explicitly call SetCursor() for
1707 them too if you need it.
1709 \wxheading{Parameters
}
1711 \docparam{cursor
}{Specifies the cursor that the window should normally display.
}
1713 \wxheading{See also
}
1715 \helpref{::wxSetCursor
}{wxsetcursor
},
\helpref{wxCursor
}{wxcursor
}
1717 \membersection{wxWindow::SetEventHandler
}\label{wxwindowseteventhandler
}
1719 \func{void
}{SetEventHandler
}{\param{wxEvtHandler*
}{handler
}}
1721 Sets the event handler for this window.
1723 \wxheading{Parameters
}
1725 \docparam{handler
}{Specifies the handler to be set.
}
1729 An event handler is an object that is capable of processing the events
1730 sent to a window. By default, the window is its own event handler, but
1731 an application may wish to substitute another, for example to allow
1732 central implementation of event-handling for a variety of different
1735 It is usually better to use
\helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
} since
1736 this sets up a chain of event handlers, where an event not handled by one event handler is
1737 handed to the next one in the chain.
1739 \wxheading{See also
}
1741 \helpref{wxWindow::GetEventHandler
}{wxwindowgeteventhandler
},
\rtfsp
1742 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1743 \helpref{wxWindow::PopEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1744 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
1745 \helpref{wxEvtHandler
}{wxevthandler
}
1747 \membersection{wxWindow::SetConstraints
}\label{wxwindowsetconstraints
}
1749 \func{void
}{SetConstraints
}{\param{wxLayoutConstraints*
}{constraints
}}
1751 Sets the window to have the given layout constraints. The window
1752 will then own the object, and will take care of its deletion.
1753 If an existing layout constraints object is already owned by the
1754 window, it will be deleted.
1756 \wxheading{Parameters
}
1758 \docparam{constraints
}{The constraints to set. Pass NULL to disassociate and delete the window's
1763 You must call
\helpref{wxWindow::SetAutoLayout
}{wxwindowsetautolayout
} to tell a window to use
1764 the constraints automatically in OnSize; otherwise, you must
1765 override OnSize and call Layout explicitly.
1767 \membersection{wxWindow::SetDropTarget
}\label{wxwindowsetdroptarget
}
1769 \func{void
}{SetDropTarget
}{\param{wxDropTarget*
}{ target
}}
1771 Associates a drop target with this window.
1773 If the window already has a drop target, it is deleted.
1775 \wxheading{See also
}
1777 \helpref{wxWindow::GetDropTarget
}{wxwindowgetdroptarget
},
1778 \helpref{Drag and drop overview
}{wxdndoverview
}
1780 \membersection{wxWindow::SetFocus
}\label{wxwindowsetfocus
}
1782 \func{virtual void
}{SetFocus
}{\void}
1784 This sets the window to receive keyboard input.
1786 \membersection{wxWindow::SetFont
}\label{wxwindowsetfont
}
1788 \func{void
}{SetFont
}{\param{const wxFont\&
}{font
}}
1790 Sets the font for this window.
1792 \wxheading{Parameters
}
1794 \docparam{font
}{Font to associate with this window.
}
1796 \wxheading{See also
}
1798 \helpref{wxWindow::GetFont
}{wxwindowgetfont
}
1800 \membersection{wxWindow::SetForegroundColour
}\label{wxwindowsetforegroundcolour
}
1802 \func{virtual void
}{SetForegroundColour
}{\param{const wxColour\&
}{colour
}}
1804 Sets the foreground colour of the window.
1806 \wxheading{Parameters
}
1808 \docparam{colour
}{The colour to be used as the foreground colour.
}
1812 The interpretation of foreground colour is open to interpretation according
1813 to the window class; it may be the text colour or other colour, or it may not
1816 Note that when using this functions under GTK, you will disable the so called "themes",
1817 i.e. the user chosen apperance of windows and controls, including the themes of
1818 their parent windows.
1820 \wxheading{See also
}
1822 \helpref{wxWindow::GetForegroundColour
}{wxwindowgetforegroundcolour
},
\rtfsp
1823 \helpref{wxWindow::SetBackgroundColour
}{wxwindowsetbackgroundcolour
},
\rtfsp
1824 \helpref{wxWindow::GetBackgroundColour
}{wxwindowgetbackgroundcolour
}
1826 \membersection{wxWindow::SetId
}\label{wxwindowsetid
}
1828 \func{void
}{SetId
}{\param{int
}{ id
}}
1830 Sets the identifier of the window.
1834 Each window has an integer identifier. If the application has not provided one,
1835 an identifier will be generated. Normally, the identifier should be provided
1836 on creation and should not be modified subsequently.
1838 \wxheading{See also
}
1840 \helpref{wxWindow::GetId
}{wxwindowgetid
},
\rtfsp
1841 \helpref{Window identifiers
}{windowids
}
1843 \membersection{wxWindow::SetName
}\label{wxwindowsetname
}
1845 \func{virtual void
}{SetName
}{\param{const wxString\&
}{name
}}
1847 Sets the window's name.
1849 \wxheading{Parameters
}
1851 \docparam{name
}{A name to set for the window.
}
1853 \wxheading{See also
}
1855 \helpref{wxWindow::GetName
}{wxwindowgetname
}
1857 \membersection{wxWindow::SetPalette
}\label{wxwindowsetpalette
}
1859 \func{virtual void
}{SetPalette
}{\param{wxPalette*
}{palette
}}
1861 Obsolete - use
\helpref{wxDC::SetPalette
}{wxdcsetpalette
} instead.
1863 \membersection{wxWindow::SetScrollbar
}\label{wxwindowsetscrollbar
}
1865 \func{virtual void
}{SetScrollbar
}{\param{int
}{orientation
},
\param{int
}{position
},
\rtfsp
1866 \param{int
}{thumbSize
},
\param{int
}{range
},
\rtfsp
1867 \param{const bool
}{refresh = TRUE
}}
1869 Sets the scrollbar properties of a built-in scrollbar.
1871 \wxheading{Parameters
}
1873 \docparam{orientation
}{Determines the scrollbar whose page size is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
1875 \docparam{position
}{The position of the scrollbar in scroll units.
}
1877 \docparam{thumbSize
}{The size of the thumb, or visible portion of the scrollbar, in scroll units.
}
1879 \docparam{range
}{The maximum position of the scrollbar.
}
1881 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
1885 Let's say you wish to display
50 lines of text, using the same font.
1886 The window is sized so that you can only see
16 lines at a time.
1892 SetScrollbar(wxVERTICAL,
0,
16,
50);
1896 Note that with the window at this size, the thumb position can never go
1897 above
50 minus
16, or
34.
1899 You can determine how many lines are currently visible by dividing the current view
1900 size by the character height in pixels.
1902 When defining your own scrollbar behaviour, you will always need to recalculate
1903 the scrollbar settings when the window size changes. You could therefore put your
1904 scrollbar calculations and SetScrollbar
1905 call into a function named AdjustScrollbars, which can be called initially and also
1906 from your
\helpref{wxWindow::OnSize
}{wxwindowonsize
} event handler function.
1908 \wxheading{See also
}
1910 \helpref{Scrolling overview
}{scrollingoverview
},
\rtfsp
1911 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
1914 \membersection{wxWindow::SetScrollPage
}\label{wxwindowsetscrollpage
}
1916 \func{virtual void
}{SetScrollPage
}{\param{int
}{orientation
},
\param{int
}{pageSize
},
\param{const bool
}{refresh = TRUE
}}
1918 Sets the page size of one of the built-in scrollbars.
1920 \wxheading{Parameters
}
1922 \docparam{orientation
}{Determines the scrollbar whose page size is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
1924 \docparam{pageSize
}{Page size in scroll units.
}
1926 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
1930 The page size of a scrollbar is the number of scroll units that the scroll thumb travels when you
1931 click on the area above/left of or below/right of the thumb. Normally you will want a whole visible
1932 page to be scrolled, i.e. the size of the current view (perhaps the window client size). This
1933 value has to be adjusted when the window is resized, since the page size will have changed.
1935 In addition to specifying how far the scroll thumb travels when paging, in Motif and some versions of Windows
1936 the thumb changes size to reflect the page size relative to the length of the
document. When the
1937 document size is only slightly bigger than the current view (window) size, almost all of the scrollbar
1938 will be taken up by the thumb. When the two values become the same, the scrollbar will (on some systems)
1941 Currently, this function should be called before SetPageRange, because of a quirk in the Windows
1942 handling of pages and ranges.
1944 \wxheading{See also
}
1946 \helpref{wxWindow::SetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
1947 \helpref{wxWindow::GetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
1948 \helpref{wxWindow::GetScrollPage
}{wxwindowsetscrollpage
},
\rtfsp
1949 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
1952 \membersection{wxWindow::SetScrollPos
}\label{wxwindowsetscrollpos
}
1954 \func{virtual void
}{SetScrollPos
}{\param{int
}{orientation
},
\param{int
}{pos
},
\param{const bool
}{refresh = TRUE
}}
1956 Sets the position of one of the built-in scrollbars.
1958 \wxheading{Parameters
}
1960 \docparam{orientation
}{Determines the scrollbar whose position is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
1962 \docparam{pos
}{Position in scroll units.
}
1964 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
1968 This function does not directly affect the contents of the window: it is up to the
1969 application to take note of scrollbar attributes and redraw contents accordingly.
1971 \wxheading{See also
}
1973 \helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
},
\rtfsp
1974 \helpref{wxWindow::GetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
1975 \helpref{wxWindow::GetScrollThumb
}{wxwindowgetscrollthumb
},
\rtfsp
1976 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
1979 \membersection{wxWindow::SetScrollRange
}\label{wxwindowsetscrollrange
}
1981 \func{virtual void
}{SetScrollRange
}{\param{int
}{orientation
},
\param{int
}{range
},
\param{const bool
}{refresh = TRUE
}}
1983 Sets the range of one of the built-in scrollbars.
1985 \wxheading{Parameters
}
1987 \docparam{orientation
}{Determines the scrollbar whose range is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
1989 \docparam{range
}{Scroll range.
}
1991 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
1995 The range of a scrollbar is the number of steps that the thumb may travel, rather than the total
1996 object length of the scrollbar. If you are implementing a scrolling window, for example, you
1997 would adjust the scroll range when the window is resized, by subtracting the window view size from the
1998 total virtual window size. When the two sizes are the same (all the window is visible), the range goes to zero
1999 and usually the scrollbar will be automatically hidden.
2001 \wxheading{See also
}
2003 \helpref{wxWindow::SetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
2004 \helpref{wxWindow::SetScrollPage
}{wxwindowsetscrollpage
},
\rtfsp
2005 \helpref{wxWindow::GetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
2006 \helpref{wxWindow::GetScrollPage
}{wxwindowsetscrollpage
},
\rtfsp
2007 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
2010 \membersection{wxWindow::SetSize
}\label{wxwindowsetsize
}
2012 \func{virtual void
}{SetSize
}{\param{int
}{ x
},
\param{int
}{ y
},
\param{int
}{ width
},
\param{int
}{ height
},
2013 \param{int
}{ sizeFlags = wxSIZE
\_AUTO}}
2015 \func{virtual void
}{SetSize
}{\param{const wxRect\&
}{ rect
}}
2017 Sets the size and position of the window in pixels.
2019 \func{virtual void
}{SetSize
}{\param{int
}{ width
},
\param{int
}{ height
}}
2021 \func{virtual void
}{SetSize
}{\param{const wxSize\&
}{ size
}}
2023 Sets the size of the window in pixels.
2025 \wxheading{Parameters
}
2027 \docparam{x
}{Required x position in pixels, or -
1 to indicate that the existing
2028 value should be used.
}
2030 \docparam{y
}{Required y position in pixels, or -
1 to indicate that the existing
2031 value should be used.
}
2033 \docparam{width
}{Required width in pixels, or -
1 to indicate that the existing
2034 value should be used.
}
2036 \docparam{height
}{Required height position in pixels, or -
1 to indicate that the existing
2037 value should be used.
}
2039 \docparam{size
}{\helpref{wxSize
}{wxsize
} object for setting the size.
}
2041 \docparam{rect
}{\helpref{wxRect
}{wxrect
} object for setting the position and size.
}
2043 \docparam{sizeFlags
}{Indicates the interpretation of other parameters. It is a bit list of the following:
2045 {\bf wxSIZE
\_AUTO\_WIDTH}: a -
1 width value is taken to indicate
2046 a wxWindows-supplied default width.\\
2047 {\bf wxSIZE
\_AUTO\_HEIGHT}: a -
1 height value is taken to indicate
2048 a wxWindows-supplied default width.\\
2049 {\bf wxSIZE
\_AUTO}: -
1 size values are taken to indicate
2050 a wxWindows-supplied default size.\\
2051 {\bf wxSIZE
\_USE\_EXISTING}: existing dimensions should be used
2052 if -
1 values are supplied.\\
2053 {\bf wxSIZE
\_ALLOW\_MINUS\_ONE}: allow dimensions of -
1 and less to be interpreted
2054 as real dimensions, not default values.
2059 The second form is a convenience for calling the first form with default
2060 x and y parameters, and must be used with non-default width and height values.
2062 The first form sets the position and optionally size, of the window.
2063 Parameters may be -
1 to indicate either that a default should be supplied
2064 by wxWindows, or that the current value of the dimension should be used.
2066 \wxheading{See also
}
2068 \helpref{wxWindow::Move
}{wxwindowmove
}
2070 \pythonnote{In place of a single overloaded method name, wxPython
2071 implements the following methods:
\par
2072 \indented{2cm
}{\begin{twocollist
}
2073 \twocolitem{\bf{SetDimensions(x, y, width, height, sizeFlags=wxSIZE_AUTO)
}}{}
2074 \twocolitem{\bf{SetSize(size)
}}{}
2075 \twocolitem{\bf{SetPosition(point)
}}{}
2079 \membersection{wxWindow::SetSizeHints
}\label{wxwindowsetsizehints
}
2081 \func{virtual void
}{SetSizeHints
}{\param{int
}{ minW=-
1},
\param{int
}{ minH=-
1},
\param{int
}{ maxW=-
1},
\param{int
}{ maxH=-
1},
2082 \param{int
}{ incW=-
1},
\param{int
}{ incH=-
1}}
2084 Allows specification of minimum and maximum window sizes, and window size increments.
2085 If a pair of values is not set (or set to -
1), the default values will be used.
2087 \wxheading{Parameters
}
2089 \docparam{minW
}{Specifies the minimum width allowable.
}
2091 \docparam{minH
}{Specifies the minimum height allowable.
}
2093 \docparam{maxW
}{Specifies the maximum width allowable.
}
2095 \docparam{maxH
}{Specifies the maximum height allowable.
}
2097 \docparam{incW
}{Specifies the increment for sizing the width (Motif/Xt only).
}
2099 \docparam{incH
}{Specifies the increment for sizing the height (Motif/Xt only).
}
2103 If this function is called, the user will not be able to size the window outside the
2106 The resizing increments are only significant under Motif or Xt.
2108 \membersection{wxWindow::SetTitle
}\label{wxwindowsettitle
}
2110 \func{virtual void
}{SetTitle
}{\param{const wxString\&
}{title
}}
2112 Sets the window's title. Applicable only to frames and dialogs.
2114 \wxheading{Parameters
}
2116 \docparam{title
}{The window's title.
}
2118 \wxheading{See also
}
2120 \helpref{wxWindow::GetTitle
}{wxwindowgettitle
}
2122 \membersection{wxWindow::SetValidator
}\label{wxwindowsetvalidator
}
2124 \func{virtual void
}{SetValidator
}{\param{const wxValidator\&
}{ validator
}}
2126 Deletes the current validator (if any) and sets the window validator, having called wxValidator::Clone to
2127 create a new validator of this type.
2129 \membersection{wxWindow::Show
}\label{wxwindowshow
}
2131 \func{virtual bool
}{Show
}{\param{const bool
}{ show
}}
2133 Shows or hides the window.
2135 \wxheading{Parameters
}
2137 \docparam{show
}{If TRUE, displays the window and brings it to the front. Otherwise,
2140 \wxheading{See also
}
2142 \helpref{wxWindow::IsShown
}{wxwindowisshown
}
2144 \membersection{wxWindow::TransferDataFromWindow
}\label{wxwindowtransferdatafromwindow
}
2146 \func{virtual bool
}{TransferDataFromWindow
}{\void}
2148 Transfers values from child controls to data areas specified by their validators. Returns
2149 FALSE if a transfer failed.
2151 \wxheading{See also
}
2153 \helpref{wxWindow::TransferDataToWindow
}{wxwindowtransferdatatowindow
},
\rtfsp
2154 \helpref{wxValidator
}{wxvalidator
},
\helpref{wxWindow::Validate
}{wxwindowvalidate
}
2156 \membersection{wxWindow::TransferDataToWindow
}\label{wxwindowtransferdatatowindow
}
2158 \func{virtual bool
}{TransferDataToWindow
}{\void}
2160 Transfers values to child controls from data areas specified by their validators.
2162 \wxheading{Return value
}
2164 Returns FALSE if a transfer failed.
2166 \wxheading{See also
}
2168 \helpref{wxWindow::TransferDataFromWindow
}{wxwindowtransferdatafromwindow
},
\rtfsp
2169 \helpref{wxValidator
}{wxvalidator
},
\helpref{wxWindow::Validate
}{wxwindowvalidate
}
2171 \membersection{wxWindow::Validate
}\label{wxwindowvalidate
}
2173 \func{virtual bool
}{Validate
}{\void}
2175 Validates the current values of the child controls using their validators.
2177 \wxheading{Return value
}
2179 Returns FALSE if any of the validations failed.
2181 \wxheading{See also
}
2183 \helpref{wxWindow::TransferDataFromWindow
}{wxwindowtransferdatafromwindow
},
\rtfsp
2184 \helpref{wxWindow::TransferDataFromWindow
}{wxwindowtransferdatafromwindow
},
\rtfsp
2185 \helpref{wxValidator
}{wxvalidator
}
2187 \membersection{wxWindow::WarpPointer
}\label{wxwindowwarppointer
}
2189 \func{void
}{WarpPointer
}{\param{int
}{ x
},
\param{int
}{ y
}}
2191 Moves the pointer to the given position on the window.
2193 \wxheading{Parameters
}
2195 \docparam{x
}{The new x position for the cursor.
}
2197 \docparam{y
}{The new y position for the cursor.
}