📄 window.tex
字号:
\constfunc{wxSize}{GetEffectiveMinSize}{\void}Merges the window's best size into the min size and returns theresult. This is the value used by sizers to determine the appropriateammount of sapce to allocate for the widget.\wxheading{See also}\helpref{wxWindow::GetBestSize}{wxwindowgetbestsize},\rtfsp\helpref{wxWindow::SetInitialSize}{wxwindowsetinitialsize}\membersection{wxWindow::GetBestSize}\label{wxwindowgetbestsize}\constfunc{wxSize}{GetBestSize}{\void}This functions returns the best acceptable minimal size for the window. Forexample, for a static control, it will be the minimal size such that thecontrol label is not truncated. For windows containing subwindows (typically\helpref{wxPanel}{wxpanel}), the size returned by this function will be thesame as the size the window would have had after calling\helpref{Fit}{wxwindowfit}.\membersection{wxWindow::GetCapture}\label{wxwindowgetcapture}\func{static wxWindow *}{GetCapture}{\void}Returns the currently captured window.\wxheading{See also}\helpref{wxWindow::HasCapture}{wxwindowhascapture},\helpref{wxWindow::CaptureMouse}{wxwindowcapturemouse},\helpref{wxWindow::ReleaseMouse}{wxwindowreleasemouse},\helpref{wxMouseCaptureLostEvent}{wxmousecapturelostevent}\helpref{wxMouseCaptureChangedEvent}{wxmousecapturechangedevent}\membersection{wxWindow::GetCaret}\label{wxwindowgetcaret}\constfunc{wxCaret *}{GetCaret}{\void}Returns the \helpref{caret}{wxcaret} associated with the window.\membersection{wxWindow::GetCharHeight}\label{wxwindowgetcharheight}\constfunc{virtual int}{GetCharHeight}{\void}Returns the character height for this window.\membersection{wxWindow::GetCharWidth}\label{wxwindowgetcharwidth}\constfunc{virtual int}{GetCharWidth}{\void}Returns the average character width for this window.\membersection{wxWindow::GetChildren}\label{wxwindowgetchildren}\func{wxWindowList\&}{GetChildren}{\void}\constfunc{const wxWindowList\&}{GetChildren}{\void}Returns a reference to the list of the window's children. \texttt{wxWindowList} is a type-safe \helpref{wxList}{wxlist}-like class whose elements are of type\texttt{wxWindow *}.\membersection{wxWindow::GetClassDefaultAttributes}\label{wxwindowgetclassdefaultattributes}\func{static wxVisualAttributes}{GetClassDefaultAttributes}{\param{wxWindowVariant}{ variant = \texttt{wxWINDOW\_VARIANT\_NORMAL}}}Returns the default font and colours which are used by the control. This isuseful if you want to use the same font or colour in your own control as in astandard control -- which is a much better idea than hard coding specificcolours or fonts which might look completely out of place on the userssystem, especially if it uses themes.The \arg{variant} parameter is only relevant under Mac currently and isignore under other platforms. Under Mac, it will change the size of thereturned font. See \helpref{wxWindow::SetWindowVariant}{wxwindowsetwindowvariant}for more about this.This static method is ``overridden'' in many derived classes and so calling,for example, \helpref{wxButton}{wxbutton}::GetClassDefaultAttributes() will typicallyreturn the values appropriate for a button which will be normally differentfrom those returned by, say, \helpref{wxListCtrl}{wxlistctrl}::GetClassDefaultAttributes().The \texttt{wxVisualAttributes} structure has at least the fields\texttt{font}, \texttt{colFg} and \texttt{colBg}. All of them may be invalidif it was not possible to determine the default control appearance or,especially for the background colour, if the field doesn't make sense as isthe case for \texttt{colBg} for the controls with themed background.\wxheading{See also}\helpref{InheritAttributes}{wxwindowinheritattributes}\membersection{wxWindow::GetClientSize}\label{wxwindowgetclientsize}\constfunc{void}{GetClientSize}{\param{int* }{width}, \param{int* }{height}}\perlnote{In wxPerl this method takes no parameter and returnsa 2-element list {\tt (width, height)}.}\constfunc{wxSize}{GetClientSize}{\void}This gets the size of the window `client area' in pixels.The client area is the area which may be drawn on by the programmer,excluding title bar, border, scrollbars, etc.\wxheading{Parameters}\docparam{width}{Receives the client width in pixels.}\docparam{height}{Receives the client height in pixels.}\pythonnote{In place of a single overloaded method name, wxPythonimplements the following methods:\par\indented{2cm}{\begin{twocollist}\twocolitem{{\bf GetClientSizeTuple()}}{Returns a 2-tuple of (width, height)}\twocolitem{{\bf GetClientSize()}}{Returns a wxSize object}\end{twocollist}}}\wxheading{See also}\helpref{GetSize}{wxwindowgetsize},\rtfsp\helpref{GetVirtualSize}{wxwindowgetvirtualsize}\membersection{wxWindow::GetConstraints}\label{wxwindowgetconstraints}\constfunc{wxLayoutConstraints*}{GetConstraints}{\void}Returns a pointer to the window's layout constraints, or NULL if there are none.\membersection{wxWindow::GetContainingSizer}\label{wxwindowgetcontainingsizer}\constfunc{const wxSizer *}{GetContainingSizer}{\void}Return the sizer that this window is a member of, if any, otherwise{\tt NULL}.\membersection{wxWindow::GetCursor}\label{wxwindowgetcursor}\constfunc{const wxCursor\&}{GetCursor}{\void}Return the cursor associated with this window.\wxheading{See also}\helpref{wxWindow::SetCursor}{wxwindowsetcursor}\membersection{wxWindow::GetDefaultAttributes}\label{wxwindowgetdefaultattributes}\constfunc{virtual wxVisualAttributes}{GetDefaultAttributes}{\void}Currently this is the same as calling\helpref{GetClassDefaultAttributes}{wxwindowgetclassdefaultattributes}(\helpref{GetWindowVariant}{wxwindowgetwindowvariant}()).One advantage of using this function compared to the static version is thatthe call is automatically dispatched to the correct class (as usual withvirtual functions) and you don't have to specify the class name explicitly.The other one is that in the future this function could return differentresults, for example it might return a different font for an ``Ok'' buttonthan for a generic button if the users GUI is configured to show such buttonsin bold font. Of course, the down side is that it is impossible to call thisfunction without actually having an object to apply it to whereas the staticversion can be used without having to create an object first.\membersection{wxWindow::GetDropTarget}\label{wxwindowgetdroptarget}\constfunc{wxDropTarget*}{GetDropTarget}{\void}Returns the associated drop target, which may be NULL.\wxheading{See also}\helpref{wxWindow::SetDropTarget}{wxwindowsetdroptarget},\helpref{Drag and drop overview}{wxdndoverview}\membersection{wxWindow::GetEventHandler}\label{wxwindowgeteventhandler}\constfunc{wxEvtHandler*}{GetEventHandler}{\void}Returns the event handler for this window. By default, the window is itsown event handler.\wxheading{See also}\helpref{wxWindow::SetEventHandler}{wxwindowseteventhandler},\rtfsp\helpref{wxWindow::PushEventHandler}{wxwindowpusheventhandler},\rtfsp\helpref{wxWindow::PopEventHandler}{wxwindowpusheventhandler},\rtfsp\helpref{wxEvtHandler::ProcessEvent}{wxevthandlerprocessevent},\rtfsp\helpref{wxEvtHandler}{wxevthandler}\rtfsp\membersection{wxWindow::GetExtraStyle}\label{wxwindowgetextrastyle}\constfunc{long}{GetExtraStyle}{\void}Returns the extra style bits for the window.\membersection{wxWindow::GetFont}\label{wxwindowgetfont}\constfunc{wxFont}{GetFont}{\void}Returns the font for this window.\wxheading{See also}\helpref{wxWindow::SetFont}{wxwindowsetfont}\membersection{wxWindow::GetForegroundColour}\label{wxwindowgetforegroundcolour}\func{virtual wxColour}{GetForegroundColour}{\void}Returns the foreground colour of the window.\wxheading{Remarks}The interpretation of foreground colour is open to interpretation accordingto the window class; it may be the text colour or other colour, or it may notbe used at all.\wxheading{See also}\helpref{wxWindow::SetForegroundColour}{wxwindowsetforegroundcolour},\rtfsp\helpref{wxWindow::SetBackgroundColour}{wxwindowsetbackgroundcolour},\rtfsp\helpref{wxWindow::GetBackgroundColour}{wxwindowgetbackgroundcolour}\membersection{wxWindow::GetGrandParent}\label{wxwindowgetgrandparent}\constfunc{wxWindow*}{GetGrandParent}{\void}Returns the grandparent of a window, or NULL if there isn't one.\membersection{wxWindow::GetHandle}\label{wxwindowgethandle}\constfunc{void*}{GetHandle}{\void}Returns the platform-specific handle of the physical window. Cast it to an appropriatehandle, such as {\bf HWND} for Windows, {\bf Widget} for Motif, {\bf GtkWidget} for GTK or {\bf WinHandle} for PalmOS.\pythonnote{This method will return an integer in wxPython.}\perlnote{This method will return an integer in wxPerl.}\membersection{wxWindow::GetHelpTextAtPoint}\label{wxwindowgethelptextatpoint}\constfunc{virtual wxString}{GetHelpTextAtPoint}{\param{const wxPoint &}{point}, \param{wxHelpEvent::Origin }{origin}}Gets the help text to be used as context-sensitive help for this window. Thismethod should be overridden if the help message depends on the position insidethe window, otherwise \helpref{GetHelpText}{wxwindowgethelptext} can be used.\wxheading{Parameters}\docparam{point}{Coordinates of the mouse at the moment of help event emission.}\docparam{origin}{Help event origin, see also \helpref{wxHelpEvent::GetOrigin}{wxhelpeventgetorigin}.}\newsince{2.7.0}\membersection{wxWindow::GetHelpText}\label{wxwindowgethelptext}\constfunc{virtual wxString}{GetHelpText}{\void}Gets the help text to be used as context-sensitive help for this window.Note that the text is actually stored by the current \helpref{wxHelpProvider}{wxhelpprovider} implementation,and not in the window object itself.\wxheading{See also}\helpref{SetHelpText}{wxwindowsethelptext}, \helpref{GetHelpTextAtPoint}{wxwindowgethelptextatpoint}, \helpref{wxHelpProvider}{wxhelpprovider}\membersection{wxWindow::GetId}\label{wxwindowgetid}\constfunc{int}{GetId}{\void}Returns the identifier of the window.\wxheading{Remarks}Each window has an integer identifier. If the application has not provided one(or the default wxID\_ANY) an unique identifier with a negative value will be generated.\wxheading{See also}\helpref{wxWindow::SetId}{wxwindowsetid},\rtfsp\helpref{Window identifiers}{windowids}\membersection{wxWindow::GetLabel}\label{wxwindowgetlabel}\constfunc{virtual wxString }{GetLabel}{\void}Generic way of getting a label from any window, foridentification purposes.\wxheading{Remarks}The interpretation of this function differs from class to class.For frames and dialogs, the value returned is the title. For buttons or static text controls, it isthe button text. This function can be useful for meta-programs (such as testingtools or special-needs access programs) which need to identify windowsby name.\membersection{wxWindow::GetMaxSize}\label{wxwindowgetmaxsize}\constfunc{wxSize}{GetMaxSize}{\void}Returns the maximum size of the window, an indication to the sizer layout mechanismthat this is the maximum possible size. \membersection{wxWindow::GetMinSize}\label{wxwindowgetminsize}\constfunc{virtual wxSize}{GetMinSize}{\void}Returns the minimum size of the window, an indication to the sizer layout mechanismthat this is the minimum required size. It normally just returns the value setby \helpref{SetMinSize}{wxwindowsetminsize}, but it can be overridden to do thecalculation on demand.\membersection{wxWindow::GetName}\label{wxwindowgetname}\constfunc{virtual wxString }{GetName}{\void}Returns the window's name.\wxheading{Remarks}This name is not guaranteed to be unique; it is up to the programmer to supply an appropriatename in the window constructor or via \helpref{wxWindow::SetName}{wxwindowsetname}.\wxheading{See also}\helpref{wxWindow::SetName}{wxwindowsetname}\membersection{wxWindow::GetParent}\label{wxwindowgetparent}\constfunc{virtual wxWindow*}{GetParent}{\void}Returns the parent of the window, or NULL if there is no parent.\membersection{wxWindow::GetPosition}\label{wxwindowgetposition}\constfunc{virtual void}{GetPosition}{\param{int* }{x}, \param{int* }{y}}\constfunc{wxPoint}{GetPosition}{\void}This gets the position of the window in pixels, relative to the parent windowfor the child windows or relative to the display origin for the top levelwindows.\wxheading{Parameters}\docparam{x}{Receives the x position of the window if non-\NULL.}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -