1998-05-20 10:25:30 -04:00
|
|
|
\section{\class{wxUpdateUIEvent}}\label{wxupdateuievent}
|
|
|
|
|
2004-05-04 04:27:20 -04:00
|
|
|
This class is used for pseudo-events which are called by wxWidgets
|
1998-05-20 10:25:30 -04:00
|
|
|
to give an application the chance to update various user interface elements.
|
|
|
|
|
|
|
|
\wxheading{Derived from}
|
|
|
|
|
2002-12-04 09:11:26 -05:00
|
|
|
\helpref{wxCommandEvent}{wxcommandevent}\\
|
1998-05-20 10:25:30 -04:00
|
|
|
\helpref{wxEvent}{wxevent}\\
|
|
|
|
\helpref{wxObject}{wxobject}
|
|
|
|
|
1999-02-15 15:41:29 -05:00
|
|
|
\wxheading{Include files}
|
|
|
|
|
|
|
|
<wx/event.h>
|
|
|
|
|
1998-05-20 10:25:30 -04:00
|
|
|
\wxheading{Event table macros}
|
|
|
|
|
1999-02-06 08:32:46 -05:00
|
|
|
To process an update event, use these event handler macros to direct input to member
|
1998-05-20 10:25:30 -04:00
|
|
|
functions that take a wxUpdateUIEvent argument.
|
|
|
|
|
|
|
|
\twocolwidtha{7cm}
|
|
|
|
\begin{twocollist}\itemsep=0pt
|
2000-08-08 02:11:51 -04:00
|
|
|
\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.}
|
2004-02-21 20:16:32 -05:00
|
|
|
\end{twocollist}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\wxheading{Remarks}
|
|
|
|
|
|
|
|
Without update UI events, an application has to work hard to check/uncheck, enable/disable,
|
2006-02-12 11:32:50 -05:00
|
|
|
show/hide, and set the text for elements such as menu items and toolbar buttons.
|
1998-05-20 10:25:30 -04:00
|
|
|
The code for doing this has to be mixed up with the code that is invoked when
|
|
|
|
an action is invoked for a menu item or button.
|
|
|
|
|
|
|
|
With update UI events, you define an event handler to look at the state of
|
2004-05-04 04:27:20 -04:00
|
|
|
the application and change UI elements accordingly. wxWidgets will call your
|
1998-05-20 10:25:30 -04:00
|
|
|
member 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 you
|
|
|
|
don'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 event
|
2004-05-04 04:27:20 -04:00
|
|
|
object, such as \helpref{wxUpdateUIEvent::Check}{wxupdateuieventcheck}. wxWidgets
|
1998-05-20 10:25:30 -04:00
|
|
|
will determine whether such a call has been made, and which UI element to update.
|
|
|
|
|
1999-02-06 08:32:46 -05:00
|
|
|
These events will work for popup menus as well as menubars. Just before a menu is popped
|
|
|
|
up, \helpref{wxMenu::UpdateUI}{wxmenuupdateui} is called to process any UI events for
|
|
|
|
the window that owns the menu.
|
|
|
|
|
2003-07-09 06:15:21 -04:00
|
|
|
If you find that the overhead of UI update processing is affecting
|
|
|
|
your application, you can do one or both of the following:
|
|
|
|
|
|
|
|
\begin{enumerate}
|
|
|
|
\item Call \helpref{wxUpdateUIEvent::SetMode}{wxupdateuieventsetmode} with
|
|
|
|
a value of wxUPDATE\_UI\_PROCESS\_SPECIFIED, and set the extra style
|
2007-03-24 20:53:13 -04:00
|
|
|
wxWS\_EX\_PROCESS\_UI\_UPDATES for every window that should receive update events.
|
2003-07-09 06:15:21 -04:00
|
|
|
No other windows will receive update events.
|
|
|
|
\item Call \helpref{wxUpdateUIEvent::SetUpdateInterval}{wxupdateuieventsetupdateinterval} with
|
|
|
|
a millisecond value to set the delay between updates. You may need
|
|
|
|
to call \helpref{wxWindow::UpdateWindowUI}{wxwindowupdatewindowui} at critical
|
|
|
|
points, for example when a dialog is about to be shown, in case the user
|
|
|
|
sees a slight delay before windows are updated.
|
|
|
|
\end{enumerate}
|
|
|
|
|
|
|
|
Note that although events are sent in idle time, defining a wxIdleEvent
|
|
|
|
handler 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.
|
|
|
|
|
2004-05-04 04:27:20 -04:00
|
|
|
wxWidgets tries to optimize update events on some platforms. On Windows
|
2003-07-09 06:15:21 -04:00
|
|
|
and GTK+, events for menubar items are only sent when the menu is about
|
|
|
|
to be shown, and not in idle time.
|
|
|
|
|
1998-05-20 10:25:30 -04:00
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{Event handling overview}{eventhandlingoverview}
|
|
|
|
|
|
|
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
|
|
|
|
2004-09-22 06:59:57 -04:00
|
|
|
\membersection{wxUpdateUIEvent::wxUpdateUIEvent}\label{wxupdateuieventctor}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\func{}{wxUpdateUIEvent}{\param{wxWindowID }{commandId = 0}}
|
|
|
|
|
|
|
|
Constructor.
|
|
|
|
|
2003-07-09 06:15:21 -04:00
|
|
|
\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}),
|
2007-03-24 20:53:13 -04:00
|
|
|
the wxWS\_EX\_PROCESS\_UI\_UPDATES flag in {\it window},
|
2003-07-09 06:15:21 -04:00
|
|
|
the time update events were last sent in idle time, and
|
|
|
|
the update interval, to determine whether events should be sent to
|
|
|
|
this window now. By default this will always return {\tt true} because
|
|
|
|
the update mode is initially wxUPDATE\_UI\_PROCESS\_ALL and
|
|
|
|
the interval is set to 0; so update events will be sent as
|
|
|
|
often as possible. You can reduce the frequency that events
|
|
|
|
are 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}
|
|
|
|
|
1998-05-20 10:25:30 -04:00
|
|
|
\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.
|
|
|
|
|
2006-02-12 11:32:50 -05:00
|
|
|
\membersection{wxUpdateUIEvent::Show}\label{wxupdateuieventshow}
|
|
|
|
|
|
|
|
\func{void}{Show}{\param{bool}{ show}}
|
|
|
|
|
|
|
|
Show or hide the UI element.
|
|
|
|
|
1998-05-20 10:25:30 -04:00
|
|
|
\membersection{wxUpdateUIEvent::GetChecked}\label{wxupdateuieventgetchecked}
|
|
|
|
|
|
|
|
\constfunc{bool}{GetChecked}{\void}
|
|
|
|
|
2003-01-17 19:16:34 -05:00
|
|
|
Returns true if the UI element should be checked.
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\membersection{wxUpdateUIEvent::GetEnabled}\label{wxupdateuieventgetenabled}
|
|
|
|
|
|
|
|
\constfunc{bool}{GetEnabled}{\void}
|
|
|
|
|
2003-01-17 19:16:34 -05:00
|
|
|
Returns true if the UI element should be enabled.
|
1998-05-20 10:25:30 -04:00
|
|
|
|
2006-02-12 11:32:50 -05:00
|
|
|
\membersection{wxUpdateUIEvent::GetShown}\label{wxupdateuieventgetshown}
|
|
|
|
|
|
|
|
\constfunc{bool}{GetShown}{\void}
|
|
|
|
|
|
|
|
Returns true if the UI element should be shown.
|
|
|
|
|
1998-05-20 10:25:30 -04:00
|
|
|
\membersection{wxUpdateUIEvent::GetSetChecked}\label{wxupdateuieventgetsetchecked}
|
|
|
|
|
|
|
|
\constfunc{bool}{GetSetChecked}{\void}
|
|
|
|
|
2005-01-18 10:13:34 -05:00
|
|
|
Returns true if the application has called \helpref{wxUpdateUIEvent::Check}{wxupdateuieventcheck}. For wxWidgets internal use only.
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\membersection{wxUpdateUIEvent::GetSetEnabled}\label{wxupdateuieventgetsetenabled}
|
|
|
|
|
|
|
|
\constfunc{bool}{GetSetEnabled}{\void}
|
|
|
|
|
2005-01-18 10:13:34 -05:00
|
|
|
Returns true if the application has called \helpref{wxUpdateUIEvent::Enable}{wxupdateuieventenable}. For wxWidgets internal use only.
|
1998-05-20 10:25:30 -04:00
|
|
|
|
2006-02-12 11:32:50 -05:00
|
|
|
\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.
|
|
|
|
|
1998-05-20 10:25:30 -04:00
|
|
|
\membersection{wxUpdateUIEvent::GetSetText}\label{wxupdateuieventgetsettext}
|
|
|
|
|
|
|
|
\constfunc{bool}{GetSetText}{\void}
|
|
|
|
|
2005-01-18 10:13:34 -05:00
|
|
|
Returns true if the application has called \helpref{wxUpdateUIEvent::SetText}{wxupdateuieventsettext}. For wxWidgets internal use only.
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\membersection{wxUpdateUIEvent::GetText}\label{wxupdateuieventgettext}
|
|
|
|
|
|
|
|
\constfunc{wxString}{GetText}{\void}
|
|
|
|
|
|
|
|
Returns the text that should be set for the UI element.
|
|
|
|
|
2003-07-09 06:15:21 -04:00
|
|
|
\membersection{wxUpdateUIEvent::GetMode}\label{wxupdateuieventgetmode}
|
|
|
|
|
|
|
|
\func{static wxUpdateUIMode}{GetMode}{\void}
|
|
|
|
|
2004-05-04 04:27:20 -04:00
|
|
|
Static function returning a value specifying how wxWidgets
|
2003-07-09 06:15:21 -04:00
|
|
|
will send update events: to all windows, or only to those which specify that they
|
|
|
|
will 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 the
|
|
|
|
current time. It is assumed that update events are
|
|
|
|
normally sent in idle time, so this is called at the end of
|
|
|
|
idle processing.
|
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{wxUpdateUIEvent::CanUpdate}{wxupdateuieventcanupdate},
|
|
|
|
\helpref{wxUpdateUIEvent::SetUpdateInterval}{wxupdateuieventsetupdateinterval},
|
|
|
|
\helpref{wxUpdateUIEvent::SetMode}{wxupdateuieventsetmode}
|
|
|
|
|
|
|
|
\membersection{wxUpdateUIEvent::SetMode}\label{wxupdateuieventsetmode}
|
|
|
|
|
2005-02-06 13:25:54 -05:00
|
|
|
\func{static void}{SetMode}{\param{wxUpdateUIMode }{mode}}
|
2003-07-09 06:15:21 -04:00
|
|
|
|
2004-05-04 04:27:20 -04:00
|
|
|
Specify how wxWidgets will send update events: to
|
2003-07-09 06:15:21 -04:00
|
|
|
all windows, or only to those which specify that they
|
|
|
|
will 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}
|
|
|
|
|
1998-05-20 10:25:30 -04:00
|
|
|
\membersection{wxUpdateUIEvent::SetText}\label{wxupdateuieventsettext}
|
|
|
|
|
|
|
|
\func{void}{SetText}{\param{const wxString\&}{ text}}
|
|
|
|
|
|
|
|
Sets the text for this UI element.
|
|
|
|
|
2003-07-09 06:15:21 -04:00
|
|
|
\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 application
|
|
|
|
has 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 dialog
|
|
|
|
is about to be shown.
|
|
|
|
|