This class is used for pseudo-events which are called by wxWindows to give an application the chance to update various user interface elements.
Derived from
Include files
<wx/event.h>
Event table macros
To process an update event, use these event handler macros to direct input to member functions that take a wxUpdateUIEvent argument.
EVT_UPDATE_UI(id, func) | Process a wxEVT_UPDATE_UI event for the command with the given id. |
EVT_UPDATE_UI_RANGE(id1, id2, func) | Process a wxEVT_UPDATE_UI event for any command with id included in the given range. |
Without update UI events, an application has to work hard to check/uncheck, enable/disable, 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 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 the application and change UI elements accordingly. wxWindows will call your 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 object, such as wxUpdateUIEvent::Check. wxWindows will 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 popped up, wxMenu::UpdateUI is called to process any UI events for the window that owns the menu.
See also
Members
wxUpdateUIEvent::wxUpdateUIEvent
wxUpdateUIEvent::m_checked
wxUpdateUIEvent::m_enabled
wxUpdateUIEvent::m_setChecked
wxUpdateUIEvent::m_setEnabled
wxUpdateUIEvent::m_setText
wxUpdateUIEvent::m_text
wxUpdateUIEvent::Check
wxUpdateUIEvent::Enable
wxUpdateUIEvent::GetChecked
wxUpdateUIEvent::GetEnabled
wxUpdateUIEvent::GetSetChecked
wxUpdateUIEvent::GetSetEnabled
wxUpdateUIEvent::GetSetText
wxUpdateUIEvent::GetText
wxUpdateUIEvent::SetText
wxUpdateUIEvent(wxWindowID commandId = 0)
Constructor.
bool m_checked
TRUE if the element should be checked, FALSE otherwise.
bool m_checked
TRUE if the element should be enabled, FALSE otherwise.
bool m_setChecked
TRUE if the application has set the m_checked member.
bool m_setEnabled
TRUE if the application has set the m_enabled member.
bool m_setText
TRUE if the application has set the m_text member.
wxString m_text
Holds the text with which the the application wishes to update the UI element.
void Check(bool check)
Check or uncheck the UI element.
void Enable(bool enable)
Enable or disable the UI element.
bool GetChecked() const
Returns TRUE if the UI element should be checked.
bool GetEnabled() const
Returns TRUE if the UI element should be enabled.
bool GetSetChecked() const
Returns TRUE if the application has called SetChecked. For wxWindows internal use only.
bool GetSetEnabled() const
Returns TRUE if the application has called SetEnabled. For wxWindows internal use only.
bool GetSetText() const
Returns TRUE if the application has called SetText. For wxWindows internal use only.
wxString GetText() const
Returns the text that should be set for the UI element.
void SetText(const wxString& text)
Sets the text for this UI element.