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