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