]>
Commit | Line | Data |
---|---|---|
a660d684 KB |
1 | \section{\class{wxUpdateUIEvent}}\label{wxupdateuievent} |
2 | ||
3 | This class is used for pseudo-events which are called by wxWindows | |
4 | to give an application the chance to update various user interface elements. | |
5 | ||
6 | \wxheading{Derived from} | |
7 | ||
2b5f62a0 | 8 | \helpref{wxCommandEvent}{wxcommandevent}\\ |
a660d684 KB |
9 | \helpref{wxEvent}{wxevent}\\ |
10 | \helpref{wxObject}{wxobject} | |
11 | ||
954b8ae6 JS |
12 | \wxheading{Include files} |
13 | ||
14 | <wx/event.h> | |
15 | ||
a660d684 KB |
16 | \wxheading{Event table macros} |
17 | ||
631f1bfe | 18 | To process an update event, use these event handler macros to direct input to member |
a660d684 KB |
19 | functions that take a wxUpdateUIEvent argument. |
20 | ||
21 | \twocolwidtha{7cm} | |
22 | \begin{twocollist}\itemsep=0pt | |
3ca6a5f0 BP |
23 | \twocolitem{{\bf EVT\_UPDATE\_UI(id, func)}}{Process a wxEVT\_UPDATE\_UI event for the command with the given id.} |
24 | \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.} | |
a660d684 KB |
25 | \end{twocollist}% |
26 | ||
27 | \wxheading{Remarks} | |
28 | ||
29 | Without update UI events, an application has to work hard to check/uncheck, enable/disable, | |
30 | and set the text for elements such as menu items and toolbar buttons. | |
31 | The code for doing this has to be mixed up with the code that is invoked when | |
32 | an action is invoked for a menu item or button. | |
33 | ||
34 | With update UI events, you define an event handler to look at the state of | |
35 | the application and change UI elements accordingly. wxWindows will call your | |
36 | member functions in idle time, so you don't have to worry where to call this code. | |
37 | In addition to being a clearer and more declarative method, it also means you | |
38 | don't have to worry whether you're updating a toolbar or menubar identifier. | |
39 | The same handler can update a menu item and toolbar button, if the identifier is the same. | |
40 | ||
41 | Instead of directly manipulating the menu or button, you call functions in the event | |
42 | object, such as \helpref{wxUpdateUIEvent::Check}{wxupdateuieventcheck}. wxWindows | |
43 | will determine whether such a call has been made, and which UI element to update. | |
44 | ||
631f1bfe JS |
45 | These events will work for popup menus as well as menubars. Just before a menu is popped |
46 | up, \helpref{wxMenu::UpdateUI}{wxmenuupdateui} is called to process any UI events for | |
47 | the window that owns the menu. | |
48 | ||
a660d684 KB |
49 | \wxheading{See also} |
50 | ||
51 | \helpref{Event handling overview}{eventhandlingoverview} | |
52 | ||
53 | \latexignore{\rtfignore{\wxheading{Members}}} | |
54 | ||
55 | \membersection{wxUpdateUIEvent::wxUpdateUIEvent} | |
56 | ||
57 | \func{}{wxUpdateUIEvent}{\param{wxWindowID }{commandId = 0}} | |
58 | ||
59 | Constructor. | |
60 | ||
61 | \membersection{wxUpdateUIEvent::m\_checked} | |
62 | ||
63 | \member{bool}{m\_checked} | |
64 | ||
cc81d32f | 65 | true if the element should be checked, false otherwise. |
a660d684 KB |
66 | |
67 | \membersection{wxUpdateUIEvent::m\_enabled} | |
68 | ||
69 | \member{bool}{m\_checked} | |
70 | ||
cc81d32f | 71 | true if the element should be enabled, false otherwise. |
a660d684 KB |
72 | |
73 | \membersection{wxUpdateUIEvent::m\_setChecked} | |
74 | ||
75 | \member{bool}{m\_setChecked} | |
76 | ||
cc81d32f | 77 | true if the application has set the {\bf m\_checked} member. |
a660d684 KB |
78 | |
79 | \membersection{wxUpdateUIEvent::m\_setEnabled} | |
80 | ||
81 | \member{bool}{m\_setEnabled} | |
82 | ||
cc81d32f | 83 | true if the application has set the {\bf m\_enabled} member. |
a660d684 KB |
84 | |
85 | \membersection{wxUpdateUIEvent::m\_setText} | |
86 | ||
87 | \member{bool}{m\_setText} | |
88 | ||
cc81d32f | 89 | true if the application has set the {\bf m\_text} member. |
a660d684 KB |
90 | |
91 | \membersection{wxUpdateUIEvent::m\_text} | |
92 | ||
93 | \member{wxString}{m\_text} | |
94 | ||
95 | Holds the text with which the the application wishes to | |
96 | update the UI element. | |
97 | ||
98 | \membersection{wxUpdateUIEvent::Check}\label{wxupdateuieventcheck} | |
99 | ||
100 | \func{void}{Check}{\param{bool}{ check}} | |
101 | ||
102 | Check or uncheck the UI element. | |
103 | ||
104 | \membersection{wxUpdateUIEvent::Enable}\label{wxupdateuieventenable} | |
105 | ||
106 | \func{void}{Enable}{\param{bool}{ enable}} | |
107 | ||
108 | Enable or disable the UI element. | |
109 | ||
110 | \membersection{wxUpdateUIEvent::GetChecked}\label{wxupdateuieventgetchecked} | |
111 | ||
112 | \constfunc{bool}{GetChecked}{\void} | |
113 | ||
cc81d32f | 114 | Returns true if the UI element should be checked. |
a660d684 KB |
115 | |
116 | \membersection{wxUpdateUIEvent::GetEnabled}\label{wxupdateuieventgetenabled} | |
117 | ||
118 | \constfunc{bool}{GetEnabled}{\void} | |
119 | ||
cc81d32f | 120 | Returns true if the UI element should be enabled. |
a660d684 KB |
121 | |
122 | \membersection{wxUpdateUIEvent::GetSetChecked}\label{wxupdateuieventgetsetchecked} | |
123 | ||
124 | \constfunc{bool}{GetSetChecked}{\void} | |
125 | ||
cc81d32f | 126 | Returns true if the application has called {\bf SetChecked}. For wxWindows internal use only. |
a660d684 KB |
127 | |
128 | \membersection{wxUpdateUIEvent::GetSetEnabled}\label{wxupdateuieventgetsetenabled} | |
129 | ||
130 | \constfunc{bool}{GetSetEnabled}{\void} | |
131 | ||
cc81d32f | 132 | Returns true if the application has called {\bf SetEnabled}. For wxWindows internal use only. |
a660d684 KB |
133 | |
134 | \membersection{wxUpdateUIEvent::GetSetText}\label{wxupdateuieventgetsettext} | |
135 | ||
136 | \constfunc{bool}{GetSetText}{\void} | |
137 | ||
cc81d32f | 138 | Returns true if the application has called {\bf SetText}. For wxWindows internal use only. |
a660d684 KB |
139 | |
140 | \membersection{wxUpdateUIEvent::GetText}\label{wxupdateuieventgettext} | |
141 | ||
142 | \constfunc{wxString}{GetText}{\void} | |
143 | ||
144 | Returns the text that should be set for the UI element. | |
145 | ||
146 | \membersection{wxUpdateUIEvent::SetText}\label{wxupdateuieventsettext} | |
147 | ||
148 | \func{void}{SetText}{\param{const wxString\&}{ text}} | |
149 | ||
150 | Sets the text for this UI element. | |
151 |