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