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

📄 upduievt.tex

📁 很牛的GUI源码wxWidgets-2.8.0.zip 可在多种平台下运行.
💻 TEX
字号:
\section{\class{wxUpdateUIEvent}}\label{wxupdateuievent}This class is used for pseudo-events which are called by wxWidgetsto give an application the chance to update various user interface elements.\wxheading{Derived from}\helpref{wxCommandEvent}{wxcommandevent}\\\helpref{wxEvent}{wxevent}\\\helpref{wxObject}{wxobject}\wxheading{Include files}<wx/event.h>\wxheading{Event table macros}To process an update event, use these event handler macros to direct input to memberfunctions that take a wxUpdateUIEvent argument.\twocolwidtha{7cm}\begin{twocollist}\itemsep=0pt\twocolitem{{\bf EVT\_UPDATE\_UI(id, func)}}{Process a wxEVT\_UPDATE\_UI event for the command with the given id.}\twocolitem{{\bf EVT\_UPDATE\_UI\_RANGE(id1, id2, func)}}{Process a wxEVT\_UPDATE\_UI event for any command with id included in the given range.}\end{twocollist}\wxheading{Remarks}Without update UI events, an application has to work hard to check/uncheck, enable/disable,show/hide, and set the text for elements such as menu items and toolbar buttons.The code for doing this has to be mixed up with the code that is invoked whenan action is invoked for a menu item or button.With update UI events, you define an event handler to look at the state ofthe application and change UI elements accordingly. wxWidgets will call yourmember functions in idle time, so you don't have to worry where to call this code.In addition to being a clearer and more declarative method, it also means youdon't have to worry whether you're updating a toolbar or menubar identifier.The same handler can update a menu item and toolbar button, if the identifier is the same.Instead of directly manipulating the menu or button, you call functions in the eventobject, such as \helpref{wxUpdateUIEvent::Check}{wxupdateuieventcheck}. wxWidgetswill determine whether such a call has been made, and which UI element to update.These events will work for popup menus as well as menubars. Just before a menu is poppedup, \helpref{wxMenu::UpdateUI}{wxmenuupdateui} is called to process any UI events forthe window that owns the menu.If you find that the overhead of UI update processing is affectingyour application, you can do one or both of the following:\begin{enumerate}\item Call \helpref{wxUpdateUIEvent::SetMode}{wxupdateuieventsetmode} witha value of wxUPDATE\_UI\_PROCESS\_SPECIFIED, and set the extra stylewxWS\_EX\_PROCESS\_UPDATE\_EVENTS for every window that should receive update events.No other windows will receive update events.\item Call \helpref{wxUpdateUIEvent::SetUpdateInterval}{wxupdateuieventsetupdateinterval} witha millisecond value to set the delay between updates. You may needto call \helpref{wxWindow::UpdateWindowUI}{wxwindowupdatewindowui} at criticalpoints, for example when a dialog is about to be shown, in case the usersees a slight delay before windows are updated.\end{enumerate}Note that although events are sent in idle time, defining a wxIdleEventhandler for a window does not affect this because the events are sent from \helpref{wxWindow::OnInternalIdle}{wxwindowoninternalidle} which is {\bf always} called in idle time.wxWidgets tries to optimize update events on some platforms. On Windowsand GTK+, events for menubar items are only sent when the menu is aboutto be shown, and not in idle time.\wxheading{See also}\helpref{Event handling overview}{eventhandlingoverview}\latexignore{\rtfignore{\wxheading{Members}}}\membersection{wxUpdateUIEvent::wxUpdateUIEvent}\label{wxupdateuieventctor}\func{}{wxUpdateUIEvent}{\param{wxWindowID }{commandId = 0}}Constructor.\membersection{wxUpdateUIEvent::CanUpdate}\label{wxupdateuieventcanupdate}\func{static bool}{CanUpdate}{\param{wxWindow*}{ window}}Returns {\tt true} if it is appropriate to update (send UI update events to)this window.This function looks at the mode used (see \helpref{wxUpdateUIEvent::SetMode}{wxupdateuieventsetmode}),the wxWS\_EX\_PROCESS\_UPDATE\_EVENTS flag in {\it window},the time update events were last sent in idle time, andthe update interval, to determine whether events should be sent tothis window now. By default this will always return {\tt true} becausethe update mode is initially wxUPDATE\_UI\_PROCESS\_ALL andthe interval is set to 0; so update events will be sent asoften as possible. You can reduce the frequency that eventsare sent by changing the mode and/or setting an update interval.\wxheading{See also}\helpref{wxUpdateUIEvent::ResetUpdateTime}{wxupdateuieventresetupdatetime}, \helpref{wxUpdateUIEvent::SetUpdateInterval}{wxupdateuieventsetupdateinterval}, \helpref{wxUpdateUIEvent::SetMode}{wxupdateuieventsetmode}\membersection{wxUpdateUIEvent::Check}\label{wxupdateuieventcheck}\func{void}{Check}{\param{bool}{ check}}Check or uncheck the UI element.\membersection{wxUpdateUIEvent::Enable}\label{wxupdateuieventenable}\func{void}{Enable}{\param{bool}{ enable}}Enable or disable the UI element.\membersection{wxUpdateUIEvent::Show}\label{wxupdateuieventshow}\func{void}{Show}{\param{bool}{ show}}Show or hide the UI element.\membersection{wxUpdateUIEvent::GetChecked}\label{wxupdateuieventgetchecked}\constfunc{bool}{GetChecked}{\void}Returns true if the UI element should be checked.\membersection{wxUpdateUIEvent::GetEnabled}\label{wxupdateuieventgetenabled}\constfunc{bool}{GetEnabled}{\void}Returns true if the UI element should be enabled.\membersection{wxUpdateUIEvent::GetShown}\label{wxupdateuieventgetshown}\constfunc{bool}{GetShown}{\void}Returns true if the UI element should be shown.\membersection{wxUpdateUIEvent::GetSetChecked}\label{wxupdateuieventgetsetchecked}\constfunc{bool}{GetSetChecked}{\void}Returns true if the application has called \helpref{wxUpdateUIEvent::Check}{wxupdateuieventcheck}. For wxWidgets internal use only.\membersection{wxUpdateUIEvent::GetSetEnabled}\label{wxupdateuieventgetsetenabled}\constfunc{bool}{GetSetEnabled}{\void}Returns true if the application has called \helpref{wxUpdateUIEvent::Enable}{wxupdateuieventenable}. For wxWidgets internal use only.\membersection{wxUpdateUIEvent::GetSetShown}\label{wxupdateuieventgetsetshown}\constfunc{bool}{GetSetShown}{\void}Returns true if the application has called \helpref{wxUpdateUIEvent::Show}{wxupdateuieventshow}. For wxWidgets internal use only.\membersection{wxUpdateUIEvent::GetSetText}\label{wxupdateuieventgetsettext}\constfunc{bool}{GetSetText}{\void}Returns true if the application has called \helpref{wxUpdateUIEvent::SetText}{wxupdateuieventsettext}. For wxWidgets internal use only.\membersection{wxUpdateUIEvent::GetText}\label{wxupdateuieventgettext}\constfunc{wxString}{GetText}{\void}Returns the text that should be set for the UI element.\membersection{wxUpdateUIEvent::GetMode}\label{wxupdateuieventgetmode}\func{static wxUpdateUIMode}{GetMode}{\void}Static function returning a value specifying how wxWidgetswill send update events: to all windows, or only to those which specify that theywill process the events.See \helpref{wxUpdateUIEvent::SetMode}{wxupdateuieventsetmode}.\membersection{wxUpdateUIEvent::GetUpdateInterval}\label{wxupdateuieventgetupdateinterval}\func{static long}{GetUpdateInterval}{\void}Returns the current interval between updates in milliseconds.-1 disables updates, 0 updates as frequently as possible.See \helpref{wxUpdateUIEvent::SetUpdateInterval}{wxupdateuieventsetupdateinterval}.\membersection{wxUpdateUIEvent::ResetUpdateTime}\label{wxupdateuieventresetupdatetime}\func{static void}{ResetUpdateTime}{\void}Used internally to reset the last-updated time to thecurrent time. It is assumed that update events arenormally sent in idle time, so this is called at the end ofidle processing.\wxheading{See also}\helpref{wxUpdateUIEvent::CanUpdate}{wxupdateuieventcanupdate}, \helpref{wxUpdateUIEvent::SetUpdateInterval}{wxupdateuieventsetupdateinterval}, \helpref{wxUpdateUIEvent::SetMode}{wxupdateuieventsetmode}\membersection{wxUpdateUIEvent::SetMode}\label{wxupdateuieventsetmode}\func{static void}{SetMode}{\param{wxUpdateUIMode }{mode}}Specify how wxWidgets will send update events: toall windows, or only to those which specify that theywill process the events.{\it mode} may be one of the following values.The default is wxUPDATE\_UI\_PROCESS\_ALL.\begin{verbatim}enum wxUpdateUIMode{        // Send UI update events to all windows    wxUPDATE_UI_PROCESS_ALL,        // Send UI update events to windows that have        // the wxWS_EX_PROCESS_UI_UPDATES flag specified    wxUPDATE_UI_PROCESS_SPECIFIED};\end{verbatim}\membersection{wxUpdateUIEvent::SetText}\label{wxupdateuieventsettext}\func{void}{SetText}{\param{const wxString\&}{ text}}Sets the text for this UI element.\membersection{wxUpdateUIEvent::SetUpdateInterval}\label{wxupdateuieventsetupdateinterval}\func{static void}{SetUpdateInterval}{\param{long }{updateInterval}}Sets the interval between updates in milliseconds.Set to -1 to disable updates, or to 0 to update as frequently as possible.The default is 0.Use this to reduce the overhead of UI update events if your applicationhas a lot of windows. If you set the value to -1 or greater than 0,you may also need to call \helpref{wxWindow::UpdateWindowUI}{wxwindowupdatewindowui} at appropriate points in your application, such as when a dialogis about to be shown.

⌨️ 快捷键说明

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