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
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.
}
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.
}
35 \twocolitem{\windowstyle{wxHSCROLL
}}{Use this style to enable a horizontal scrollbar.
}
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.
}
75 \docparam{style
}{Window style. For generic window styles, please see
\helpref{wxWindow
}{wxwindow
}.
}
77 \docparam{name
}{Window name.
}
79 \membersection{wxWindow::
\destruct{wxWindow
}}
81 \func{}{\destruct{wxWindow
}}{\void}
83 Destructor. Deletes all subwindows, then deletes itself. Instead of using
84 the
{\bf delete
} operator explicitly, you should normally
85 use
\helpref{wxWindow::Destroy
}{wxwindowdestroy
} so that wxWindows
86 can delete a window only when it is safe to do so, in idle time.
90 \helpref{Window deletion overview
}{windowdeletionoverview
},
\rtfsp
91 \helpref{wxWindow::OnCloseWindow
}{wxwindowonclosewindow
},
\rtfsp
92 \helpref{wxWindow::Destroy
}{wxwindowdestroy
},
\rtfsp
93 \helpref{wxCloseEvent
}{wxcloseevent
}
95 \membersection{wxWindow::AddChild
}
97 \func{virtual void
}{AddChild
}{\param{wxWindow*
}{child
}}
99 Adds a child window. This is called automatically by window creation
100 functions so should not be required by the application programmer.
102 \wxheading{Parameters
}
104 \docparam{child
}{Child window to add.
}
106 \membersection{wxWindow::CaptureMouse
}\label{wxwindowcapturemouse
}
108 \func{virtual void
}{CaptureMouse
}{\void}
110 Directs all mouse input to this window. Call
\helpref{wxWindow::ReleaseMouse
}{wxwindowreleasemouse
} to
115 \helpref{wxWindow::ReleaseMouse
}{wxwindowreleasemouse
}
117 \membersection{wxWindow::Center
}\label{wxwindowcenter
}
119 \func{void
}{Center
}{\param{int
}{ direction
}}
121 A synonym for
\helpref{Centre
}{wxwindowcentre
}.
123 \membersection{wxWindow::Centre
}\label{wxwindowcentre
}
125 \func{virtual void
}{Centre
}{\param{int
}{ direction = wxHORIZONTAL
}}
129 \wxheading{Parameters
}
131 \docparam{direction
}{Specifies the direction for the centering. May be
{\tt wxHORIZONTAL
},
{\tt wxVERTICAL
}\rtfsp
136 The actual behaviour depends on the derived window. For a frame or dialog box,
137 centring is relative to the whole display. For a panel item, centring is
138 relative to the panel.
142 \helpref{wxWindow::Center
}{wxwindowcenter
}
144 \membersection{wxWindow::Clear
}\label{wxwindowclear
}
146 \func{void
}{Clear
}{\void}
148 Clears the window by filling it with the current background colour. Does not
149 cause an erase background event to be generated.
151 \membersection{wxWindow::ClientToScreen
}
153 \constfunc{virtual void
}{ClientToScreen
}{\param{int*
}{x
},
\param{int*
}{y
}}
155 \constfunc{virtual wxPoint
}{ClientToScreen
}{\param{const wxPoint\&
}{ pt
}}
157 Converts to screen coordinates from coordinates relative to this window.
159 \docparam{x
}{A pointer to a integer value for the x coordinate. Pass the client coordinate in, and
160 a screen coordinate will be passed out.
}
162 \docparam{y
}{A pointer to a integer value for the y coordinate. Pass the client coordinate in, and
163 a screen coordinate will be passed out.
}
165 \docparam{pt
}{The client position for the second form of the function.
}
167 \pythonnote{In place of a single overloaded method name, wxPython
168 implements the following methods:
\par
169 \indented{2cm
}{\begin{twocollist
}
170 \twocolitem{\bf{ClientToScreen(point)
}}{Accepts and returns a wxPoint
}
171 \twocolitem{\bf{ClientToScreenXY(x, y)
}}{Returns a
2-tuple, (x, y)
}
176 \membersection{wxWindow::Close
}\label{wxwindowclose
}
178 \func{virtual bool
}{Close
}{\param{const bool
}{ force = FALSE
}}
180 The purpose of this call is to provide a safer way of destroying a window than using
181 the
{\it delete
} operator.
183 \wxheading{Parameters
}
185 \docparam{force
}{FALSE if the window's close handler should be able to veto the destruction
186 of this window, TRUE if it cannot.
}
190 Close calls the
\helpref{close handler
}{wxcloseevent
} for the window, providing an opportunity for the window to
191 choose whether to destroy the window.
193 The close handler should check whether the window is being deleted forcibly,
194 using
\helpref{wxCloseEvent::GetForce
}{wxcloseeventgetforce
}, in which case it should
195 destroy the window using
\helpref{wxWindow::Destroy
}{wxwindowdestroy
}.
197 Applies to managed windows (wxFrame and wxDialog classes) only.
199 {\it Note
} that calling Close does not guarantee that the window will be destroyed; but it
200 provides a way to simulate a manual close of a window, which may or may not be implemented by
201 destroying the window. The default implementation of wxDialog::OnCloseWindow does not
202 necessarily delete the dialog, since it will simply simulate an wxID
\_CANCEL event which
203 itself only hides the dialog.
205 To guarantee that the window will be destroyed, call
\helpref{wxWindow::Destroy
}{wxwindowdestroy
} instead.
209 \helpref{Window deletion overview
}{windowdeletionoverview
},
\rtfsp
210 \helpref{wxWindow::OnCloseWindow
}{wxwindowonclosewindow
},
\rtfsp
211 \helpref{wxWindow::Destroy
}{wxwindowdestroy
},
\rtfsp
212 \helpref{wxCloseEvent
}{wxcloseevent
}
214 \membersection{wxWindow::ConvertDialogToPixels
}\label{wxwindowconvertdialogtopixels
}
216 \func{wxPoint
}{ConvertDialogToPixels
}{\param{const wxPoint\&
}{ pt
}}
218 \func{wxSize
}{ConvertDialogToPixels
}{\param{const wxSize\&
}{ sz
}}
220 Converts a point or size from dialog units to pixels.
222 For the x dimension, the dialog units are multiplied by the average character width
223 and then divided by
4.
225 For the y dimension, the dialog units are multiplied by the average character height
226 and then divided by
8.
230 Dialog units are used for maintaining a dialog's proportions even if the font changes.
231 Dialogs created using Dialog Editor optionally use dialog units.
233 You can also use these functions programmatically. A convenience macro is defined:
237 #define wxDLG_UNIT(parent, pt) parent->ConvertDialogToPixels(pt)
243 \helpref{wxWindow::ConvertPixelsToDialog
}{wxwindowconvertpixelstodialog
}
245 \pythonnote{In place of a single overloaded method name, wxPython
246 implements the following methods:
\par
247 \indented{2cm
}{\begin{twocollist
}
248 \twocolitem{\bf{ConvertDialogPointToPixels(point)
}}{Accepts and returns a wxPoint
}
249 \twocolitem{\bf{ConvertDialogSizeToPixels(size)
}}{Accepts and returns a wxSize
}
252 Additionally, the following helper functions are defined:
\par
253 \indented{2cm
}{\begin{twocollist
}
254 \twocolitem{\bf{wxDLG_PNT(win, point)
}}{Converts a wxPoint from dialog
256 \twocolitem{\bf{wxDLG_SZE(win, size)
}}{Converts a wxSize from dialog
262 \membersection{wxWindow::ConvertPixelsToDialog
}\label{wxwindowconvertpixelstodialog
}
264 \func{wxPoint
}{ConvertPixelsToDialog
}{\param{const wxPoint\&
}{ pt
}}
266 \func{wxSize
}{ConvertPixelsToDialog
}{\param{const wxSize\&
}{ sz
}}
268 Converts a point or size from pixels to dialog units.
270 For the x dimension, the pixels are multiplied by
4 and then divided by the average
273 For the y dimension, the pixels are multipled by
8 and then divided by the average
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.
283 \helpref{wxWindow::ConvertDialogToPixels
}{wxwindowconvertdialogtopixels
}
286 \pythonnote{In place of a single overloaded method name, wxPython
287 implements the following methods:
\par
288 \indented{2cm
}{\begin{twocollist
}
289 \twocolitem{\bf{ConvertDialogPointToPixels(point)
}}{Accepts and returns a wxPoint
}
290 \twocolitem{\bf{ConvertDialogSizeToPixels(size)
}}{Accepts and returns a wxSize
}
294 \membersection{wxWindow::Destroy
}\label{wxwindowdestroy
}
296 \func{virtual bool
}{Destroy
}{\void}
298 Destroys the window safely. Use this function instead of the delete operator, since
299 different window classes can be destroyed differently. Frames and dialogs
300 are not destroyed immediately when this function is called - they are added
301 to a list of windows to be deleted on idle time, when all the window's events
302 have been processed. This prevents problems with events being sent to non-existant
305 \wxheading{Return value
}
307 TRUE if the window has either been successfully deleted, or it has been added
308 to the list of windows pending real deletion.
310 \membersection{wxWindow::DestroyChildren
}
312 \func{virtual void
}{DestroyChildren
}{\void}
314 Destroys all children of a window. Called automatically by the destructor.
316 \membersection{wxWindow::DragAcceptFiles
}\label{wxwindowdragacceptfiles
}
318 \func{virtual void
}{DragAcceptFiles
}{\param{const bool
}{ accept
}}
320 Enables or disables elibility for drop file events (OnDropFiles).
322 \wxheading{Parameters
}
324 \docparam{accept
}{If TRUE, the window is eligible for drop file events. If FALSE, the window
325 will not accept drop file events.
}
333 \helpref{wxWindow::OnDropFiles
}{wxwindowondropfiles
}
335 \membersection{wxWindow::Enable
}\label{wxwindowenable
}
337 \func{virtual void
}{Enable
}{\param{const bool
}{ enable
}}
339 Enable or disable the window for user input.
341 \wxheading{Parameters
}
343 \docparam{enable
}{If TRUE, enables the window for input. If FALSE, disables the window.
}
347 \helpref{wxWindow::IsEnabled
}{wxwindowisenabled
}
349 \membersection{wxWindow::FindFocus
}\label{wxwindowfindfocus
}
351 \func{static wxWindow*
}{FindFocus
}{\void}
353 Finds the window or control which currently has the keyboard focus.
357 Note that this is a static function, so it can be called without needing a wxWindow pointer.
361 \helpref{wxWindow::SetFocus
}{wxwindowsetfocus
}
363 \membersection{wxWindow::FindWindow
}\label{wxwindowfindwindow
}
365 \func{wxWindow*
}{FindWindow
}{\param{long
}{ id
}}
367 Find a child of this window, by identifier.
369 \func{wxWindow*
}{FindWindow
}{\param{const wxString\&
}{ name
}}
371 Find a child of this window, by name.
373 \pythonnote{In place of a single overloaded method name, wxPython
374 implements the following methods:
\par
375 \indented{2cm
}{\begin{twocollist
}
376 \twocolitem{\bf{FindWindowById(id)
}}{Accepts an integer
}
377 \twocolitem{\bf{FindWindowByName(name)
}}{Accepts a string
}
381 \membersection{wxWindow::Fit
}\label{wxwindowfit
}
383 \func{virtual void
}{Fit
}{\void}
385 Sizes the window so that it fits around its subwindows.
387 \membersection{wxWindow::GetBackgroundColour
}\label{wxwindowgetbackgroundcolour
}
389 \constfunc{virtual wxColour
}{GetBackgroundColour
}{\void}
391 Returns the background colour of the window.
395 \helpref{wxWindow::SetBackgroundColour
}{wxwindowsetbackgroundcolour
},
\rtfsp
396 \helpref{wxWindow::SetForegroundColour
}{wxwindowsetforegroundcolour
},
\rtfsp
397 \helpref{wxWindow::GetForegroundColour
}{wxwindowgetforegroundcolour
},
\rtfsp
398 \helpref{wxWindow::OnEraseBackground
}{wxwindowonerasebackground
}
400 \membersection{wxWindow::GetCharHeight
}
402 \constfunc{virtual int
}{GetCharHeight
}{\void}
404 Returns the character height for this window.
406 \membersection{wxWindow::GetCharWidth
}
408 \constfunc{virtual int
}{GetCharWidth
}{\void}
410 Returns the average character width for this window.
412 \membersection{wxWindow::GetChildren
}
414 \func{wxList\&
}{GetChildren
}{\void}
416 Returns a reference to the list of the window's children.
418 \membersection{wxWindow::GetClientSize
}\label{wxwindowgetclientsize
}
420 \constfunc{virtual void
}{GetClientSize
}{\param{int*
}{width
},
\param{int*
}{height
}}
422 \constfunc{virtual wxSize
}{GetClientSize
}{\void}
424 This gets the size of the window `client area' in pixels. The client area is the
425 area which may be drawn on by the programmer, excluding title bar, border etc.
427 \wxheading{Parameters
}
429 \docparam{width
}{Receives the client width in pixels.
}
431 \docparam{height
}{Receives the client height in pixels.
}
433 \pythonnote{In place of a single overloaded method name, wxPython
434 implements the following methods:
\par
435 \indented{2cm
}{\begin{twocollist
}
436 \twocolitem{\bf{wxGetClientSizeTuple()
}}{Returns a
2-tuple of (width, height)
}
437 \twocolitem{\bf{wxGetClientSize()
}}{Returns a wxSize object
}
441 \membersection{wxWindow::GetConstraints
}\label{wxwindowgetconstraints
}
443 \constfunc{wxLayoutConstraints*
}{GetConstraints
}{\void}
445 Returns a pointer to the window's layout constraints, or NULL if there are none.
447 \membersection{wxWindow::GetDefaultItem
}\label{wxwindowgetdefaultitem
}
449 \constfunc{wxButton*
}{GetDefaultItem
}{\void}
451 Returns a pointer to the button which is the default for this window, or NULL.
453 \membersection{wxWindow::GetDropTarget
}\label{wxwindowgetdroptarget
}
455 \constfunc{wxDropTarget*
}{GetDropTarget
}{\void}
457 Returns the associated drop target, which may be NULL.
461 \helpref{wxWindow::SetDropTarget
}{wxwindowsetdroptarget
},
462 \helpref{Drag and drop overview
}{wxdndoverview
}
464 \membersection{wxWindow::GetEventHandler
}\label{wxwindowgeteventhandler
}
466 \constfunc{wxEvtHandler*
}{GetEventHandler
}{\void}
468 Returns the event handler for this window. By default, the window is its
473 \helpref{wxWindow::SetEventHandler
}{wxwindowseteventhandler
},
\rtfsp
474 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
475 \helpref{wxWindow::PopEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
476 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
477 \helpref{wxEvtHandler
}{wxevthandler
}\rtfsp
479 \membersection{wxWindow::GetFont
}\label{wxwindowgetfont
}
481 \constfunc{wxFont\&
}{GetFont
}{\void}
483 Returns a reference to the font for this window.
487 \helpref{wxWindow::SetFont
}{wxwindowsetfont
}
489 \membersection{wxWindow::GetForegroundColour
}\label{wxwindowgetforegroundcolour
}
491 \func{virtual wxColour
}{GetForegroundColour
}{\void}
493 Returns the foreground colour of the window.
497 The interpretation of foreground colour is open to interpretation according
498 to the window class; it may be the text colour or other colour, or it may not
503 \helpref{wxWindow::SetForegroundColour
}{wxwindowsetforegroundcolour
},
\rtfsp
504 \helpref{wxWindow::SetBackgroundColour
}{wxwindowsetbackgroundcolour
},
\rtfsp
505 \helpref{wxWindow::GetBackgroundColour
}{wxwindowgetbackgroundcolour
}
507 \membersection{wxWindow::GetGrandParent
}
509 \constfunc{wxWindow*
}{GetGrandParent
}{\void}
511 Returns the grandparent of a window, or NULL if there isn't one.
513 \membersection{wxWindow::GetHandle
}
515 \constfunc{void*
}{GetHandle
}{\void}
517 Returns the platform-specific handle of the physical window. Cast it to an appropriate
518 handle, such as
{\bf HWND
} for Windows or
{\bf Widget
} for Motif.
520 \membersection{wxWindow::GetId
}\label{wxwindowgetid
}
522 \constfunc{int
}{GetId
}{\void}
524 Returns the identifier of the window.
528 Each window has an integer identifier. If the application has not provided one,
529 an identifier will be generated.
533 \helpref{wxWindow::SetId
}{wxwindowsetid
}\rtfsp
534 \helpref{Window identifiers
}{windowids
}
536 \membersection{wxWindow::GetPosition
}
538 \constfunc{virtual void
}{GetPosition
}{\param{int*
}{x
},
\param{int*
}{y
}}
540 This gets the position of the window in pixels, relative to the parent window or
541 if no parent, relative to the whole display.
543 \wxheading{Parameters
}
545 \docparam{x
}{Receives the x position of the window.
}
547 \docparam{y
}{Receives the y position of the window.
}
549 \pythonnote{In place of a single overloaded method name, wxPython
550 implements the following methods:
\par
551 \indented{2cm
}{\begin{twocollist
}
552 \twocolitem{\bf{GetPosition()
}}{Returns a wxPoint
}
553 \twocolitem{\bf{GetPositionTuple()
}}{Returns a tuple (x, y)
}
557 \membersection{wxWindow::GetLabel
}
559 \constfunc{virtual wxString\&
}{GetLabel
}{\void}
561 Generic way of getting a label from any window, for
562 identification purposes.
566 The interpretation of this function differs from class to class.
567 For frames and dialogs, the value returned is the title. For buttons or static text controls, it is
568 the button text. This function can be useful for meta-programs (such as testing
569 tools or special-needs access programs) which need to identify windows
572 \membersection{wxWindow::GetName
}\label{wxwindowgetname
}
574 \constfunc{virtual wxString\&
}{GetName
}{\void}
576 Returns the window's name.
580 This name is not guaranteed to be unique; it is up to the programmer to supply an appropriate
581 name in the window constructor or via
\helpref{wxWindow::SetName
}{wxwindowsetname
}.
585 \helpref{wxWindow::SetName
}{wxwindowsetname
}
587 \membersection{wxWindow::GetParent
}
589 \constfunc{virtual wxWindow*
}{GetParent
}{\void}
591 Returns the parent of the window, or NULL if there is no parent.
593 \membersection{wxWindow::GetRect
}\label{wxwindowgetrect
}
595 \constfunc{virtual wxRect
}{GetRect
}{\void}
597 Returns the size and position of the window as a
\helpref{wxRect
}{wxrect
} object.
599 \membersection{wxWindow::GetReturnCode
}\label{wxwindowgetreturncode
}
601 \func{int
}{GetReturnCode
}{\void}
603 Gets the return code for this window.
607 A return code is normally associated with a modal dialog, where
\helpref{wxDialog::ShowModal
}{wxdialogshowmodal
} returns
608 a code to the application.
612 \helpref{wxWindow::SetReturnCode
}{wxwindowsetreturncode
},
\helpref{wxDialog::ShowModal
}{wxdialogshowmodal
},
\rtfsp
613 \helpref{wxDialog::EndModal
}{wxdialogendmodal
}
615 \membersection{wxWindow::GetScrollThumb
}\label{wxwindowgetscrollthumb
}
617 \func{virtual int
}{GetScrollThumb
}{\param{int
}{orientation
}}
619 Returns the built-in scrollbar thumb size.
623 \helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
}
625 \membersection{wxWindow::GetScrollPos
}\label{wxwindowgetscrollpos
}
627 \func{virtual int
}{GetScrollPos
}{\param{int
}{orientation
}}
629 Returns the built-in scrollbar position.
633 See
\helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
}
635 \membersection{wxWindow::GetScrollRange
}\label{wxwindowgetscrollrange
}
637 \func{virtual int
}{GetScrollRange
}{\param{int
}{orientation
}}
639 Returns the built-in scrollbar range.
643 \helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
}
645 \membersection{wxWindow::GetSize
}\label{wxwindowgetsize
}
647 \constfunc{virtual void
}{GetSize
}{\param{int*
}{width
},
\param{int*
}{height
}}
649 \constfunc{virtual wxSize
}{GetSize
}{\void}
651 This gets the size of the entire window in pixels.
653 \wxheading{Parameters
}
655 \docparam{width
}{Receives the window width.
}
657 \docparam{height
}{Receives the window height.
}
659 \pythonnote{In place of a single overloaded method name, wxPython
660 implements the following methods:
\par
661 \indented{2cm
}{\begin{twocollist
}
662 \twocolitem{\bf{GetSize()
}}{Returns a wxSize
}
663 \twocolitem{\bf{GetSizeTuple()
}}{Returns a
2-tuple (width, height)
}
667 \membersection{wxWindow::GetTextExtent
}
669 \constfunc{virtual void
}{GetTextExtent
}{\param{const wxString\&
}{string
},
\param{int*
}{x
},
\param{int*
}{y
},
670 \param{int*
}{descent = NULL
},
\param{int*
}{externalLeading = NULL
},
671 \param{const wxFont*
}{font = NULL
},
\param{const bool
}{ use16 = FALSE
}}
673 Gets the dimensions of the string as it would be drawn on the
674 window with the currently selected font.
676 \wxheading{Parameters
}
678 \docparam{string
}{String whose extent is to be measured.
}
680 \docparam{x
}{Return value for width.
}
682 \docparam{y
}{Return value for height.
}
684 \docparam{descent
}{Return value for descent (optional).
}
686 \docparam{externalLeading
}{Return value for external leading (optional).
}
688 \docparam{font
}{Font to use instead of the current window font (optional).
}
690 \docparam{use16
}{If TRUE,
{\it string
} contains
16-bit characters. The default is FALSE.
}
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{GetTextExtent(string)
}}{Returns a
2-tuple, (width, height)
}
697 \twocolitem{\bf{GetFullTextExtent(string, font=NULL)
}}{Returns a
698 4-tuple, (width, height, descent, externalLeading)
}
703 \membersection{wxWindow::GetTitle
}\label{wxwindowgettitle
}
705 \func{virtual wxString
}{GetTitle
}{\void}
707 Gets the window's title. Applicable only to frames and dialogs.
711 \helpref{wxWindow::SetTitle
}{wxwindowsettitle
}
713 \membersection{wxWindow::GetUpdateRegion
}\label{wxwindowgetupdateregion
}
715 \constfunc{virtual wxRegion
}{GetUpdateRegion
}{\void}
717 Returns the region specifying which parts of the window have been damaged. Should
718 only be called within an
\helpref{OnPaint
}{wxwindowonpaint
} event handler.
722 \helpref{wxRegion
}{wxregion
},
\helpref{wxRegionIterator
}{wxregioniterator
},
\helpref{wxWindow::OnPaint
}{wxwindowonpaint
}
724 \membersection{wxWindow::GetWindowStyleFlag
}
726 \constfunc{long
}{GetWindowStyleFlag
}{\void}
728 Gets the window style that was passed to the consructor or
{\bf Create
} member.
730 \membersection{wxWindow::InitDialog
}\label{wxwindowinitdialog
}
732 \func{void
}{InitDialog
}{\void}
734 Sends an
\helpref{wxWindow::OnInitDialog
}{wxwindowoninitdialog
} event, which
735 in turn transfers data to the dialog via validators.
739 \helpref{wxWindow::OnInitDialog
}{wxwindowoninitdialog
}
741 \membersection{wxWindow::IsEnabled
}\label{wxwindowisenabled
}
743 \constfunc{virtual bool
}{IsEnabled
}{\void}
745 Returns TRUE if the window is enabled for input, FALSE otherwise.
749 \helpref{wxWindow::Enable
}{wxwindowenable
}
751 \membersection{wxWindow::IsRetained
}\label{wxwindowisretained
}
753 \constfunc{virtual bool
}{IsRetained
}{\void}
755 Returns TRUE if the window is retained, FALSE otherwise.
759 Retained windows are only available on X platforms.
761 \membersection{wxWindow::IsShown
}\label{wxwindowisshown
}
763 \constfunc{virtual bool
}{IsShown
}{\void}
765 Returns TRUE if the window is shown, FALSE if it has been hidden.
767 \membersection{wxWindow::Layout
}\label{wxwindowlayout
}
769 \func{void
}{Layout
}{\void}
771 Invokes the constraint-based layout algorithm for this window. It is called
772 automatically by the default
{\bf wxWindow::OnSize
} member.
774 \membersection{wxWindow::LoadFromResource
}\label{wxwindowloadfromresource
}
776 \func{virtual bool
}{LoadFromResource
}{\param{wxWindow*
}{parent
},
\rtfsp
777 \param{const wxString\&
}{resourceName
},
\param{const wxResourceTable*
}{resourceTable = NULL
}}
779 Loads a panel or dialog from a resource file.
781 \wxheading{Parameters
}
783 \docparam{parent
}{Parent window.
}
785 \docparam{resourceName
}{The name of the resource to load.
}
787 \docparam{resourceTable
}{The resource table to load it from. If this is NULL, the
788 default resource table will be used.
}
790 \wxheading{Return value
}
792 TRUE if the operation succeeded, otherwise FALSE.
794 \membersection{wxWindow::Lower
}\label{wxwindowlower
}
796 \func{void
}{Lower
}{\void}
798 Lowers the window to the bottom of the window hierarchy if it is a managed window (dialog
801 \membersection{wxWindow::MakeModal
}\label{wxwindowmakemodal
}
803 \func{virtual void
}{MakeModal
}{\param{const bool
}{flag
}}
805 Disables all other windows in the application so that
806 the user can only interact with this window.
808 \wxheading{Parameters
}
810 \docparam{flag
}{If TRUE, this call disables all other windows in the application so that
811 the user can only interact with this window. If FALSE, the effect is reversed.
}
813 \membersection{wxWindow::Move
}\label{wxwindowmove
}
815 \func{void
}{Move
}{\param{int
}{ x
},
\param{int
}{ y
}}
817 \func{void
}{Move
}{\param{const wxPoint\&
}{ pt
}}
819 Moves the window to the given position.
821 \wxheading{Parameters
}
823 \docparam{x
}{Required x position.
}
825 \docparam{y
}{Required y position.
}
827 \docparam{pt
}{\helpref{wxPoint
}{wxpoint
} object representing the position.
}
831 Implementations of SetSize can also implicitly implement the
832 wxWindow::Move function, which is defined in the base wxWindow class
836 SetSize(x, y, -
1, -
1, wxSIZE_USE_EXISTING);
841 \helpref{wxWindow::SetSize
}{wxwindowsetsize
}
843 \pythonnote{In place of a single overloaded method name, wxPython
844 implements the following methods:
\par
845 \indented{2cm
}{\begin{twocollist
}
846 \twocolitem{\bf{Move(point)
}}{Accepts a wxPoint
}
847 \twocolitem{\bf{MoveXY(x, y)
}}{Accepts a pair of integers
}
851 \membersection{wxWindow::OnActivate
}\label{wxwindowonactivate
}
853 \func{void
}{OnActivate
}{\param{wxActivateEvent\&
}{ event
}}
855 Called when a window is activated or deactivated.
857 \wxheading{Parameters
}
859 \docparam{event
}{Object containing activation information.
}
863 If the window is being activated,
\helpref{wxActivateEvent::GetActive
}{wxactivateeventgetactive
} returns TRUE,
864 otherwise it returns FALSE (it is being deactivated).
868 \helpref{wxActivateEvent
}{wxactivateevent
},
\rtfsp
869 \helpref{Event handling overview
}{eventhandlingoverview
}
871 \membersection{wxWindow::OnChar
}\label{wxwindowonchar
}
873 \func{void
}{OnChar
}{\param{wxKeyEvent\&
}{ event
}}
875 Called when the user has pressed a key that is not a modifier (SHIFT, CONTROL or ALT).
877 \wxheading{Parameters
}
879 \docparam{event
}{Object containing keypress information. See
\helpref{wxKeyEvent
}{wxkeyevent
} for
880 details about this class.
}
884 This member function is called in response to a keypress. To intercept this event,
885 use the EVT
\_CHAR macro in an event table definition. Your
{\bf OnChar
} handler may call this
886 default function to achieve default keypress functionality.
888 Note that the ASCII values do not have explicit key codes: they are passed as ASCII
891 Note that not all keypresses can be intercepted this way. If you wish to intercept modifier
892 keypresses, then you will need to use
\helpref{wxWindow::OnKeyDown
}{wxwindowonkeydown
} or
893 \helpref{wxWindow::OnKeyUp
}{wxwindowonkeyup
}.
895 Most, but not all, windows allow keypresses to be intercepted.
899 \helpref{wxWindow::OnKeyDown
}{wxwindowonkeydown
},
\helpref{wxWindow::OnKeyUp
}{wxwindowonkeyup
},
\rtfsp
900 \helpref{wxKeyEvent
}{wxkeyevent
},
\helpref{wxWindow::OnCharHook
}{wxwindowoncharhook
},
\rtfsp
901 \helpref{Event handling overview
}{eventhandlingoverview
}
903 \membersection{wxWindow::OnCharHook
}\label{wxwindowoncharhook
}
905 \func{void
}{OnCharHook
}{\param{wxKeyEvent\&
}{ event
}}
907 This member is called to allow the window to intercept keyboard events
908 before they are processed by child windows.
910 \wxheading{Parameters
}
912 \docparam{event
}{Object containing keypress information. See
\helpref{wxKeyEvent
}{wxkeyevent
} for
913 details about this class.
}
917 This member function is called in response to a keypress, if the window is active. To intercept this event,
918 use the EVT
\_CHAR\_HOOK macro in an event table definition. If you do not process a particular
919 keypress, call
\helpref{wxEvent::Skip
}{wxeventskip
} to allow default processing.
921 An example of using this function is in the implementation of escape-character processing for wxDialog,
922 where pressing ESC dismisses the dialog by
{\bf OnCharHook
} 'forging' a cancel button press event.
924 Note that the ASCII values do not have explicit key codes: they are passed as ASCII
927 This function is only relevant to top-level windows (frames and dialogs), and under
932 \helpref{wxKeyEvent
}{wxkeyevent
},
\helpref{wxWindow::OnCharHook
}{wxwindowoncharhook
},
\rtfsp
933 \helpref{wxApp::OnCharHook
}{wxapponcharhook
},
\rtfsp
934 \helpref{Event handling overview
}{eventhandlingoverview
}
936 \membersection{wxWindow::OnCommand
}\label{wxwindowoncommand
}
938 \func{virtual void
}{OnCommand
}{\param{wxEvtHandler\&
}{object
},
\param{wxCommandEvent\&
}{event
}}
940 This virtual member function is called if the control does not handle the command event.
942 \wxheading{Parameters
}
944 \docparam{object
}{Object receiving the command event.
}
946 \docparam{event
}{Command event
}
950 This virtual function is provided mainly for backward compatibility. You can also intercept commands
951 from child controls by using an event table, with identifiers or identifier ranges to identify
952 the control(s) in question.
956 \helpref{wxCommandEvent
}{wxcommandevent
},
\rtfsp
957 \helpref{Event handling overview
}{eventhandlingoverview
}
959 \membersection{wxWindow::OnClose
}\label{wxwindowonclose
}
961 \func{virtual bool
}{OnClose
}{\void}
963 Called when the user has tried to close a a frame
964 or dialog box using the window manager (X) or system menu (Windows).
966 {\bf Note:
} This is an obsolete function.
967 It is superceded by the
\helpref{wxWindow::OnCloseWindow
}{wxwindowonclosewindow
} event
970 \wxheading{Return value
}
972 If TRUE is returned by OnClose, the window will be deleted by the system, otherwise the
973 attempt will be ignored. Do not delete the window from within this handler, although
974 you may delete other windows.
978 \helpref{Window deletion overview
}{windowdeletionoverview
},
\rtfsp
979 \helpref{wxWindow::Close
}{wxwindowclose
},
\rtfsp
980 \helpref{wxWindow::OnCloseWindow
}{wxwindowonclosewindow
},
\rtfsp
981 \helpref{wxCloseEvent
}{wxcloseevent
}
983 \membersection{wxWindow::OnCloseWindow
}\label{wxwindowonclosewindow
}
985 \func{void
}{OnCloseWindow
}{\param{wxCloseEvent\&
}{event
}}
987 This is an event handler function called when the user has tried to close a a frame
988 or dialog box using the window manager (X) or system menu (Windows). It is
989 called via the
\helpref{wxWindow::Close
}{wxwindowclose
} function, so
990 that the application can also invoke the handler programmatically.
992 Use the EVT
\_CLOSE event table macro to handle close events.
994 You should check whether the application is forcing the deletion of the window
995 using
\helpref{wxCloseEvent::GetForce
}{wxcloseeventgetforce
}. If this is TRUE,
996 destroy the window using
\helpref{wxWindow::Destroy
}{wxwindowdestroy
}.
997 If not, it is up to you whether you respond by destroying the window.
999 (Note: GetForce is now superceded by CanVeto. So to test whether forced destruction of
1000 the window is required, test for the negative of CanVeto. If CanVeto returns FALSE,
1001 it is not possible to skip window deletion.)
1003 If you don't destroy the window, you should call
\helpref{wxCloseEvent::Veto
}{wxcloseeventveto
} to
1004 let the calling code know that you did not destroy the window. This allows the
\helpref{wxWindow::Close
}{wxwindowclose
} function
1005 to return TRUE or FALSE depending on whether the close instruction was honoured or not.
1009 The
\helpref{wxWindow::OnClose
}{wxwindowonclose
} virtual function remains
1010 for backward compatibility with earlier versions of wxWindows. The
1011 default
{\bf OnCloseWindow
} handler for wxFrame and wxDialog will call
{\bf OnClose
},
1012 destroying the window if it returns TRUE or if the close is being forced.
1014 \wxheading{See also
}
1016 \helpref{Window deletion overview
}{windowdeletionoverview
},
\rtfsp
1017 \helpref{wxWindow::Close
}{wxwindowclose
},
\rtfsp
1018 \helpref{wxWindow::OnClose
}{wxwindowonclose
},
\rtfsp
1019 \helpref{wxWindow::Destroy
}{wxwindowdestroy
},
\rtfsp
1020 \helpref{wxCloseEvent
}{wxcloseevent
},
\rtfsp
1021 \helpref{wxApp::OnQueryEndSession
}{wxapponqueryendsession
},
\rtfsp
1022 \helpref{wxApp::OnEndSession
}{wxapponendsession
}
1024 \membersection{wxWindow::OnDropFiles
}\label{wxwindowondropfiles
}
1026 \func{void
}{OnDropFiles
}{\param{wxDropFilesEvent\&
}{ event
}}
1028 Called when files have been dragged from the file manager to the window.
1030 \wxheading{Parameters
}
1032 \docparam{event
}{Drop files event. For more information, see
\helpref{wxDropFilesEvent
}{wxdropfilesevent
}.
}
1036 The window must have previously been enabled for dropping by calling
1037 \rtfsp\helpref{wxWindow::DragAcceptFiles
}{wxwindowdragacceptfiles
}.
1039 This event is only generated under Windows.
1041 To intercept this event, use the EVT
\_DROP\_FILES macro in an event table definition.
1043 \wxheading{See also
}
1045 \helpref{wxDropFilesEvent
}{wxdropfilesevent
},
\helpref{wxWindow::DragAcceptFiles
}{wxwindowdragacceptfiles
},
\rtfsp
1046 \helpref{Event handling overview
}{eventhandlingoverview
}
1048 \membersection{wxWindow::OnEraseBackground
}\label{wxwindowonerasebackground
}
1050 \func{void
}{OnEraseBackground
}{\param{wxEraseEvent\&
}{ event
}}
1052 Called when the background of the window needs to be erased.
1054 \wxheading{Parameters
}
1056 \docparam{event
}{Erase background event. For more information, see
\helpref{wxEraseEvent
}{wxeraseevent
}.
}
1060 This event is only generated under Windows.
1062 To intercept this event, use the EVT
\_ERASE\_BACKGROUND macro in an event table definition.
1064 \wxheading{See also
}
1066 \helpref{wxEraseEvent
}{wxeraseevent
},
\helpref{Event handling overview
}{eventhandlingoverview
}
1068 \membersection{wxWindow::OnKeyDown
}\label{wxwindowonkeydown
}
1070 \func{void
}{OnKeyDown
}{\param{wxKeyEvent\&
}{ event
}}
1072 Called when the user has pressed a key, before it is translated into an ASCII value using other
1073 modifier keys that might be pressed at the same time.
1075 \wxheading{Parameters
}
1077 \docparam{event
}{Object containing keypress information. See
\helpref{wxKeyEvent
}{wxkeyevent
} for
1078 details about this class.
}
1082 This member function is called in response to a key down event. To intercept this event,
1083 use the EVT
\_KEY\_DOWN macro in an event table definition. Your
{\bf OnKeyDown
} handler may call this
1084 default function to achieve default keypress functionality.
1086 Note that not all keypresses can be intercepted this way. If you wish to intercept special
1087 keys, such as shift, control, and function keys, then you will need to use
\helpref{wxWindow::OnKeyDown
}{wxwindowonkeydown
} or
1088 \helpref{wxWindow::OnKeyUp
}{wxwindowonkeyup
}.
1090 Most, but not all, windows allow keypresses to be intercepted.
1092 \wxheading{See also
}
1094 \helpref{wxWindow::OnChar
}{wxwindowonchar
},
\helpref{wxWindow::OnKeyUp
}{wxwindowonkeyup
},
\rtfsp
1095 \helpref{wxKeyEvent
}{wxkeyevent
},
\helpref{wxWindow::OnCharHook
}{wxwindowoncharhook
},
\rtfsp
1096 \helpref{Event handling overview
}{eventhandlingoverview
}
1098 \membersection{wxWindow::OnKeyUp
}\label{wxwindowonkeyup
}
1100 \func{void
}{OnKeyUp
}{\param{wxKeyEvent\&
}{ event
}}
1102 Called when the user has released a key.
1104 \wxheading{Parameters
}
1106 \docparam{event
}{Object containing keypress information. See
\helpref{wxKeyEvent
}{wxkeyevent
} for
1107 details about this class.
}
1111 This member function is called in response to a key up event. To intercept this event,
1112 use the EVT
\_KEY\_UP macro in an event table definition. Your
{\bf OnKeyUp
} handler may call this
1113 default function to achieve default keypress functionality.
1115 Note that not all keypresses can be intercepted this way. If you wish to intercept special
1116 keys, such as shift, control, and function keys, then you will need to use
\helpref{wxWindow::OnKeyDown
}{wxwindowonkeydown
} or
1117 \helpref{wxWindow::OnKeyUp
}{wxwindowonkeyup
}.
1119 Most, but not all, windows allow key up events to be intercepted.
1121 \wxheading{See also
}
1123 \helpref{wxWindow::OnChar
}{wxwindowonchar
},
\helpref{wxWindow::OnKeyDown
}{wxwindowonkeydown
},
\rtfsp
1124 \helpref{wxKeyEvent
}{wxkeyevent
},
\helpref{wxWindow::OnCharHook
}{wxwindowoncharhook
},
\rtfsp
1125 \helpref{Event handling overview
}{eventhandlingoverview
}
1127 \membersection{wxWindow::OnKillFocus
}\label{wxwindowonkillfocus
}
1129 \func{void
}{OnKillFocus
}{\param{wxFocusEvent\&
}{event
}}
1131 Called when a window's focus is being killed.
1133 \wxheading{Parameters
}
1135 \docparam{event
}{The focus event. For more information, see
\helpref{wxFocusEvent
}{wxfocusevent
}.
}
1139 To intercept this event, use the macro EVT
\_KILL\_FOCUS in an event table definition.
1141 Most, but not all, windows respond to this event.
1143 \wxheading{See also
}
1145 \helpref{wxFocusEvent
}{wxfocusevent
},
\helpref{wxWindow::OnSetFocus
}{wxwindowonsetfocus
},
\rtfsp
1146 \helpref{Event handling overview
}{eventhandlingoverview
}
1148 \membersection{wxWindow::OnIdle
}\label{wxwindowonidle
}
1150 \func{void
}{OnIdle
}{\param{wxIdleEvent\&
}{event
}}
1152 Provide this member function for any processing which needs to be done
1153 when the application is idle.
1155 \wxheading{See also
}
1157 \helpref{wxApp::OnIdle
}{wxapponidle
},
\helpref{wxIdleEvent
}{wxidleevent
}
1159 \membersection{wxWindow::OnInitDialog
}\label{wxwindowoninitdialog
}
1161 \func{void
}{OnInitDialog
}{\param{wxInitDialogEvent\&
}{ event
}}
1163 Default handler for the wxEVT
\_INIT\_DIALOG event. Calls
\helpref{wxWindow::TransferDataToWindow
}{wxwindowtransferdatatowindow
}.
1165 \wxheading{Parameters
}
1167 \docparam{event
}{Dialog initialisation event.
}
1171 Gives the window the default behaviour of transferring data to child controls via
1172 the validator that each control has.
1174 \wxheading{See also
}
1176 \helpref{wxValidator
}{wxvalidator
},
\helpref{wxWindow::TransferDataToWindow
}{wxwindowtransferdatatowindow
}
1178 \membersection{wxWindow::OnMenuCommand
}\label{wxwindowonmenucommand
}
1180 \func{void
}{OnMenuCommand
}{\param{wxCommandEvent\&
}{event
}}
1182 Called when a menu command is received from a menu bar.
1184 \wxheading{Parameters
}
1186 \docparam{event
}{The menu command event. For more information, see
\helpref{wxCommandEvent
}{wxcommandevent
}.
}
1190 A function with this name doesn't actually exist; you can choose any member function to receive
1191 menu command events, using the EVT
\_COMMAND macro for individual commands or EVT
\_COMMAND\_RANGE for
1192 a range of commands.
1194 \wxheading{See also
}
1196 \helpref{wxCommandEvent
}{wxcommandevent
},
\rtfsp
1197 \helpref{wxWindow::OnMenuHighlight
}{wxwindowonmenuhighlight
},
\rtfsp
1198 \helpref{Event handling overview
}{eventhandlingoverview
}
1200 \membersection{wxWindow::OnMenuHighlight
}\label{wxwindowonmenuhighlight
}
1202 \func{void
}{OnMenuHighlight
}{\param{wxMenuEvent\&
}{event
}}
1204 Called when a menu select is received from a menu bar: that is, the
1205 mouse cursor is over a menu item, but the left mouse button has not been
1208 \wxheading{Parameters
}
1210 \docparam{event
}{The menu highlight event. For more information, see
\helpref{wxMenuEvent
}{wxmenuevent
}.
}
1214 You can choose any member function to receive
1215 menu select events, using the EVT
\_MENU\_HIGHLIGHT macro for individual menu items or EVT
\_MENU\_HIGHLIGHT\_ALL macro
1218 The default implementation for
\helpref{wxFrame::OnMenuHighlight
}{wxframeonmenuhighlight
} displays help
1219 text in the first field of the status bar.
1221 This function was known as
{\bf OnMenuSelect
} in earlier versions of wxWindows, but this was confusing
1222 since a selection is normally a left-click action.
1224 \wxheading{See also
}
1226 \helpref{wxMenuEvent
}{wxmenuevent
},
\rtfsp
1227 \helpref{wxWindow::OnMenuCommand
}{wxwindowonmenucommand
},
\rtfsp
1228 \helpref{Event handling overview
}{eventhandlingoverview
}
1231 \membersection{wxWindow::OnMouseEvent
}\label{wxwindowonmouseevent
}
1233 \func{void
}{OnMouseEvent
}{\param{wxMouseEvent\&
}{ event
}}
1235 Called when the user has initiated an event with the
1238 \wxheading{Parameters
}
1240 \docparam{event
}{The mouse event. See
\helpref{wxMouseEvent
}{wxmouseevent
} for
1245 Most, but not all, windows respond to this event.
1247 To intercept this event, use the EVT
\_MOUSE\_EVENTS macro in an event table definition, or individual
1248 mouse event macros such as EVT
\_LEFT\_DOWN.
1250 \wxheading{See also
}
1252 \helpref{wxMouseEvent
}{wxmouseevent
},
\rtfsp
1253 \helpref{Event handling overview
}{eventhandlingoverview
}
1255 \membersection{wxWindow::OnMove
}\label{wxwindowonmove
}
1257 \func{void
}{OnMove
}{\param{wxMoveEvent\&
}{event
}}
1259 Called when a window is moved.
1261 \wxheading{Parameters
}
1263 \docparam{event
}{The move event. For more information, see
\helpref{wxMoveEvent
}{wxmoveevent
}.
}
1267 Use the EVT
\_MOVE macro to intercept move events.
1271 Not currently implemented.
1273 \wxheading{See also
}
1275 \helpref{wxMoveEvent
}{wxmoveevent
},
\rtfsp
1276 \helpref{wxFrame::OnSize
}{wxframeonsize
},
\rtfsp
1277 \helpref{Event handling overview
}{eventhandlingoverview
}
1279 \membersection{wxWindow::OnPaint
}\label{wxwindowonpaint
}
1281 \func{void
}{OnPaint
}{\param{wxPaintEvent\&
}{event
}}
1283 Sent to the event handler when the window must be refreshed.
1285 \wxheading{Parameters
}
1287 \docparam{event
}{Paint event. For more information, see
\helpref{wxPaintEvent
}{wxpaintevent
}.
}
1291 Use the EVT
\_PAINT macro in an event table definition to intercept paint events.
1293 In a paint event handler, the application should always create a
\helpref{wxPaintDC
}{wxpaintdc
} object.
1299 void MyWindow::OnPaint(wxPaintEvent& event)
1308 You can optimize painting by retrieving the rectangles
1309 that have been damaged and only repainting these. The rectangles are in
1310 terms of the client area, and are unscrolled, so you will need to do
1311 some calculations using the current view position to obtain logical,
1314 Here is an example of using the
\helpref{wxRegionIterator
}{wxregioniterator
} class:
1318 // Called when window needs to be repainted.
1319 void MyWindow::OnPaint(wxPaintEvent& event)
1323 // Find Out where the window is scrolled to
1324 int vbX,vbY; // Top left corner of client
1325 ViewStart(&vbX,&vbY);
1327 int vX,vY,vW,vH; // Dimensions of client area in pixels
1328 wxRegionIterator upd(GetUpdateRegion()); // get the update rect list
1337 // Alternatively we can do this:
1339 // upd.GetRect(&rect);
1341 // Repaint this rectangle
1350 \wxheading{See also
}
1352 \helpref{wxPaintEvent
}{wxpaintevent
},
\rtfsp
1353 \helpref{wxPaintDC
}{wxpaintdc
},
\rtfsp
1354 \helpref{Event handling overview
}{eventhandlingoverview
}
1356 \membersection{wxWindow::OnScroll
}\label{wxwindowonscroll
}
1358 \func{void
}{OnScroll
}{\param{wxScrollEvent\&
}{event
}}
1360 Called when a scroll event is received from one of the window's built-in scrollbars.
1362 \wxheading{Parameters
}
1364 \docparam{event
}{Command event. Retrieve the new scroll position by
1365 calling
\helpref{wxScrollEvent::GetPosition
}{wxscrolleventgetposition
}, and the
1366 scrollbar orientation by calling
\helpref{wxScrollEvent::GetOrientation
}{wxscrolleventgetorientation
}.
}
1370 Note that it is not possible to distinguish between horizontal and vertical scrollbars
1371 until the function is executing (you can't have one function for vertical, another
1372 for horizontal events).
1374 \wxheading{See also
}
1376 \helpref{wxScrollEvent
}{wxscrollevent
},
\rtfsp
1377 \helpref{Event handling overview
}{eventhandlingoverview
}
1379 \membersection{wxWindow::OnSetFocus
}\label{wxwindowonsetfocus
}
1381 \func{void
}{OnSetFocus
}{\param{wxFocusEvent\&
}{event
}}
1383 Called when a window's focus is being set.
1385 \wxheading{Parameters
}
1387 \docparam{event
}{The focus event. For more information, see
\helpref{wxFocusEvent
}{wxfocusevent
}.
}
1391 To intercept this event, use the macro EVT
\_SET\_FOCUS in an event table definition.
1393 Most, but not all, windows respond to this event.
1395 \wxheading{See also
}
1397 \helpref{wxFocusEvent
}{wxfocusevent
},
\helpref{wxWindow::OnKillFocus
}{wxwindowonkillfocus
},
\rtfsp
1398 \helpref{Event handling overview
}{eventhandlingoverview
}
1400 \membersection{wxWindow::OnSize
}\label{wxwindowonsize
}
1402 \func{void
}{OnSize
}{\param{wxSizeEvent\&
}{event
}}
1404 Called when the window has been resized.
1406 \wxheading{Parameters
}
1408 \docparam{event
}{Size event. For more information, see
\helpref{wxSizeEvent
}{wxsizeevent
}.
}
1412 You may wish to use this for frames to resize their child windows as appropriate.
1414 Note that the size passed is of
1415 the whole window: call
\helpref{wxWindow::GetClientSize
}{wxwindowgetclientsize
} for the area which may be
1416 used by the application.
1418 \wxheading{See also
}
1420 \helpref{wxSizeEvent
}{wxsizeevent
},
\rtfsp
1421 \helpref{Event handling overview
}{eventhandlingoverview
}
1423 \membersection{wxWindow::OnSysColourChanged
}\label{wxwindowonsyscolourchanged
}
1425 \func{void
}{OnSysColourChanged
}{\param{wxOnSysColourChangedEvent\&
}{event
}}
1427 Called when the user has changed the system colours.
1429 \wxheading{Parameters
}
1431 \docparam{event
}{System colour change event. For more information, see
\helpref{wxSysColourChangedEvent
}{wxsyscolourchangedevent
}.
}
1433 \wxheading{See also
}
1435 \helpref{wxSysColourChangedEvent
}{wxsyscolourchangedevent
},
\rtfsp
1436 \helpref{Event handling overview
}{eventhandlingoverview
}
1438 \membersection{wxWindow::PopEventHandler
}\label{wxwindowpopeventhandler
}
1440 \constfunc{wxEvtHandler*
}{PopEventHandler
}{\param{bool
}{deleteHandler = FALSE
}}
1442 Removes and returns the top-most event handler on the event handler stack.
1444 \wxheading{Parameters
}
1446 \docparam{deleteHandler
}{If this is TRUE, the handler will be deleted after it is removed. The
1447 default value is FALSE.
}
1449 \wxheading{See also
}
1451 \helpref{wxWindow::SetEventHandler
}{wxwindowseteventhandler
},
\rtfsp
1452 \helpref{wxWindow::GetEventHandler
}{wxwindowgeteventhandler
},
\rtfsp
1453 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1454 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
1455 \helpref{wxEvtHandler
}{wxevthandler
}\rtfsp
1457 \membersection{wxWindow::PopupMenu
}\label{wxwindowpopupmenu
}
1459 \func{virtual bool
}{PopupMenu
}{\param{wxMenu*
}{menu
},
\param{int
}{x
},
\param{int
}{y
}}
1461 Pops up the given menu at the specified coordinates, relative to this
1462 window, and returns control when the user has dismissed the menu. If a
1463 menu item is selected, the callback defined for the menu is called with
1464 wxMenu and wxCommandEvent reference arguments. The callback should access
1465 the commandInt member of the event to check the selected menu identifier.
1467 \wxheading{Parameters
}
1469 \docparam{menu
}{Menu to pop up.
}
1471 \docparam{x
}{Required x position for the menu to appear.
}
1473 \docparam{y
}{Required y position for the menu to appear.
}
1475 \wxheading{See also
}
1477 \helpref{wxMenu
}{wxmenu
}
1481 Just before the menu is popped up,
\helpref{wxMenu::UpdateUI
}{wxmenuupdateui
} is called
1482 to ensure that the menu items are in the correct state.
1484 \membersection{wxWindow::PushEventHandler
}\label{wxwindowpusheventhandler
}
1486 \func{void
}{PushEventHandler
}{\param{wxEvtHandler*
}{handler
}}
1488 Pushes this event handler onto the event stack for the window.
1490 \wxheading{Parameters
}
1492 \docparam{handler
}{Specifies the handler to be pushed.
}
1496 An event handler is an object that is capable of processing the events
1497 sent to a window. By default, the window is its own event handler, but
1498 an application may wish to substitute another, for example to allow
1499 central implementation of event-handling for a variety of different
1502 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
} allows
1503 an application to set up a chain of event handlers, where an event not handled by one event handler is
1504 handed to the next one in the chain. Use
\helpref{wxWindow::PopEventHandler
}{wxwindowpopeventhandler
} to
1505 remove the event handler.
1507 \wxheading{See also
}
1509 \helpref{wxWindow::SetEventHandler
}{wxwindowseteventhandler
},
\rtfsp
1510 \helpref{wxWindow::GetEventHandler
}{wxwindowgeteventhandler
},
\rtfsp
1511 \helpref{wxWindow::PopEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1512 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
1513 \helpref{wxEvtHandler
}{wxevthandler
}
1515 \membersection{wxWindow::Raise
}\label{wxwindowraise
}
1517 \func{void
}{Raise
}{\void}
1519 Raises the window to the top of the window hierarchy if it is a managed window (dialog
1522 \membersection{wxWindow::Refresh
}\label{wxwindowrefresh
}
1524 \func{virtual void
}{Refresh
}{\param{const bool
}{ eraseBackground = TRUE
},
\param{const wxRect*
}{rect
1527 Causes a message or event to be generated to repaint the
1530 \wxheading{Parameters
}
1532 \docparam{eraseBackground
}{If TRUE, the background will be
1535 \docparam{rect
}{If non-NULL, only the given rectangle will
1536 be treated as damaged.
}
1538 \membersection{wxWindow::ReleaseMouse
}\label{wxwindowreleasemouse
}
1540 \func{virtual void
}{ReleaseMouse
}{\void}
1542 Releases mouse input captured with
\helpref{wxWindow::CaptureMouse
}{wxwindowcapturemouse
}.
1544 \wxheading{See also
}
1546 \helpref{wxWindow::CaptureMouse
}{wxwindowcapturemouse
}
1548 \membersection{wxWindow::RemoveChild
}\label{wxwindowremovechild
}
1550 \func{virtual void
}{RemoveChild
}{\param{wxWindow*
}{child
}}
1552 Removes a child window. This is called automatically by window deletion
1553 functions so should not be required by the application programmer.
1555 \wxheading{Parameters
}
1557 \docparam{child
}{Child window to remove.
}
1559 \membersection{wxWindow::ScreenToClient
}\label{wxwindowscreentoclient
}
1561 \constfunc{virtual void
}{ScreenToClient
}{\param{int*
}{x
},
\param{int*
}{y
}}
1563 \constfunc{virtual wxPoint
}{ScreenToClient
}{\param{const wxPoint\&
}{pt
}}
1565 Converts from screen to client window coordinates.
1567 \wxheading{Parameters
}
1569 \docparam{x
}{Stores the screen x coordinate and receives the client x coordinate.
}
1571 \docparam{y
}{Stores the screen x coordinate and receives the client x coordinate.
}
1573 \docparam{pt
}{The screen position for the second form of the function.
}
1575 \pythonnote{In place of a single overloaded method name, wxPython
1576 implements the following methods:
\par
1577 \indented{2cm
}{\begin{twocollist
}
1578 \twocolitem{\bf{ScreenToClient(point)
}}{Accepts and returns a wxPoint
}
1579 \twocolitem{\bf{ScreenToClientXY(x, y)
}}{Returns a
2-tuple, (x, y)
}
1584 \membersection{wxWindow::ScrollWindow
}\label{wxwindowscrollwindow
}
1586 \func{virtual void
}{ScrollWindow
}{\param{int
}{dx
},
\param{int
}{dy
},
\param{const wxRect*
}{ rect = NULL
}}
1588 Physically scrolls the pixels in the window.
1590 \wxheading{Parameters
}
1592 \docparam{dx
}{Amount to scroll horizontally.
}
1594 \docparam{dy
}{Amount to scroll vertically.
}
1596 \docparam{rect
}{Rectangle to invalidate. If this is NULL, the whole window is invalidated. If you
1597 pass a rectangle corresponding to the area of the window exposed by the scroll, your painting handler
1598 can optimise painting by checking for the invalidated region.
}
1602 Available only under Windows.
1604 Use this function to optimise your scrolling implementations, to minimise the area that must be
1607 \membersection{wxWindow::SetAcceleratorTable
}\label{wxwindowsetacceleratortable
}
1609 \func{virtual void
}{SetAcceleratorTable
}{\param{const wxAcceleratorTable\&
}{ accel
}}
1611 Sets the accelerator table for this window. See
\helpref{wxAcceleratorTable
}{wxacceleratortable
}.
1613 \membersection{wxWindow::SetAutoLayout
}\label{wxwindowsetautolayout
}
1615 \func{void
}{SetAutoLayout
}{\param{const bool
}{ autoLayout
}}
1617 Determines whether the
\helpref{wxWindow::Layout
}{wxwindowlayout
} function will
1618 be called automatically when the window is resized.
1620 \wxheading{Parameters
}
1622 \docparam{autoLayout
}{Set this to TRUE if you wish the Layout function to be called
1623 from within wxWindow::OnSize functions.
}
1625 \wxheading{See also
}
1627 \helpref{wxWindow::SetConstraints
}{wxwindowsetconstraints
}
1629 \membersection{wxWindow::SetBackgroundColour
}\label{wxwindowsetbackgroundcolour
}
1631 \func{virtual void
}{SetBackgroundColour
}{\param{const wxColour\&
}{colour
}}
1633 Sets the background colour of the window.
1635 \wxheading{Parameters
}
1637 \docparam{colour
}{The colour to be used as the background colour.
}
1641 The background colour is usually painted by the default
\rtfsp
1642 \helpref{wxWindow::OnEraseBackground
}{wxwindowonerasebackground
} event handler function.
1644 Note that setting the background colour does not cause an immediate refresh, so you
1645 may wish to call
\helpref{wxWindow::Clear
}{wxwindowclear
} or
\helpref{wxWindow::Refresh
}{wxwindowrefresh
} after
1646 calling this function.
1648 \wxheading{See also
}
1650 \helpref{wxWindow::GetBackgroundColour
}{wxwindowgetbackgroundcolour
},
\rtfsp
1651 \helpref{wxWindow::SetForegroundColour
}{wxwindowsetforegroundcolour
},
\rtfsp
1652 \helpref{wxWindow::GetForegroundColour
}{wxwindowgetforegroundcolour
},
\rtfsp
1653 \helpref{wxWindow::Clear
}{wxwindowclear
},
\rtfsp
1654 \helpref{wxWindow::Refresh
}{wxwindowrefresh
},
\rtfsp
1655 \helpref{wxWindow::OnEraseBackground
}{wxwindowonerasebackground
}
1657 \membersection{wxWindow::SetClientSize
}\label{wxwindowsetclientsize
}
1659 \func{virtual void
}{SetClientSize
}{\param{int
}{ width
},
\param{int
}{ height
}}
1661 \func{virtual void
}{SetClientSize
}{\param{const wxSize\&
}{ size
}}
1663 This sets the size of the window client area in pixels. Using this function to size a window
1664 tends to be more device-independent than
\helpref{wxWindow::SetSize
}{wxwindowsetsize
}, since the application need not
1665 worry about what dimensions the border or title bar have when trying to fit the window
1666 around panel items, for example.
1668 \wxheading{Parameters
}
1670 \docparam{width
}{The required client area width.
}
1672 \docparam{height
}{The required client area height.
}
1674 \docparam{size
}{The required client size.
}
1676 \pythonnote{In place of a single overloaded method name, wxPython
1677 implements the following methods:
\par
1678 \indented{2cm
}{\begin{twocollist
}
1679 \twocolitem{\bf{SetClientSize(size)
}}{Accepts a wxSize
}
1680 \twocolitem{\bf{SetClientSizeWH(width, height)
}}{}
1684 \membersection{wxWindow::SetCursor
}\label{wxwindowsetcursor
}
1686 \func{virtual void
}{SetCursor
}{\param{const wxCursor\&
}{cursor
}}
1688 Sets the window's cursor.
1690 \wxheading{Parameters
}
1692 \docparam{cursor
}{Specifies the cursor that the window should normally display.
}
1694 %\wxheading{Remarks}
1696 %Under Windows, you sometimes need to call ::wxSetCursor in addition to this
1697 %function if you want the cursor to change immediately, because under Windows,
1698 %wxWindows only sets the global cursor when it detects mouse movement.
1700 \wxheading{See also
}
1702 \helpref{::wxSetCursor
}{wxsetcursor
},
\helpref{wxCursor
}{wxcursor
}
1704 \membersection{wxWindow::SetEventHandler
}\label{wxwindowseteventhandler
}
1706 \func{void
}{SetEventHandler
}{\param{wxEvtHandler*
}{handler
}}
1708 Sets the event handler for this window.
1710 \wxheading{Parameters
}
1712 \docparam{handler
}{Specifies the handler to be set.
}
1716 An event handler is an object that is capable of processing the events
1717 sent to a window. By default, the window is its own event handler, but
1718 an application may wish to substitute another, for example to allow
1719 central implementation of event-handling for a variety of different
1722 It is usually better to use
\helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
} since
1723 this sets up a chain of event handlers, where an event not handled by one event handler is
1724 handed to the next one in the chain.
1726 \wxheading{See also
}
1728 \helpref{wxWindow::GetEventHandler
}{wxwindowgeteventhandler
},
\rtfsp
1729 \helpref{wxWindow::PushEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1730 \helpref{wxWindow::PopEventHandler
}{wxwindowpusheventhandler
},
\rtfsp
1731 \helpref{wxEvtHandler::ProcessEvent
}{wxevthandlerprocessevent
},
\rtfsp
1732 \helpref{wxEvtHandler
}{wxevthandler
}
1734 \membersection{wxWindow::SetConstraints
}\label{wxwindowsetconstraints
}
1736 \func{void
}{SetConstraints
}{\param{wxLayoutConstraints*
}{constraints
}}
1738 Sets the window to have the given layout constraints. The window
1739 will then own the object, and will take care of its deletion.
1740 If an existing layout constraints object is already owned by the
1741 window, it will be deleted.
1743 \wxheading{Parameters
}
1745 \docparam{constraints
}{The constraints to set. Pass NULL to disassociate and delete the window's
1750 You must call
\helpref{wxWindow::SetAutoLayout
}{wxwindowsetautolayout
} to tell a window to use
1751 the constraints automatically in OnSize; otherwise, you must
1752 override OnSize and call Layout explicitly.
1754 \membersection{wxWindow::SetDropTarget
}\label{wxwindowsetdroptarget
}
1756 \func{void
}{SetDropTarget
}{\param{wxDropTarget*
}{ target
}}
1758 Associates a drop target with this window.
1760 If the window already has a drop target, it is deleted.
1762 \wxheading{See also
}
1764 \helpref{wxWindow::GetDropTarget
}{wxwindowgetdroptarget
},
1765 \helpref{Drag and drop overview
}{wxdndoverview
}
1767 \membersection{wxWindow::SetFocus
}\label{wxwindowsetfocus
}
1769 \func{virtual void
}{SetFocus
}{\void}
1771 This sets the window to receive keyboard input.
1773 \membersection{wxWindow::SetFont
}\label{wxwindowsetfont
}
1775 \func{void
}{SetFont
}{\param{const wxFont\&
}{font
}}
1777 Sets the font for this window.
1779 \wxheading{Parameters
}
1781 \docparam{font
}{Font to associate with this window.
}
1783 \wxheading{See also
}
1785 \helpref{wxWindow::GetFont
}{wxwindowgetfont
}
1787 \membersection{wxWindow::SetForegroundColour
}\label{wxwindowsetforegroundcolour
}
1789 \func{virtual void
}{SetForegroundColour
}{\param{const wxColour\&
}{colour
}}
1791 Sets the foreground colour of the window.
1793 \wxheading{Parameters
}
1795 \docparam{colour
}{The colour to be used as the foreground colour.
}
1799 The interpretation of foreground colour is open to interpretation according
1800 to the window class; it may be the text colour or other colour, or it may not
1803 \wxheading{See also
}
1805 \helpref{wxWindow::GetForegroundColour
}{wxwindowgetforegroundcolour
},
\rtfsp
1806 \helpref{wxWindow::SetBackgroundColour
}{wxwindowsetbackgroundcolour
},
\rtfsp
1807 \helpref{wxWindow::GetBackgroundColour
}{wxwindowgetbackgroundcolour
}
1809 \membersection{wxWindow::SetId
}\label{wxwindowsetid
}
1811 \func{void
}{SetId
}{\param{int
}{ id
}}
1813 Sets the identifier of the window.
1817 Each window has an integer identifier. If the application has not provided one,
1818 an identifier will be generated. Normally, the identifier should be provided
1819 on creation and should not be modified subsequently.
1821 \wxheading{See also
}
1823 \helpref{wxWindow::GetId
}{wxwindowgetid
},
\rtfsp
1824 \helpref{Window identifiers
}{windowids
}
1826 \membersection{wxWindow::SetName
}\label{wxwindowsetname
}
1828 \func{virtual void
}{SetName
}{\param{const wxString\&
}{name
}}
1830 Sets the window's name.
1832 \wxheading{Parameters
}
1834 \docparam{name
}{A name to set for the window.
}
1836 \wxheading{See also
}
1838 \helpref{wxWindow::GetName
}{wxwindowgetname
}
1840 \membersection{wxWindow::SetPalette
}\label{wxwindowsetpalette
}
1842 \func{virtual void
}{SetPalette
}{\param{wxPalette*
}{palette
}}
1844 Obsolete - use
\helpref{wxDC::SetPalette
}{wxdcsetpalette
} instead.
1846 \membersection{wxWindow::SetReturnCode
}\label{wxwindowsetreturncode
}
1848 \func{void
}{SetReturnCode
}{\param{int
}{retCode
}}
1850 Sets the return code for this window.
1852 \wxheading{Parameters
}
1854 \docparam{retCode
}{The integer return code, usually a control identifier.
}
1858 A return code is normally associated with a modal dialog, where
\helpref{wxDialog::ShowModal
}{wxdialogshowmodal
} returns
1859 a code to the application. The function
\helpref{wxDialog::EndModal
}{wxdialogendmodal
} calls
{\bf SetReturnCode
}.
1861 \wxheading{See also
}
1863 \helpref{wxWindow::GetReturnCode
}{wxwindowgetreturncode
},
\helpref{wxDialog::ShowModal
}{wxdialogshowmodal
},
\rtfsp
1864 \helpref{wxDialog::EndModal
}{wxdialogendmodal
}
1866 \membersection{wxWindow::SetScrollbar
}\label{wxwindowsetscrollbar
}
1868 \func{virtual void
}{SetScrollbar
}{\param{int
}{orientation
},
\param{int
}{position
},
\rtfsp
1869 \param{int
}{thumbSize
},
\param{int
}{range
},
\rtfsp
1870 \param{const bool
}{refresh = TRUE
}}
1872 Sets the scrollbar properties of a built-in scrollbar.
1874 \wxheading{Parameters
}
1876 \docparam{orientation
}{Determines the scrollbar whose page size is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
1878 \docparam{position
}{The position of the scrollbar in scroll units.
}
1880 \docparam{thumbSize
}{The size of the thumb, or visible portion of the scrollbar, in scroll units.
}
1882 \docparam{range
}{The maximum position of the scrollbar.
}
1884 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
1888 Let's say you wish to display
50 lines of text, using the same font.
1889 The window is sized so that you can only see
16 lines at a time.
1895 SetScrollbar(wxVERTICAL,
0,
16,
50);
1899 Note that with the window at this size, the thumb position can never go
1900 above
50 minus
16, or
34.
1902 You can determine how many lines are currently visible by dividing the current view
1903 size by the character height in pixels.
1905 When defining your own scrollbar behaviour, you will always need to recalculate
1906 the scrollbar settings when the window size changes. You could therefore put your
1907 scrollbar calculations and SetScrollbar
1908 call into a function named AdjustScrollbars, which can be called initially and also
1909 from your
\helpref{wxWindow::OnSize
}{wxwindowonsize
} event handler function.
1911 \wxheading{See also
}
1913 \helpref{Scrolling overview
}{scrollingoverview
},
\rtfsp
1914 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
1917 \membersection{wxWindow::SetScrollPage
}\label{wxwindowsetscrollpage
}
1919 \func{virtual void
}{SetScrollPage
}{\param{int
}{orientation
},
\param{int
}{pageSize
},
\param{const bool
}{refresh = TRUE
}}
1921 Sets the page size of one of the built-in scrollbars.
1923 \wxheading{Parameters
}
1925 \docparam{orientation
}{Determines the scrollbar whose page size is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
1927 \docparam{pageSize
}{Page size in scroll units.
}
1929 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
1933 The page size of a scrollbar is the number of scroll units that the scroll thumb travels when you
1934 click on the area above/left of or below/right of the thumb. Normally you will want a whole visible
1935 page to be scrolled, i.e. the size of the current view (perhaps the window client size). This
1936 value has to be adjusted when the window is resized, since the page size will have changed.
1938 In addition to specifying how far the scroll thumb travels when paging, in Motif and some versions of Windows
1939 the thumb changes size to reflect the page size relative to the length of the
document. When the
1940 document size is only slightly bigger than the current view (window) size, almost all of the scrollbar
1941 will be taken up by the thumb. When the two values become the same, the scrollbar will (on some systems)
1944 Currently, this function should be called before SetPageRange, because of a quirk in the Windows
1945 handling of pages and ranges.
1947 \wxheading{See also
}
1949 \helpref{wxWindow::SetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
1950 \helpref{wxWindow::GetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
1951 \helpref{wxWindow::GetScrollPage
}{wxwindowsetscrollpage
},
\rtfsp
1952 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
1955 \membersection{wxWindow::SetScrollPos
}\label{wxwindowsetscrollpos
}
1957 \func{virtual void
}{SetScrollPos
}{\param{int
}{orientation
},
\param{int
}{pos
},
\param{const bool
}{refresh = TRUE
}}
1959 Sets the position of one of the built-in scrollbars.
1961 \wxheading{Parameters
}
1963 \docparam{orientation
}{Determines the scrollbar whose position is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
1965 \docparam{pos
}{Position in scroll units.
}
1967 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
1971 This function does not directly affect the contents of the window: it is up to the
1972 application to take note of scrollbar attributes and redraw contents accordingly.
1974 \wxheading{See also
}
1976 \helpref{wxWindow::SetScrollbar
}{wxwindowsetscrollbar
},
\rtfsp
1977 \helpref{wxWindow::GetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
1978 \helpref{wxWindow::GetScrollThumb
}{wxwindowgetscrollthumb
},
\rtfsp
1979 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
1982 \membersection{wxWindow::SetScrollRange
}\label{wxwindowsetscrollrange
}
1984 \func{virtual void
}{SetScrollRange
}{\param{int
}{orientation
},
\param{int
}{range
},
\param{const bool
}{refresh = TRUE
}}
1986 Sets the range of one of the built-in scrollbars.
1988 \wxheading{Parameters
}
1990 \docparam{orientation
}{Determines the scrollbar whose range is to be set. May be wxHORIZONTAL or wxVERTICAL.
}
1992 \docparam{range
}{Scroll range.
}
1994 \docparam{refresh
}{TRUE to redraw the scrollbar, FALSE otherwise.
}
1998 The range of a scrollbar is the number of steps that the thumb may travel, rather than the total
1999 object length of the scrollbar. If you are implementing a scrolling window, for example, you
2000 would adjust the scroll range when the window is resized, by subtracting the window view size from the
2001 total virtual window size. When the two sizes are the same (all the window is visible), the range goes to zero
2002 and usually the scrollbar will be automatically hidden.
2004 \wxheading{See also
}
2006 \helpref{wxWindow::SetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
2007 \helpref{wxWindow::SetScrollPage
}{wxwindowsetscrollpage
},
\rtfsp
2008 \helpref{wxWindow::GetScrollPos
}{wxwindowsetscrollpos
},
\rtfsp
2009 \helpref{wxWindow::GetScrollPage
}{wxwindowsetscrollpage
},
\rtfsp
2010 \helpref{wxScrollBar
}{wxscrollbar
},
\helpref{wxScrolledWindow
}{wxscrolledwindow
}
2013 \membersection{wxWindow::SetSize
}\label{wxwindowsetsize
}
2015 \func{virtual void
}{SetSize
}{\param{int
}{ x
},
\param{int
}{ y
},
\param{int
}{ width
},
\param{int
}{ height
},
2016 \param{int
}{ sizeFlags = wxSIZE
\_AUTO}}
2018 \func{virtual void
}{SetSize
}{\param{const wxRect\&
}{ rect
}}
2020 Sets the size and position of the window in pixels.
2022 \func{virtual void
}{SetSize
}{\param{int
}{ width
},
\param{int
}{ height
}}
2024 \func{virtual void
}{SetSize
}{\param{const wxSize\&
}{ size
}}
2026 Sets the size of the window in pixels.
2028 \wxheading{Parameters
}
2030 \docparam{x
}{Required x position in pixels, or -
1 to indicate that the existing
2031 value should be used.
}
2033 \docparam{y
}{Required y position in pixels, or -
1 to indicate that the existing
2034 value should be used.
}
2036 \docparam{width
}{Required width in pixels, or -
1 to indicate that the existing
2037 value should be used.
}
2039 \docparam{height
}{Required height position in pixels, or -
1 to indicate that the existing
2040 value should be used.
}
2042 \docparam{size
}{\helpref{wxSize
}{wxsize
} object for setting the size.
}
2044 \docparam{rect
}{\helpref{wxRect
}{wxrect
} object for setting the position and size.
}
2046 \docparam{sizeFlags
}{Indicates the interpretation of other parameters. It is a bit list of the following:
2048 {\bf wxSIZE
\_AUTO\_WIDTH}: a -
1 width value is taken to indicate
2049 a wxWindows-supplied default width.\\
2050 {\bf wxSIZE
\_AUTO\_HEIGHT}: a -
1 height value is taken to indicate
2051 a wxWindows-supplied default width.\\
2052 {\bf wxSIZE
\_AUTO}: -
1 size values are taken to indicate
2053 a wxWindows-supplied default size.\\
2054 {\bf wxSIZE
\_USE\_EXISTING}: existing dimensions should be used
2055 if -
1 values are supplied.\\
2056 {\bf wxSIZE
\_ALLOW\_MINUS\_ONE}: allow dimensions of -
1 and less to be interpreted
2057 as real dimensions, not default values.
2062 The second form is a convenience for calling the first form with default
2063 x and y parameters, and must be used with non-default width and height values.
2065 The first form sets the position and optionally size, of the window.
2066 Parameters may be -
1 to indicate either that a default should be supplied
2067 by wxWindows, or that the current value of the dimension should be used.
2069 \wxheading{See also
}
2071 \helpref{wxWindow::Move
}{wxwindowmove
}
2073 \pythonnote{In place of a single overloaded method name, wxPython
2074 implements the following methods:
\par
2075 \indented{2cm
}{\begin{twocollist
}
2076 \twocolitem{\bf{SetDimensions(x, y, width, height, sizeFlags=wxSIZE_AUTO)
}}{}
2077 \twocolitem{\bf{SetSize(size)
}}{}
2078 \twocolitem{\bf{SetPosition(point)
}}{}
2082 \membersection{wxWindow::SetSizeHints
}\label{wxwindowsetsizehints
}
2084 \func{virtual void
}{SetSizeHints
}{\param{int
}{ minW=-
1},
\param{int
}{ minH=-
1},
\param{int
}{ maxW=-
1},
\param{int
}{ maxH=-
1},
2085 \param{int
}{ incW=-
1},
\param{int
}{ incH=-
1}}
2087 Allows specification of minimum and maximum window sizes, and window size increments.
2088 If a pair of values is not set (or set to -
1), the default values will be used.
2090 \wxheading{Parameters
}
2092 \docparam{minW
}{Specifies the minimum width allowable.
}
2094 \docparam{minH
}{Specifies the minimum height allowable.
}
2096 \docparam{maxW
}{Specifies the maximum width allowable.
}
2098 \docparam{maxH
}{Specifies the maximum height allowable.
}
2100 \docparam{incW
}{Specifies the increment for sizing the width (Motif/Xt only).
}
2102 \docparam{incH
}{Specifies the increment for sizing the height (Motif/Xt only).
}
2106 If this function is called, the user will not be able to size the window outside the
2109 The resizing increments are only significant under Motif or Xt.
2111 \membersection{wxWindow::SetTitle
}\label{wxwindowsettitle
}
2113 \func{virtual void
}{SetTitle
}{\param{const wxString\&
}{title
}}
2115 Sets the window's title. Applicable only to frames and dialogs.
2117 \wxheading{Parameters
}
2119 \docparam{title
}{The window's title.
}
2121 \wxheading{See also
}
2123 \helpref{wxWindow::GetTitle
}{wxwindowgettitle
}
2125 \membersection{wxWindow::Show
}
2127 \func{virtual bool
}{Show
}{\param{const bool
}{ show
}}
2129 Shows or hides the window.
2131 \wxheading{Parameters
}
2133 \docparam{show
}{If TRUE, displays the window and brings it to the front. Otherwise,
2136 \wxheading{See also
}
2138 \helpref{wxWindow::IsShown
}{wxwindowisshown
}
2140 \membersection{wxWindow::TransferDataFromWindow
}\label{wxwindowtransferdatafromwindow
}
2142 \func{virtual bool
}{TransferDataFromWindow
}{\void}
2144 Transfers values from child controls to data areas specified by their validators. Returns
2145 FALSE if a transfer failed.
2147 \wxheading{See also
}
2149 \helpref{wxWindow::TransferDataToWindow
}{wxwindowtransferdatatowindow
},
\rtfsp
2150 \helpref{wxValidator
}{wxvalidator
},
\helpref{wxWindow::Validate
}{wxwindowvalidate
}
2152 \membersection{wxWindow::TransferDataToWindow
}\label{wxwindowtransferdatatowindow
}
2154 \func{virtual bool
}{TransferDataToWindow
}{\void}
2156 Transfers values to child controls from data areas specified by their validators.
2158 \wxheading{Return value
}
2160 Returns FALSE if a transfer failed.
2162 \wxheading{See also
}
2164 \helpref{wxWindow::TransferDataFromWindow
}{wxwindowtransferdatafromwindow
},
\rtfsp
2165 \helpref{wxValidator
}{wxvalidator
},
\helpref{wxWindow::Validate
}{wxwindowvalidate
}
2167 \membersection{wxWindow::Validate
}\label{wxwindowvalidate
}
2169 \func{virtual bool
}{Validate
}{\void}
2171 Validates the current values of the child controls using their validators.
2173 \wxheading{Return value
}
2175 Returns FALSE if any of the validations failed.
2177 \wxheading{See also
}
2179 \helpref{wxWindow::TransferDataFromWindow
}{wxwindowtransferdatafromwindow
},
\rtfsp
2180 \helpref{wxWindow::TransferDataFromWindow
}{wxwindowtransferdatafromwindow
},
\rtfsp
2181 \helpref{wxValidator
}{wxvalidator
}
2183 \membersection{wxWindow::WarpPointer
}\label{wxwindowwarppointer
}
2185 \func{void
}{WarpPointer
}{\param{int
}{ x
},
\param{int
}{ y
}}
2187 Moves the pointer to the given position on the window.
2189 \wxheading{Parameters
}
2191 \docparam{x
}{The new x position for the cursor.
}
2193 \docparam{y
}{The new y position for the cursor.
}