xref: /AOO41X/main/vcl/inc/vcl/vclevent.hxx (revision d3553c6b68aef63d45d1605bdabbc6fea7b9e42f)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _VCL_VCLEVENT_HXX
25 #define _VCL_VCLEVENT_HXX
26 
27 #include "tools/link.hxx"
28 #include "tools/rtti.hxx"
29 #include "vcl/dllapi.h"
30 #include "vcl/impdel.hxx"
31 
32 #include <com/sun/star/uno/Reference.hxx>
33 
34 #include <list>
35 #include <vector>
36 
37 class Window;
38 class Menu;
39 
40 namespace com { namespace sun { namespace star {
41     namespace accessibility {
42         class XAccessible;
43     }
44 }}}
45 
46 #define VCLEVENT_OBJECT_DYING                  1
47 
48 // VclWindowEvent:
49 #define VCLEVENT_WINDOW_CHILDCREATED         500    // pData = Window*
50 #define VCLEVENT_WINDOW_CHILDDESTROYED       501    // pData = Window*
51 #define VCLEVENT_WINDOW_PAINT               1000    // pData = Rectangle*
52 #define VCLEVENT_WINDOW_MOVE                1001
53 #define VCLEVENT_WINDOW_RESIZE              1002
54 #define VCLEVENT_WINDOW_SHOW                1003
55 #define VCLEVENT_WINDOW_HIDE                1004
56 #define VCLEVENT_WINDOW_ACTIVATE            1005
57 #define VCLEVENT_WINDOW_DEACTIVATE          1006    // pData = Window* = pPrevActiveWindow
58 #define VCLEVENT_WINDOW_CLOSE               1007
59 #define VCLEVENT_WINDOW_GETFOCUS            1008
60 #define VCLEVENT_WINDOW_LOSEFOCUS           1009
61 #define VCLEVENT_WINDOW_MINIMIZE            1010
62 #define VCLEVENT_WINDOW_NORMALIZE           1011
63 #define VCLEVENT_WINDOW_KEYINPUT            1012    // pData = KeyEvent*
64 #define VCLEVENT_WINDOW_KEYUP               1013    // pData = KeyEvent*
65 #define VCLEVENT_WINDOW_COMMAND             1014    // pData = CommandEvent*
66 #define VCLEVENT_WINDOW_MOUSEMOVE           1015    // pData = MouseEvent*
67 #define VCLEVENT_WINDOW_MOUSEBUTTONDOWN     1016    // pData = MouseEvent*
68 #define VCLEVENT_WINDOW_MOUSEBUTTONUP       1017    // pData = MouseEvent*
69 #define VCLEVENT_WINDOW_FRAMETITLECHANGED   1018    // pData = XubString* = oldTitle
70 #define VCLEVENT_APPLICATION_DATACHANGED    1019    // pData = DataChangedEvent*
71 #define VCLEVENT_WINDOW_ENABLED             1020
72 #define VCLEVENT_WINDOW_DISABLED            1021
73 #define VCLEVENT_WINDOW_DATACHANGED         1022    // pData = DataChangedEvent*
74 
75 // VclWindowEvent
76 #define VCLEVENT_CONTROL_GETFOCUS           1100
77 #define VCLEVENT_CONTROL_LOSEFOCUS          1101
78 #define VCLEVENT_BUTTON_CLICK               1102
79 #define VCLEVENT_PUSHBUTTON_TOGGLE          1103
80 #define VCLEVENT_RADIOBUTTON_TOGGLE         1104
81 #define VCLEVENT_CHECKBOX_TOGGLE            1105
82 #define VCLEVENT_COMBOBOX_SELECT            1106
83 #define VCLEVENT_COMBOBOX_DOUBLECLICK       1107
84 #define VCLEVENT_LISTBOX_SELECT             1108
85 #define VCLEVENT_LISTBOX_DOUBLECLICK        1109
86 #define VCLEVENT_EDIT_MODIFY                1110
87 #define VCLEVENT_SCROLLBAR_SCROLL           1111
88 #define VCLEVENT_SCROLLBAR_ENDSCROLL        1112
89 #define VCLEVENT_SPINBUTTON_UP              1113
90 #define VCLEVENT_SPINBUTTON_DOWN            1114
91 #define VCLEVENT_SPINFIELD_UP               1115
92 #define VCLEVENT_SPINFIELD_DOWN             1116
93 #define VCLEVENT_SPINFIELD_FIRST            1117
94 #define VCLEVENT_SPINFIELD_LAST             1118
95 #define VCLEVENT_STATUSBAR_CLICK            1119
96 #define VCLEVENT_STATUSBAR_DOUBLECLICK      1120
97 #define VCLEVENT_TOOLBOX_CLICK              1121
98 #define VCLEVENT_TOOLBOX_DOUBLECLICK        1122
99 #define VCLEVENT_TOOLBOX_ACTIVATE           1123
100 #define VCLEVENT_TOOLBOX_DEACTIVATE         1124
101 #define VCLEVENT_TOOLBOX_HIGHLIGHT          1125
102 #define VCLEVENT_TOOLBOX_SELECT             1126
103 // Resort later...
104 #define VCLEVENT_LISTBOX_SCROLLED           1127
105 #define VCLEVENT_COMBOBOX_SCROLLED          1128
106 #define VCLEVENT_EDIT_SELECTIONCHANGED      1129
107 #define VCLEVENT_DROPDOWN_OPEN				1130
108 #define VCLEVENT_DROPDOWN_CLOSE			    1131
109 
110 #define VCLEVENT_TOOLBOX_ITEMADDED          1132        // pData = itempos
111 #define VCLEVENT_TOOLBOX_ITEMREMOVED        1133        // pData = itempos
112 #define VCLEVENT_TOOLBOX_ALLITEMSCHANGED    1134
113 #define VCLEVENT_TOOLBOX_HIGHLIGHTOFF       1135        // pData = itempos
114 #define VCLEVENT_WINDOW_MENUBARADDED		1136        // pData = pMenuBar
115 #define VCLEVENT_TABPAGE_ACTIVATE           1137        // pData = pageid
116 #define VCLEVENT_TABPAGE_DEACTIVATE         1138        // pData = pageid
117 #define VCLEVENT_TABBAR_PAGEENABLED         1139        // pData = pageid
118 #define VCLEVENT_TABBAR_PAGEDISABLED        1140        // pData = pageid
119 #define VCLEVENT_TABBAR_PAGESELECTED        1141        // pData = pageid
120 #define VCLEVENT_TABBAR_PAGEACTIVATED       1142        // pData = pageid
121 #define VCLEVENT_TABBAR_PAGEDEACTIVATED     1143        // pData = pageid
122 #define VCLEVENT_TABBAR_PAGEINSERTED        1144        // pData = pageid
123 #define VCLEVENT_TABBAR_PAGEREMOVED         1145        // pData = pageid
124 #define VCLEVENT_TABBAR_PAGEMOVED           1146        // pData = Pair( pagepos_old, pagepos_new )
125 #define VCLEVENT_TABBAR_PAGETEXTCHANGED     1147        // pData = pageid
126 #define VCLEVENT_COMBOBOX_DESELECT          1148
127 #define VCLEVENT_TOOLBOX_ITEMTEXTCHANGED    1149        // pData = itempos
128 #define VCLEVENT_TABPAGE_INSERTED           1150        // pData = pageid
129 #define VCLEVENT_TABPAGE_REMOVED            1151        // pData = pageid
130 #define VCLEVENT_TABPAGE_REMOVEDALL         1152
131 #define VCLEVENT_LISTBOX_ITEMADDED          1153        // pData = itempos
132 #define VCLEVENT_LISTBOX_ITEMREMOVED        1154        // pData = itempos, -1=ALL
133 #define VCLEVENT_COMBOBOX_ITEMADDED         1155        // pData = itempos
134 #define VCLEVENT_COMBOBOX_ITEMREMOVED       1156        // pData = itempos, -1=ALL
135 // free                                     1157
136 #define VCLEVENT_WINDOW_MENUBARREMOVED      1158        // pData = pMenuBar
137 #define VCLEVENT_STATUSBAR_ITEMADDED        1159        // pData = itemid
138 #define VCLEVENT_STATUSBAR_ITEMREMOVED      1160        // pData = itemid
139 #define VCLEVENT_STATUSBAR_ALLITEMSREMOVED  1161
140 #define VCLEVENT_STATUSBAR_SHOWITEM         1162        // pData = itemid
141 #define VCLEVENT_STATUSBAR_HIDEITEM         1163        // pData = itemid
142 #define VCLEVENT_STATUSBAR_SHOWALLITEMS     1164
143 #define VCLEVENT_STATUSBAR_HIDEALLITEMS     1165
144 #define VCLEVENT_STATUSBAR_DRAWITEM			1166		// pData = itemid
145 #define VCLEVENT_STATUSBAR_NAMECHANGED		1167		// pData = itemid
146 #define VCLEVENT_TOOLBOX_ITEMENABLED        1168        // pData = itempos
147 #define VCLEVENT_TOOLBOX_ITEMDISABLED       1169        // pData = itempos
148 #define VCLEVENT_TABPAGE_PAGETEXTCHANGED    1170        // pData = pageid
149 #define VCLEVENT_ROADMAP_ITEMSELECTED       1171
150 #define VCLEVENT_TOOLBOX_FORMATCHANGED      1172        // request new layout
151 #define VCLEVENT_COMBOBOX_SETTEXT           1173
152 // --> OD 2009-04-01 #i92103#
153 #define VCLEVENT_ITEM_EXPANDED              1174
154 #define VCLEVENT_ITEM_COLLAPSED             1175
155 // <--
156 #define VCLEVENT_DROPDOWN_PRE_OPEN          1176
157 //IAccessibility2 Implementation 2009-----
158 #define VCLEVENT_LISTBOX_FOCUSITEMCHANGED	1180
159 // #define VCLEVENT_EDIT_CARETCHANGED  		xxxx	// IA2 CWS. MT: VCL only has selection API - difference for selection_changed vs. caret_changed is handled in accessibility wrapper since OOo 3.2
160 //-----IAccessibility2 Implementation 2009
161 
162 // VclMenuEvent
163 #define VCLEVENT_MENU_ACTIVATE              1200
164 #define VCLEVENT_MENU_DEACTIVATE            1201
165 #define VCLEVENT_MENU_HIGHLIGHT             1202
166 #define VCLEVENT_MENU_SELECT                1203
167 #define VCLEVENT_MENU_ENABLE                1204
168 #define VCLEVENT_MENU_INSERTITEM            1205
169 #define VCLEVENT_MENU_REMOVEITEM            1206
170 #define VCLEVENT_MENU_SUBMENUACTIVATE       1207
171 #define VCLEVENT_MENU_SUBMENUDEACTIVATE     1208
172 #define VCLEVENT_MENU_SUBMENUCHANGED        1209
173 #define VCLEVENT_MENU_DEHIGHLIGHT           1210
174 #define VCLEVENT_MENU_DISABLE               1211
175 #define VCLEVENT_MENU_ITEMTEXTCHANGED		1212
176 #define VCLEVENT_MENU_ITEMCHECKED			1213
177 #define VCLEVENT_MENU_ITEMUNCHECKED			1214
178 #define VCLEVENT_MENU_ACCESSIBLENAMECHANGED	1215
179 //IAccessibility2 Implementation 2009-----
180 #define VCLEVENT_TOOLBOX_ITEMWINDOWCHANGED  1216
181 #define VCLEVENT_TOOLBOX_ITEMUPDATED  1217
182 //-----IAccessibility2 Implementation 2009
183 
184 #define VCLEVENT_MENU_SHOW                  1250
185 #define VCLEVENT_MENU_HIDE                  1251
186 
187 #define VCLEVENT_TOOLBOX_ITEMWINDOWCHANGED  1216
188 //IAccessibility2 Implementation 2009-----
189 #define VCLEVENT_LISTBOX_TREEEXPAND             1218
190 #define VCLEVENT_LISTBOX_TREECOLLAPSE           1219
191 #define VCLEVENT_LISTBOX_TREEFOCUS	            1220
192 #define VCLEVENT_LISTBOX_TREESELECT	            1221
193 #define VCLEVENT_EDIT_CARETCHANGED  1222
194 #define VCLEVENT_COMBOBOX_UPDATEVALUE  1223
195 
196 #define VCLEVENT_LISTBOX_FOCUS             1224
197 #define VCLEVENT_LISTBOX_CLEAR             1225
198 //-----IAccessibility2 Implementation 2009
199 // DockingWindow
200 #define VCLEVENT_WINDOW_STARTDOCKING            1227    // pData = DockingData
201 #define VCLEVENT_WINDOW_DOCKING                 1228
202 #define VCLEVENT_WINDOW_ENDDOCKING              1229    // pData = EndDockingData
203 #define VCLEVENT_WINDOW_PREPARETOGGLEFLOATING   1230    // pData = sal_Bool
204 #define VCLEVENT_WINDOW_TOGGLEFLOATING          1231
205 #define VCLEVENT_WINDOW_ENDPOPUPMODE            1232    // pData = EndPopupModeData
206 
207 #define VCLEVENT_TOOLBOX_BUTTONSTATECHANGED     1233    // pData = itempos
208 #define VCLEVENT_TABLECELL_NAMECHANGED          1234    // pData = struct(Entry, Column, oldText)
209 #define VCLEVENT_TABLEROW_SELECT				1235
210 // IAccessible2 implementation 2009
211 #define VCLEVENT_LISTBOX_STATEUPDATE			1236
212 class VCL_DLLPUBLIC VclSimpleEvent
213 {
214 private:
215     sal_uLong nId;
216 
217 public:
218     VclSimpleEvent( sal_uLong n ) { nId = n; }
219 	TYPEINFO();
220 
221 	sal_uLong GetId() const { return nId; }
222 };
223 
224 class VCL_DLLPUBLIC VclWindowEvent : public VclSimpleEvent
225 {
226 private:
227     Window* pWindow;
228     void*   pData;
229 
230 public:
231     VclWindowEvent( Window* pWin, sal_uLong n, void* pDat = NULL ) : VclSimpleEvent(n) { pWindow = pWin; pData = pDat; }
232 	TYPEINFO();
233 
234 	Window* GetWindow() const { return pWindow; }
235 	void*   GetData() const { return pData; }
236 };
237 
238 /*
239 class VclMouseEvent : public VclWindowEvent
240 {
241 private:
242     MouseEvent aEvent;
243 
244 public:
245     VclMouseEvent( Window* pWin, sal_uLong n, const MouseEvent& rEvent ) : VclWindowEvent( pWin, n ), aEvent(rEvent) { ; }
246 	TYPEINFO();
247 
248 	const MouseEvent& GetEvent() const { return aEvent; }
249 };
250 */
251 
252 class VCL_DLLPUBLIC VclMenuEvent : public VclSimpleEvent
253 {
254 private:
255     Menu* pMenu;
256     sal_uInt16 mnPos;
257 
258 public:
259     VclMenuEvent( Menu* pM, sal_uLong n, sal_uInt16 nPos ) : VclSimpleEvent(n) { pMenu = pM; mnPos = nPos; }
260 	TYPEINFO();
261 
262 	Menu* GetMenu() const { return pMenu; }
263     sal_uInt16 GetItemPos() const { return mnPos; }
264 };
265 
266 class VCL_DLLPUBLIC VclAccessibleEvent: public VclSimpleEvent
267 {
268 public:
269     VclAccessibleEvent( sal_uLong n, const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxAccessible );
270     virtual ~VclAccessibleEvent();
271     ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetAccessible() const;
272 
273 private:
274     ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxAccessible;
275 };
276 
277 class VCL_DLLPUBLIC VclEventListeners : public std::list<Link>
278 {
279 public:
280     void Call( VclSimpleEvent* pEvent ) const;
281 
282     // stops notifying when any handler has processed the event
283     // and returns sal_True in that case
284     // a handler must return sal_True to signal that it has processed the event
285     sal_Bool Process( VclSimpleEvent* pEvent ) const;
286 };
287 
288 class VCL_DLLPUBLIC VclEventListeners2 : public vcl::DeletionNotifier
289 {
290     std::list< Link >                               m_aListeners;
291 
292     struct ListenerIt
293     {
294         std::list< Link >::iterator     m_aIt;
295         bool                            m_bWasInvalidated;
296 
297         ListenerIt(const std::list<Link>::iterator& rIt)
298             : m_aIt(rIt)
299             , m_bWasInvalidated( false )
300         {}
301     };
302 
303     std::vector< ListenerIt >      m_aIterators;
304 
305 
306 public:
307     VclEventListeners2();
308     ~VclEventListeners2();
309 
310     void addListener( const Link& );
311     void removeListener( const Link& );
312 
313     void callListeners( VclSimpleEvent* );
314 };
315 
316 #endif // _VCL_VCLEVENT_HXX
317