⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 window.tex

📁 很牛的GUI源码wxWidgets-2.8.0.zip 可在多种平台下运行.
💻 TEX
📖 第 1 页 / 共 5 页
字号:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Name:        window.tex%% Purpose:     wxWindow documentation%% Author:      wxWidgets Team%% Modified by:%% Created:%% RCS-ID:      $Id: window.tex,v 1.223 2006/12/04 11:19:30 VZ Exp $%% Copyright:   (c) wxWidgets Team%% License:     wxWindows license%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\section{\class{wxWindow}}\label{wxwindow}wxWindow is the base class for all windows and represents any visible object onscreen. All controls, top level windows and so on are windows. Sizers anddevice contexts are not, however, as they don't appear on screen themselves.Please note that all children of the window will be deleted automatically bythe destructor before the window itself is deleted which means that you don'thave to worry about deleting them manually. Please see the \helpref{windowdeletion overview}{windowdeletionoverview} for more information.Also note that in this, and many others, wxWidgets classes some\texttt{GetXXX()} methods may be overloaded (as, for example,\helpref{GetSize}{wxwindowgetsize} or\helpref{GetClientSize}{wxwindowgetclientsize}). In this case, the overloadsare non-virtual because having multiple virtual functions with the same nameresults in a virtual function name hiding at the derived class level (inEnglish, this means that the derived class has to override all overloadedvariants if it overrides any of them). To allow overriding them in the derivedclass, wxWidgets uses a unique protected virtual \texttt{DoGetXXX()} methodand all \texttt{GetXXX()} ones are forwarded to it, so overriding the formerchanges the behaviour of the latter.\wxheading{Derived from}\helpref{wxEvtHandler}{wxevthandler}\\\helpref{wxObject}{wxobject}\wxheading{Include files}<wx/window.h>\wxheading{Window styles}The following styles can apply to all windows, although they will not always make sense for a particularwindow class or on all platforms.\twocolwidtha{5cm}%\begin{twocollist}\itemsep=0pt\twocolitem{\windowstyle{wxSIMPLE\_BORDER}}{Displays a thin border around the window. wxBORDER is the old namefor this style. }\twocolitem{\windowstyle{wxDOUBLE\_BORDER}}{Displays a double border. Windows and Mac only.}\twocolitem{\windowstyle{wxSUNKEN\_BORDER}}{Displays a sunken border.}\twocolitem{\windowstyle{wxRAISED\_BORDER}}{Displays a raised border.}\twocolitem{\windowstyle{wxSTATIC\_BORDER}}{Displays a border suitable for a static control. Windows only. }\twocolitem{\windowstyle{wxNO\_BORDER}}{Displays no border, overriding the default border style for the window.}\twocolitem{\windowstyle{wxTRANSPARENT\_WINDOW}}{The window is transparent, that is, it will not receive paintevents. Windows only.}\twocolitem{\windowstyle{wxTAB\_TRAVERSAL}}{Use this to enable tab traversal for non-dialog windows.}\twocolitem{\windowstyle{wxWANTS\_CHARS}}{Use this to indicate thatthe window wants to get all char/key events for all keys - even forkeys like TAB or ENTER which are usually used for dialog navigationand which wouldn't be generated without this style.  If you need touse this style in order to get the arrows or etc., but would still like to havenormal keyboard navigation take place, you should create and send awxNavigationKeyEvent in response to the key events for Tab andShift-Tab.}\twocolitem{\windowstyle{wxNO\_FULL\_REPAINT\_ON\_RESIZE}}{On Windows, this style used to disable repaintingthe window completely when its size is changed. Since this behaviour is now the default, the style is now obsoleteand no longer has an effect.}\twocolitem{\windowstyle{wxVSCROLL}}{Use this style to enable a vertical scrollbar.}\twocolitem{\windowstyle{wxHSCROLL}}{Use this style to enable a horizontal scrollbar.}\twocolitem{\windowstyle{wxALWAYS\_SHOW\_SB}}{If a window has scrollbars,disable them instead of hiding them when they are not needed (i.e. when thesize of the window is big enough to not require the scrollbars to navigate it).This style is currently implemented for wxMSW, wxGTK and wxUniversal and doesnothing on the other platforms.}\twocolitem{\windowstyle{wxCLIP\_CHILDREN}}{Use this style to eliminate flicker caused by the background beingrepainted, then children being painted over them. Windows only.}\twocolitem{\windowstyle{wxFULL\_REPAINT\_ON\_RESIZE}}{Use this style to forcea complete redraw of the window whenever it is resized instead of redrawingjust the part of the window affected by resizing. Note that this was thebehaviour by default before 2.5.1 release and that if you experience redrawproblems with code which previously used to work you may want to try this.Currently this style applies on GTK+ 2 and Windows only, and full repainting is alwaysdone on other platforms.}\end{twocollist}See also \helpref{window styles overview}{windowstyles}.\wxheading{Extra window styles}The following are extra styles, set using \helpref{wxWindow::SetExtraStyle}{wxwindowsetextrastyle}.\twocolwidtha{5cm}%\begin{twocollist}\itemsep=0pt\twocolitem{\windowstyle{wxWS\_EX\_VALIDATE\_RECURSIVELY}}{By default, Validate/TransferDataTo/FromWindow()only work on direct children of the window (compatible behaviour). Set this flag to make them recursivelydescend into all subwindows.}\twocolitem{\windowstyle{wxWS\_EX\_BLOCK\_EVENTS}}{wxCommandEvents and the objects of the derived classes are forwarded to theparent window and so on recursively by default. Using this flag for thegiven window allows to block this propagation at this window, i.e. preventthe events from being propagated further upwards. Dialogs have thisflag on by default.}\twocolitem{\windowstyle{wxWS\_EX\_TRANSIENT}}{Don't use this window as an implicit parent for the other windows: this mustbe used with transient windows as otherwise there is the risk of creating adialog/frame with this window as a parent which would lead to a crash if theparent is destroyed before the child.}\twocolitem{\windowstyle{wxWS\_EX\_PROCESS\_IDLE}}{This window should always process idle events, evenif the mode set by \helpref{wxIdleEvent::SetMode}{wxidleeventsetmode} is wxIDLE\_PROCESS\_SPECIFIED.}\twocolitem{\windowstyle{wxWS\_EX\_PROCESS\_UI\_UPDATES}}{This window should always process UI update events,even if the mode set by \helpref{wxUpdateUIEvent::SetMode}{wxupdateuieventsetmode} is wxUPDATE\_UI\_PROCESS\_SPECIFIED.}\end{twocollist}\wxheading{See also}\helpref{Event handling overview}{eventhandlingoverview}\\\helpref{Window sizing overview}{windowsizingoverview}\latexignore{\rtfignore{\wxheading{Members}}}\membersection{wxWindow::wxWindow}\label{wxwindowctor}\func{}{wxWindow}{\void}Default constructor.\func{}{wxWindow}{\param{wxWindow*}{ parent}, \param{wxWindowID }{id}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize}, \param{long }{style = 0}, \param{const wxString\& }{name = wxPanelNameStr}}Constructs a window, which can be a child of a frame, dialog or any other non-control window.\wxheading{Parameters}\docparam{parent}{Pointer to a parent window.}\docparam{id}{Window identifier. If wxID\_ANY, will automatically create an identifier.}\docparam{pos}{Window position. wxDefaultPosition indicates that wxWidgetsshould generate a default position for the window. If using the wxWindow class directly, supplyan actual position.}\docparam{size}{Window size. wxDefaultSize indicates that wxWidgetsshould generate a default size for the window. If no suitable size can  be found, thewindow will be sized to 20x20 pixels so that the window is visible but obviously notcorrectly sized. }\docparam{style}{Window style. For generic window styles, please see \helpref{wxWindow}{wxwindow}.}\docparam{name}{Window name.}\membersection{wxWindow::\destruct{wxWindow}}\label{wxwindowdtor}\func{}{\destruct{wxWindow}}{\void}Destructor. Deletes all subwindows, then deletes itself. Instead of usingthe {\bf delete} operator explicitly, you should normallyuse \helpref{wxWindow::Destroy}{wxwindowdestroy} so that wxWidgetscan delete a window only when it is safe to do so, in idle time.\wxheading{See also}\helpref{Window deletion overview}{windowdeletionoverview},\rtfsp\helpref{wxWindow::Destroy}{wxwindowdestroy},\rtfsp\helpref{wxCloseEvent}{wxcloseevent}\membersection{wxWindow::AddChild}\label{wxwindowaddchild}\func{virtual void}{AddChild}{\param{wxWindow* }{child}}Adds a child window.  This is called automatically by window creationfunctions so should not be required by the application programmer.Notice that this function is mostly internal to wxWidgets and shouldn't becalled by the user code.\wxheading{Parameters}\docparam{child}{Child window to add.}\membersection{wxWindow::CacheBestSize}\label{wxwindowcachebestsize}\constfunc{void}{CacheBestSize}{\param{const wxSize\& }{size}}Sets the cached best size value.\membersection{wxWindow::CaptureMouse}\label{wxwindowcapturemouse}\func{virtual void}{CaptureMouse}{\void}Directs all mouse input to this window. Call \helpref{wxWindow::ReleaseMouse}{wxwindowreleasemouse} torelease the capture.Note that wxWidgets maintains the stack of windows having captured the mouseand when the mouse is released the capture returns to the window which had hadcaptured it previously and it is only really released if there were no previouswindow. In particular, this means that you must release the mouse as many timesas you capture it, unless the window receivesthe \helpref{wxMouseCaptureLostEvent}{wxmousecapturelostevent} event.Any application which captures the mouse in the beginning of some operation{\em must} handle \helpref{wxMouseCaptureLostEvent}{wxmousecapturelostevent}and cancel this operation when it receives the event. The event handler mustnot recapture mouse.\wxheading{See also}\helpref{wxWindow::ReleaseMouse}{wxwindowreleasemouse}\helpref{wxMouseCaptureLostEvent}{wxmousecapturelostevent}\membersection{wxWindow::Center}\label{wxwindowcenter}\func{void}{Center}{\param{int}{ direction}}A synonym for \helpref{Centre}{wxwindowcentre}.\membersection{wxWindow::CenterOnParent}\label{wxwindowcenteronparent}\func{void}{CenterOnParent}{\param{int}{ direction}}A synonym for \helpref{CentreOnParent}{wxwindowcentreonparent}.\membersection{wxWindow::CenterOnScreen}\label{wxwindowcenteronscreen}\func{void}{CenterOnScreen}{\param{int}{ direction}}A synonym for \helpref{CentreOnScreen}{wxwindowcentreonscreen}.\membersection{wxWindow::Centre}\label{wxwindowcentre}\func{void}{Centre}{\param{int}{ direction = wxBOTH}}Centres the window.\wxheading{Parameters}\docparam{direction}{Specifies the direction for the centering. May be {\tt wxHORIZONTAL}, {\tt wxVERTICAL}\rtfspor {\tt wxBOTH}. It may also include {\tt wxCENTRE\_ON\_SCREEN} flagif you want to center the window on the entire screen and not on itsparent window.}The flag {\tt wxCENTRE\_FRAME} is obsolete and should not be used any longer(it has no effect).\wxheading{Remarks}If the window is a top level one (i.e. doesn't have a parent), it will becentered relative to the screen anyhow.\wxheading{See also}\helpref{wxWindow::Center}{wxwindowcenter}\membersection{wxWindow::CentreOnParent}\label{wxwindowcentreonparent}\func{void}{CentreOnParent}{\param{int}{ direction = wxBOTH}}Centres the window on its parent. This is a more readable synonym for\helpref{Centre}{wxwindowcentre}.\wxheading{Parameters}\docparam{direction}{Specifies the direction for the centering. May be {\tt wxHORIZONTAL}, {\tt wxVERTICAL}\rtfspor {\tt wxBOTH}.}\wxheading{Remarks}This methods provides for a way to center top level windows over theirparents instead of the entire screen.  If there is no parent or if thewindow is not a top level window, then behaviour is the same as\helpref{wxWindow::Centre}{wxwindowcentre}.\wxheading{See also}\helpref{wxWindow::CentreOnScreen}{wxwindowcenteronscreen}\membersection{wxWindow::CentreOnScreen}\label{wxwindowcentreonscreen}\func{void}{CentreOnScreen}{\param{int}{ direction = wxBOTH}}Centres the window on screen. This only works for top level windows -otherwise, the window will still be centered on its parent.\wxheading{Parameters}\docparam{direction}{Specifies the direction for the centering. May be {\tt wxHORIZONTAL}, {\tt wxVERTICAL}\rtfspor {\tt wxBOTH}.}\wxheading{See also}\helpref{wxWindow::CentreOnParent}{wxwindowcenteronparent}\membersection{wxWindow::ClearBackground}\label{wxwindowclearbackground}\func{void}{ClearBackground}{\void}Clears the window by filling it with the current background colour. Does notcause an erase background event to be generated.\membersection{wxWindow::ClientToScreen}\label{wxwindowclienttoscreen}\constfunc{virtual void}{ClientToScreen}{\param{int* }{x}, \param{int* }{y}}\perlnote{In wxPerl this method returns a 2-element list instead ofmodifying its parameters.}\constfunc{virtual wxPoint}{ClientToScreen}{\param{const wxPoint\&}{ pt}}Converts to screen coordinates from coordinates relative to this window.\docparam{x}{A pointer to a integer value for the x coordinate. Pass the client coordinate in, anda screen coordinate will be passed out.}\docparam{y}{A pointer to a integer value for the y coordinate. Pass the client coordinate in, anda screen coordinate will be passed out.}\docparam{pt}{The client position for the second form of the function.}\pythonnote{In place of a single overloaded method name, wxPythonimplements the following methods:\par\indented{2cm}{\begin{twocollist}\twocolitem{{\bf ClientToScreen(point)}}{Accepts and returns a wxPoint}\twocolitem{{\bf ClientToScreenXY(x, y)}}{Returns a 2-tuple, (x, y)}\end{twocollist}}}\membersection{wxWindow::Close}\label{wxwindowclose}\func{bool}{Close}{\param{bool}{ force = {\tt false}}}This function simply generates a \helpref{wxCloseEvent}{wxcloseevent} whosehandler usually tries to close the window. It doesn't close the window itself,however.\wxheading{Parameters}\docparam{force}{{\tt false} if the window's close handler should be able to veto the destructionof this window, {\tt true} if it cannot.}\wxheading{Remarks}Close calls the \helpref{close handler}{wxcloseevent} for the window, providingan opportunity for the window to choose whether to destroy the window.Usually it is only used with the top level windows (wxFrame and wxDialogclasses) as the others are not supposed to have any special OnClose() logic.The close handler should check whether the window is being deleted forcibly,using \helpref{wxCloseEvent::CanVeto}{wxcloseeventcanveto}, in which case itshould destroy the window using \helpref{wxWindow::Destroy}{wxwindowdestroy}.{\it Note} that calling Close does not guarantee that the window will bedestroyed; but it provides a way to simulate a manual close of a window, whichmay or may not be implemented by destroying the window. The defaultimplementation of wxDialog::OnCloseWindow does not necessarily delete thedialog, since it will simply simulate an wxID\_CANCEL event which is handled bythe appropriate button event handler and may do anything at all.To guarantee that the window will be destroyed, call\helpref{wxWindow::Destroy}{wxwindowdestroy} instead\wxheading{See also}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -