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 _VCL_VCLEVENT_HXX
21 : #define _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 :
28 : #include <com/sun/star/uno/Reference.hxx>
29 :
30 : #include <list>
31 : #include <vector>
32 :
33 : class Window;
34 : class Menu;
35 :
36 : namespace com { namespace sun { namespace star {
37 : namespace accessibility {
38 : class XAccessible;
39 : }
40 : }}}
41 :
42 : #define VCLEVENT_OBJECT_DYING 1
43 :
44 : // VclWindowEvent:
45 : #define VCLEVENT_WINDOW_CHILDCREATED 500 // pData = Window*
46 : #define VCLEVENT_WINDOW_CHILDDESTROYED 501 // pData = Window*
47 : #define VCLEVENT_WINDOW_PAINT 1000 // pData = Rectangle*
48 : #define VCLEVENT_WINDOW_MOVE 1001
49 : #define VCLEVENT_WINDOW_RESIZE 1002
50 : #define VCLEVENT_WINDOW_SHOW 1003
51 : #define VCLEVENT_WINDOW_HIDE 1004
52 : #define VCLEVENT_WINDOW_ACTIVATE 1005
53 : #define VCLEVENT_WINDOW_DEACTIVATE 1006 // pData = Window* = pPrevActiveWindow
54 : #define VCLEVENT_WINDOW_CLOSE 1007
55 : #define VCLEVENT_WINDOW_GETFOCUS 1008
56 : #define VCLEVENT_WINDOW_LOSEFOCUS 1009
57 : #define VCLEVENT_WINDOW_MINIMIZE 1010
58 : #define VCLEVENT_WINDOW_NORMALIZE 1011
59 : #define VCLEVENT_WINDOW_KEYINPUT 1012 // pData = KeyEvent*
60 : #define VCLEVENT_WINDOW_KEYUP 1013 // pData = KeyEvent*
61 : #define VCLEVENT_WINDOW_COMMAND 1014 // pData = CommandEvent*
62 : #define VCLEVENT_WINDOW_MOUSEMOVE 1015 // pData = MouseEvent*
63 : #define VCLEVENT_WINDOW_MOUSEBUTTONDOWN 1016 // pData = MouseEvent*
64 : #define VCLEVENT_WINDOW_MOUSEBUTTONUP 1017 // pData = MouseEvent*
65 : #define VCLEVENT_WINDOW_FRAMETITLECHANGED 1018 // pData = XubString* = oldTitle
66 : #define VCLEVENT_APPLICATION_DATACHANGED 1019 // pData = DataChangedEvent*
67 : #define VCLEVENT_WINDOW_ENABLED 1020
68 : #define VCLEVENT_WINDOW_DISABLED 1021
69 : #define VCLEVENT_WINDOW_DATACHANGED 1022 // pData = DataChangedEvent*
70 :
71 : // VclWindowEvent
72 : #define VCLEVENT_CONTROL_GETFOCUS 1100
73 : #define VCLEVENT_CONTROL_LOSEFOCUS 1101
74 : #define VCLEVENT_BUTTON_CLICK 1102
75 : #define VCLEVENT_PUSHBUTTON_TOGGLE 1103
76 : #define VCLEVENT_RADIOBUTTON_TOGGLE 1104
77 : #define VCLEVENT_CHECKBOX_TOGGLE 1105
78 : #define VCLEVENT_COMBOBOX_SELECT 1106
79 : #define VCLEVENT_COMBOBOX_DOUBLECLICK 1107
80 : #define VCLEVENT_LISTBOX_SELECT 1108
81 : #define VCLEVENT_LISTBOX_DOUBLECLICK 1109
82 : #define VCLEVENT_EDIT_MODIFY 1110
83 : #define VCLEVENT_SCROLLBAR_SCROLL 1111
84 : #define VCLEVENT_SCROLLBAR_ENDSCROLL 1112
85 : #define VCLEVENT_SPINBUTTON_UP 1113
86 : #define VCLEVENT_SPINBUTTON_DOWN 1114
87 : #define VCLEVENT_SPINFIELD_UP 1115
88 : #define VCLEVENT_SPINFIELD_DOWN 1116
89 : #define VCLEVENT_SPINFIELD_FIRST 1117
90 : #define VCLEVENT_SPINFIELD_LAST 1118
91 : #define VCLEVENT_STATUSBAR_CLICK 1119
92 : #define VCLEVENT_STATUSBAR_DOUBLECLICK 1120
93 : #define VCLEVENT_TOOLBOX_CLICK 1121
94 : #define VCLEVENT_TOOLBOX_DOUBLECLICK 1122
95 : #define VCLEVENT_TOOLBOX_ACTIVATE 1123
96 : #define VCLEVENT_TOOLBOX_DEACTIVATE 1124
97 : #define VCLEVENT_TOOLBOX_HIGHLIGHT 1125
98 : #define VCLEVENT_TOOLBOX_SELECT 1126
99 : // Resort later...
100 : #define VCLEVENT_LISTBOX_SCROLLED 1127
101 : #define VCLEVENT_COMBOBOX_SCROLLED 1128
102 : #define VCLEVENT_EDIT_SELECTIONCHANGED 1129
103 : #define VCLEVENT_DROPDOWN_OPEN 1130
104 : #define VCLEVENT_DROPDOWN_CLOSE 1131
105 :
106 : #define VCLEVENT_TOOLBOX_ITEMADDED 1132 // pData = itempos
107 : #define VCLEVENT_TOOLBOX_ITEMREMOVED 1133 // pData = itempos
108 : #define VCLEVENT_TOOLBOX_ALLITEMSCHANGED 1134
109 : #define VCLEVENT_TOOLBOX_HIGHLIGHTOFF 1135 // pData = itempos
110 : #define VCLEVENT_WINDOW_MENUBARADDED 1136 // pData = pMenuBar
111 : #define VCLEVENT_TABPAGE_ACTIVATE 1137 // pData = pageid
112 : #define VCLEVENT_TABPAGE_DEACTIVATE 1138 // pData = pageid
113 : #define VCLEVENT_TABBAR_PAGEENABLED 1139 // pData = pageid
114 : #define VCLEVENT_TABBAR_PAGEDISABLED 1140 // pData = pageid
115 : #define VCLEVENT_TABBAR_PAGESELECTED 1141 // pData = pageid
116 : #define VCLEVENT_TABBAR_PAGEACTIVATED 1142 // pData = pageid
117 : #define VCLEVENT_TABBAR_PAGEDEACTIVATED 1143 // pData = pageid
118 : #define VCLEVENT_TABBAR_PAGEINSERTED 1144 // pData = pageid
119 : #define VCLEVENT_TABBAR_PAGEREMOVED 1145 // pData = pageid
120 : #define VCLEVENT_TABBAR_PAGEMOVED 1146 // pData = Pair( pagepos_old, pagepos_new )
121 : #define VCLEVENT_TABBAR_PAGETEXTCHANGED 1147 // pData = pageid
122 : #define VCLEVENT_COMBOBOX_DESELECT 1148
123 : #define VCLEVENT_TOOLBOX_ITEMTEXTCHANGED 1149 // pData = itempos
124 : #define VCLEVENT_TABPAGE_INSERTED 1150 // pData = pageid
125 : #define VCLEVENT_TABPAGE_REMOVED 1151 // pData = pageid
126 : #define VCLEVENT_TABPAGE_REMOVEDALL 1152
127 : #define VCLEVENT_LISTBOX_ITEMADDED 1153 // pData = itempos
128 : #define VCLEVENT_LISTBOX_ITEMREMOVED 1154 // pData = itempos, -1=ALL
129 : #define VCLEVENT_COMBOBOX_ITEMADDED 1155 // pData = itempos
130 : #define VCLEVENT_COMBOBOX_ITEMREMOVED 1156 // pData = itempos, -1=ALL
131 : // free 1157
132 : #define VCLEVENT_WINDOW_MENUBARREMOVED 1158 // pData = pMenuBar
133 : #define VCLEVENT_STATUSBAR_ITEMADDED 1159 // pData = itemid
134 : #define VCLEVENT_STATUSBAR_ITEMREMOVED 1160 // pData = itemid
135 : #define VCLEVENT_STATUSBAR_ALLITEMSREMOVED 1161
136 : #define VCLEVENT_STATUSBAR_SHOWITEM 1162 // pData = itemid
137 : #define VCLEVENT_STATUSBAR_HIDEITEM 1163 // pData = itemid
138 : #define VCLEVENT_STATUSBAR_SHOWALLITEMS 1164
139 : #define VCLEVENT_STATUSBAR_HIDEALLITEMS 1165
140 : #define VCLEVENT_STATUSBAR_DRAWITEM 1166 // pData = itemid
141 : #define VCLEVENT_STATUSBAR_NAMECHANGED 1167 // pData = itemid
142 : #define VCLEVENT_TOOLBOX_ITEMENABLED 1168 // pData = itempos
143 : #define VCLEVENT_TOOLBOX_ITEMDISABLED 1169 // pData = itempos
144 : #define VCLEVENT_TABPAGE_PAGETEXTCHANGED 1170 // pData = pageid
145 : #define VCLEVENT_ROADMAP_ITEMSELECTED 1171
146 : #define VCLEVENT_TOOLBOX_FORMATCHANGED 1172 // request new layout
147 : #define VCLEVENT_COMBOBOX_SETTEXT 1173
148 : // #i92103#
149 : #define VCLEVENT_ITEM_EXPANDED 1174
150 : #define VCLEVENT_ITEM_COLLAPSED 1175
151 : #define VCLEVENT_DROPDOWN_PRE_OPEN 1176
152 :
153 : // VclMenuEvent
154 : #define VCLEVENT_MENU_ACTIVATE 1200
155 : #define VCLEVENT_MENU_DEACTIVATE 1201
156 : #define VCLEVENT_MENU_HIGHLIGHT 1202
157 : #define VCLEVENT_MENU_SELECT 1203
158 : #define VCLEVENT_MENU_ENABLE 1204
159 : #define VCLEVENT_MENU_INSERTITEM 1205
160 : #define VCLEVENT_MENU_REMOVEITEM 1206
161 : #define VCLEVENT_MENU_SUBMENUACTIVATE 1207
162 : #define VCLEVENT_MENU_SUBMENUDEACTIVATE 1208
163 : #define VCLEVENT_MENU_SUBMENUCHANGED 1209
164 : #define VCLEVENT_MENU_DEHIGHLIGHT 1210
165 : #define VCLEVENT_MENU_DISABLE 1211
166 : #define VCLEVENT_MENU_ITEMTEXTCHANGED 1212
167 : #define VCLEVENT_MENU_ITEMCHECKED 1213
168 : #define VCLEVENT_MENU_ITEMUNCHECKED 1214
169 : #define VCLEVENT_MENU_ACCESSIBLENAMECHANGED 1215
170 :
171 : #define VCLEVENT_MENU_SHOW 1250
172 : #define VCLEVENT_MENU_HIDE 1251
173 :
174 : #define VCLEVENT_TOOLBOX_ITEMWINDOWCHANGED 1216
175 :
176 : // DockingWindow
177 : #define VCLEVENT_WINDOW_STARTDOCKING 1217 // pData = DockingData
178 : #define VCLEVENT_WINDOW_DOCKING 1218
179 : #define VCLEVENT_WINDOW_ENDDOCKING 1219 // pData = EndDockingData
180 : #define VCLEVENT_WINDOW_PREPARETOGGLEFLOATING 1220 // pData = sal_Bool
181 : #define VCLEVENT_WINDOW_TOGGLEFLOATING 1221
182 : #define VCLEVENT_WINDOW_ENDPOPUPMODE 1222 // pData = EndPopupModeData
183 :
184 : #define VCLEVENT_TOOLBOX_BUTTONSTATECHANGED 1223 // pData = itempos
185 : #define VCLEVENT_TABLECELL_NAMECHANGED 1224 // pData = struct(Entry, Column, oldText)
186 : #define VCLEVENT_TABLEROW_SELECT 1225
187 :
188 : class VCL_DLLPUBLIC VclSimpleEvent
189 : {
190 : private:
191 : sal_uLong nId;
192 :
193 : public:
194 72986 : VclSimpleEvent( sal_uLong n ) { nId = n; }
195 72986 : virtual ~VclSimpleEvent() {}
196 : TYPEINFO();
197 :
198 167499 : sal_uLong GetId() const { return nId; }
199 : };
200 :
201 : class VCL_DLLPUBLIC VclWindowEvent : public VclSimpleEvent
202 : {
203 : private:
204 : Window* pWindow;
205 : void* pData;
206 :
207 : public:
208 72038 : VclWindowEvent( Window* pWin, sal_uLong n, void* pDat = NULL ) : VclSimpleEvent(n) { pWindow = pWin; pData = pDat; }
209 72038 : virtual ~VclWindowEvent() {}
210 : TYPEINFO();
211 :
212 258993 : Window* GetWindow() const { return pWindow; }
213 15268 : void* GetData() const { return pData; }
214 : };
215 :
216 : class VCL_DLLPUBLIC VclMenuEvent : public VclSimpleEvent
217 : {
218 : private:
219 : Menu* pMenu;
220 : sal_uInt16 mnPos;
221 :
222 : public:
223 948 : VclMenuEvent( Menu* pM, sal_uLong n, sal_uInt16 nPos ) : VclSimpleEvent(n) { pMenu = pM; mnPos = nPos; }
224 948 : virtual ~VclMenuEvent() {}
225 : TYPEINFO();
226 :
227 0 : Menu* GetMenu() const { return pMenu; }
228 0 : sal_uInt16 GetItemPos() const { return mnPos; }
229 : };
230 :
231 : class VCL_DLLPUBLIC VclAccessibleEvent: public VclSimpleEvent
232 : {
233 : public:
234 : VclAccessibleEvent( sal_uLong n, const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxAccessible );
235 : virtual ~VclAccessibleEvent();
236 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetAccessible() const;
237 :
238 : private:
239 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxAccessible;
240 : };
241 :
242 31106 : class VCL_DLLPUBLIC VclEventListeners
243 : {
244 : public:
245 : void Call( VclSimpleEvent* pEvent ) const;
246 :
247 : // stops notifying when any handler has processed the event
248 : // and returns sal_True in that case
249 : // a handler must return sal_True to signal that it has processed the event
250 : sal_Bool Process( VclSimpleEvent* pEvent ) const;
251 : void addListener( const Link& rListener );
252 : void removeListener( const Link& rListener );
253 : private:
254 : std::list<Link> m_aListeners;
255 : };
256 :
257 : class VCL_DLLPUBLIC VclEventListeners2 : public vcl::DeletionNotifier
258 : {
259 : std::list< Link > m_aListeners;
260 :
261 : struct ListenerIt
262 : {
263 : std::list< Link >::iterator m_aIt;
264 : bool m_bWasInvalidated;
265 :
266 0 : ListenerIt(const std::list<Link>::iterator& rIt)
267 : : m_aIt(rIt)
268 0 : , m_bWasInvalidated( false )
269 0 : {}
270 : };
271 :
272 : std::vector< ListenerIt > m_aIterators;
273 :
274 :
275 : public:
276 : VclEventListeners2();
277 : ~VclEventListeners2();
278 :
279 : void addListener( const Link& );
280 : void removeListener( const Link& );
281 :
282 : void callListeners( VclSimpleEvent* );
283 : };
284 :
285 : #endif // _VCL_VCLEVENT_HXX
286 :
287 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|