📄 window.tex
字号:
\helpref{Window deletion overview}{windowdeletionoverview},\rtfsp\helpref{wxWindow::Destroy}{wxwindowdestroy},\rtfsp\helpref{wxCloseEvent}{wxcloseevent}\membersection{wxWindow::ConvertDialogToPixels}\label{wxwindowconvertdialogtopixels}\func{wxPoint}{ConvertDialogToPixels}{\param{const wxPoint\&}{ pt}}\func{wxSize}{ConvertDialogToPixels}{\param{const wxSize\&}{ sz}}Converts a point or size from dialog units to pixels.For the x dimension, the dialog units are multiplied by the average character widthand then divided by 4.For the y dimension, the dialog units are multiplied by the average character heightand then divided by 8.\wxheading{Remarks}Dialog units are used for maintaining a dialog's proportions even if the font changes.You can also use these functions programmatically. A convenience macro is defined:{\small\begin{verbatim}#define wxDLG_UNIT(parent, pt) parent->ConvertDialogToPixels(pt)\end{verbatim}}\wxheading{See also}\helpref{wxWindow::ConvertPixelsToDialog}{wxwindowconvertpixelstodialog}\pythonnote{In place of a single overloaded method name, wxPythonimplements the following methods:\par\indented{2cm}{\begin{twocollist}\twocolitem{{\bf ConvertDialogPointToPixels(point)}}{Accepts and returns a wxPoint}\twocolitem{{\bf ConvertDialogSizeToPixels(size)}}{Accepts and returns a wxSize}\end{twocollist}}Additionally, the following helper functions are defined:\par\indented{2cm}{\begin{twocollist}\twocolitem{{\bf wxDLG\_PNT(win, point)}}{Converts a wxPoint from dialogunits to pixels}\twocolitem{{\bf wxDLG\_SZE(win, size)}}{Converts a wxSize from dialogunits to pixels}\end{twocollist}}}\membersection{wxWindow::ConvertPixelsToDialog}\label{wxwindowconvertpixelstodialog}\func{wxPoint}{ConvertPixelsToDialog}{\param{const wxPoint\&}{ pt}}\func{wxSize}{ConvertPixelsToDialog}{\param{const wxSize\&}{ sz}}Converts a point or size from pixels to dialog units.For the x dimension, the pixels are multiplied by 4 and then divided by the averagecharacter width.For the y dimension, the pixels are multiplied by 8 and then divided by the averagecharacter height.\wxheading{Remarks}Dialog units are used for maintaining a dialog's proportions even if the font changes.\wxheading{See also}\helpref{wxWindow::ConvertDialogToPixels}{wxwindowconvertdialogtopixels}\pythonnote{In place of a single overloaded method name, wxPython implements the following methods:\par\indented{2cm}{\begin{twocollist}\twocolitem{{\bf ConvertDialogPointToPixels(point)}}{Accepts and returns a wxPoint}\twocolitem{{\bf ConvertDialogSizeToPixels(size)}}{Accepts and returns a wxSize}\end{twocollist}}}\membersection{wxWindow::Destroy}\label{wxwindowdestroy}\func{virtual bool}{Destroy}{\void}Destroys the window safely. Use this function instead of the delete operator, sincedifferent window classes can be destroyed differently. Frames and dialogsare not destroyed immediately when this function is called -- they are addedto a list of windows to be deleted on idle time, when all the window's eventshave been processed. This prevents problems with events being sent to non-existentwindows.\wxheading{Return value}{\tt true} if the window has either been successfully deleted, or it has been addedto the list of windows pending real deletion.\membersection{wxWindow::DestroyChildren}\label{wxwindowdestroychildren}\func{virtual void}{DestroyChildren}{\void}Destroys all children of a window. Called automatically by the destructor.\membersection{wxWindow::Disable}\label{wxwindowdisable}\func{bool}{Disable}{\void}Disables the window, same as \helpref{Enable({\tt false})}{wxwindowenable}.\wxheading{Return value}Returns {\tt true} if the window has been disabled, {\tt false} if it had beenalready disabled before the call to this function.\membersection{wxWindow::DoGetBestSize}\label{wxwindowdogetbestsize}\constfunc{virtual wxSize}{DoGetBestSize}{\void}Gets the size which best suits the window: for a control, it would bethe minimal size which doesn't truncate the control, for a panel - thesame size as it would have after a call to \helpref{Fit()}{wxwindowfit}.\membersection{wxWindow::DoUpdateWindowUI}\label{wxwindowdoupdatewindowui}\func{virtual void}{DoUpdateWindowUI}{\param{wxUpdateUIEvent\&}{ event}}Does the window-specific updating after processing the update event.This function is called by \helpref{wxWindow::UpdateWindowUI}{wxwindowupdatewindowui}in order to check return values in the \helpref{wxUpdateUIEvent}{wxupdateuievent} andact appropriately. For example, to allow frame and dialog title updating, wxWidgetsimplements this function as follows:\begin{verbatim}// do the window-specific processing after processing the update eventvoid wxTopLevelWindowBase::DoUpdateWindowUI(wxUpdateUIEvent& event){ if ( event.GetSetEnabled() ) Enable(event.GetEnabled()); if ( event.GetSetText() ) { if ( event.GetText() != GetTitle() ) SetTitle(event.GetText()); }}\end{verbatim}\membersection{wxWindow::DragAcceptFiles}\label{wxwindowdragacceptfiles}\func{virtual void}{DragAcceptFiles}{\param{bool}{ accept}}Enables or disables eligibility for drop file events (OnDropFiles).\wxheading{Parameters}\docparam{accept}{If {\tt true}, the window is eligible for drop file events. If {\tt false}, the windowwill not accept drop file events.}\wxheading{Remarks}Windows only.\membersection{wxWindow::Enable}\label{wxwindowenable}\func{virtual bool}{Enable}{\param{bool}{ enable = {\tt true}}}Enable or disable the window for user input. Note that when a parent window isdisabled, all of its children are disabled as well and they are reenabled againwhen the parent is.\wxheading{Parameters}\docparam{enable}{If {\tt true}, enables the window for input. If {\tt false}, disables the window.}\wxheading{Return value}Returns {\tt true} if the window has been enabled or disabled, {\tt false} ifnothing was done, i.e. if the window had already been in the specified state.\wxheading{See also}\helpref{wxWindow::IsEnabled}{wxwindowisenabled},\rtfsp\helpref{wxWindow::Disable}{wxwindowdisable},\rtfsp\helpref{wxRadioBox::Enable}{wxradioboxenable}\membersection{wxWindow::FindFocus}\label{wxwindowfindfocus}\func{static wxWindow*}{FindFocus}{\void}Finds the window or control which currently has the keyboard focus.\wxheading{Remarks}Note that this is a static function, so it can be called without needing a wxWindow pointer.\wxheading{See also}\helpref{wxWindow::SetFocus}{wxwindowsetfocus}\membersection{wxWindow::FindWindow}\label{wxwindowfindwindow}\constfunc{wxWindow*}{FindWindow}{\param{long}{ id}}Find a child of this window, by identifier.\constfunc{wxWindow*}{FindWindow}{\param{const wxString\&}{ name}}Find a child of this window, by name.\pythonnote{In place of a single overloaded method name, wxPythonimplements the following methods:\par\indented{2cm}{\begin{twocollist}\twocolitem{{\bf FindWindowById(id)}}{Accepts an integer}\twocolitem{{\bf FindWindowByName(name)}}{Accepts a string}\end{twocollist}}}\membersection{wxWindow::FindWindowById}\label{wxwindowfindwindowbyid}\func{static wxWindow*}{FindWindowById}{\param{long}{ id}, \param{wxWindow*}{ parent = NULL}}Find the first window with the given {\it id}.If {\it parent} is NULL, the search will start from all top-levelframes and dialog boxes; if non-NULL, the search will be limited to the given window hierarchy.The search is recursive in both cases.\wxheading{See also}\helpref{FindWindow}{wxwindowfindwindow}\membersection{wxWindow::FindWindowByLabel}\label{wxwindowfindwindowbylabel}\func{static wxWindow*}{FindWindowByLabel}{\param{const wxString\&}{ label}, \param{wxWindow*}{ parent = NULL}}Find a window by its label. Depending on the type of window, the label may be a window titleor panel item label. If {\it parent} is NULL, the search will start from all top-levelframes and dialog boxes; if non-NULL, the search will be limited to the given window hierarchy.The search is recursive in both cases.\wxheading{See also}\helpref{FindWindow}{wxwindowfindwindow}\membersection{wxWindow::FindWindowByName}\label{wxwindowfindwindowbyname}\func{static wxWindow*}{FindWindowByName}{\param{const wxString\&}{ name}, \param{wxWindow*}{ parent = NULL}}Find a window by its name (as given in a window constructor or {\bf Create} function call).If {\it parent} is NULL, the search will start from all top-levelframes and dialog boxes; if non-NULL, the search will be limited to the given window hierarchy.The search is recursive in both cases.If no window with such name is found,\helpref{FindWindowByLabel}{wxwindowfindwindowbylabel} is called.\wxheading{See also}\helpref{FindWindow}{wxwindowfindwindow}\membersection{wxWindow::Fit}\label{wxwindowfit}\func{virtual void}{Fit}{\void}Sizes the window so that it fits around its subwindows. This function won't doanything if there are no subwindows and will only really work correctly if thesizers are used for the subwindows layout. Also, if the window has exactly onesubwindow it is better (faster and the result is more precise as Fit adds somemargin to account for fuzziness of its calculations) to call\begin{verbatim} window->SetClientSize(child->GetSize());\end{verbatim}instead of calling Fit.\membersection{wxWindow::FitInside}\label{wxwindowfitinside}\func{virtual void}{FitInside}{\void}Similar to \helpref{Fit}{wxwindowfit}, but sizes the interior (virtual) sizeof a window. Mainly useful with scrolled windows to reset scrollbars aftersizing changes that do not trigger a size event, and/or scrolled windows withoutan interior sizer. This function similarly won't do anything if there are nosubwindows.\membersection{wxWindow::Freeze}\label{wxwindowfreeze}\func{virtual void}{Freeze}{\void}Freezes the window or, in other words, prevents any updates from taking placeon screen, the window is not redrawn at all. \helpref{Thaw}{wxwindowthaw} mustbe called to reenable window redrawing. Calls to these two functions may benested.This method is useful for visual appearance optimization (for example, itis a good idea to use it before doing many large text insertions in a row intoa wxTextCtrl under wxGTK) but is not implemented on all platforms nor for allcontrols so it is mostly just a hint to wxWidgets and not a mandatorydirective.\wxheading{See also}\helpref{wxWindowUpdateLocker}{wxwindowupdatelocker}\membersection{wxWindow::GetAcceleratorTable}\label{wxwindowgetacceleratortable}\constfunc{wxAcceleratorTable*}{GetAcceleratorTable}{\void}Gets the accelerator table for this window. See \helpref{wxAcceleratorTable}{wxacceleratortable}.\membersection{wxWindow::GetAccessible}\label{wxwindowgetaccessible}\func{wxAccessible*}{GetAccessible}{\void}Returns the accessible object for this window, if any.See also \helpref{wxAccessible}{wxaccessible}.\membersection{wxWindow::GetAdjustedBestSize}\label{wxwindowgetadjustedbestsize}\constfunc{wxSize}{GetAdjustedBestSize}{\void}This method is deprecated, use \helpref{GetEffectiveMinSize}{wxwindowgeteffectiveminsize}instead.\membersection{wxWindow::GetBackgroundColour}\label{wxwindowgetbackgroundcolour}\constfunc{virtual wxColour}{GetBackgroundColour}{\void}Returns the background colour of the window.\wxheading{See also}\helpref{wxWindow::SetBackgroundColour}{wxwindowsetbackgroundcolour},\rtfsp\helpref{wxWindow::SetForegroundColour}{wxwindowsetforegroundcolour},\rtfsp\helpref{wxWindow::GetForegroundColour}{wxwindowgetforegroundcolour}\membersection{wxWindow::GetBackgroundStyle}\label{wxwindowgetbackgroundstyle}\constfunc{virtual wxBackgroundStyle}{GetBackgroundStyle}{\void}Returns the background style of the window. The background style indicateswhether background colour should be determined by the system (wxBG\_STYLE\_SYSTEM),be set to a specific colour (wxBG\_STYLE\_COLOUR), or should be left to theapplication to implement (wxBG\_STYLE\_CUSTOM).On GTK+, use of wxBG\_STYLE\_CUSTOM allows the flicker-free drawing of a custombackground, such as a tiled bitmap. Currently the style has no effect on other platforms.\wxheading{See also}\helpref{wxWindow::SetBackgroundColour}{wxwindowsetbackgroundcolour},\rtfsp\helpref{wxWindow::GetForegroundColour}{wxwindowgetforegroundcolour},\rtfsp\helpref{wxWindow::SetBackgroundStyle}{wxwindowsetbackgroundstyle}\membersection{wxWindow::GetEffectiveMinSize}\label{wxwindowgeteffectiveminsize}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -