Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _VCL_VCLEVENT_HXX
30 : : #define _VCL_VCLEVENT_HXX
31 : :
32 : : #include "tools/link.hxx"
33 : : #include "tools/rtti.hxx"
34 : : #include "vcl/dllapi.h"
35 : : #include "vcl/impdel.hxx"
36 : :
37 : : #include <com/sun/star/uno/Reference.hxx>
38 : :
39 : : #include <list>
40 : : #include <vector>
41 : :
42 : : class Window;
43 : : class Menu;
44 : :
45 : : namespace com { namespace sun { namespace star {
46 : : namespace accessibility {
47 : : class XAccessible;
48 : : }
49 : : }}}
50 : :
51 : : #define VCLEVENT_OBJECT_DYING 1
52 : :
53 : : // VclWindowEvent:
54 : : #define VCLEVENT_WINDOW_CHILDCREATED 500 // pData = Window*
55 : : #define VCLEVENT_WINDOW_CHILDDESTROYED 501 // pData = Window*
56 : : #define VCLEVENT_WINDOW_PAINT 1000 // pData = Rectangle*
57 : : #define VCLEVENT_WINDOW_MOVE 1001
58 : : #define VCLEVENT_WINDOW_RESIZE 1002
59 : : #define VCLEVENT_WINDOW_SHOW 1003
60 : : #define VCLEVENT_WINDOW_HIDE 1004
61 : : #define VCLEVENT_WINDOW_ACTIVATE 1005
62 : : #define VCLEVENT_WINDOW_DEACTIVATE 1006 // pData = Window* = pPrevActiveWindow
63 : : #define VCLEVENT_WINDOW_CLOSE 1007
64 : : #define VCLEVENT_WINDOW_GETFOCUS 1008
65 : : #define VCLEVENT_WINDOW_LOSEFOCUS 1009
66 : : #define VCLEVENT_WINDOW_MINIMIZE 1010
67 : : #define VCLEVENT_WINDOW_NORMALIZE 1011
68 : : #define VCLEVENT_WINDOW_KEYINPUT 1012 // pData = KeyEvent*
69 : : #define VCLEVENT_WINDOW_KEYUP 1013 // pData = KeyEvent*
70 : : #define VCLEVENT_WINDOW_COMMAND 1014 // pData = CommandEvent*
71 : : #define VCLEVENT_WINDOW_MOUSEMOVE 1015 // pData = MouseEvent*
72 : : #define VCLEVENT_WINDOW_MOUSEBUTTONDOWN 1016 // pData = MouseEvent*
73 : : #define VCLEVENT_WINDOW_MOUSEBUTTONUP 1017 // pData = MouseEvent*
74 : : #define VCLEVENT_WINDOW_FRAMETITLECHANGED 1018 // pData = XubString* = oldTitle
75 : : #define VCLEVENT_APPLICATION_DATACHANGED 1019 // pData = DataChangedEvent*
76 : : #define VCLEVENT_WINDOW_ENABLED 1020
77 : : #define VCLEVENT_WINDOW_DISABLED 1021
78 : : #define VCLEVENT_WINDOW_DATACHANGED 1022 // pData = DataChangedEvent*
79 : :
80 : : // VclWindowEvent
81 : : #define VCLEVENT_CONTROL_GETFOCUS 1100
82 : : #define VCLEVENT_CONTROL_LOSEFOCUS 1101
83 : : #define VCLEVENT_BUTTON_CLICK 1102
84 : : #define VCLEVENT_PUSHBUTTON_TOGGLE 1103
85 : : #define VCLEVENT_RADIOBUTTON_TOGGLE 1104
86 : : #define VCLEVENT_CHECKBOX_TOGGLE 1105
87 : : #define VCLEVENT_COMBOBOX_SELECT 1106
88 : : #define VCLEVENT_COMBOBOX_DOUBLECLICK 1107
89 : : #define VCLEVENT_LISTBOX_SELECT 1108
90 : : #define VCLEVENT_LISTBOX_DOUBLECLICK 1109
91 : : #define VCLEVENT_EDIT_MODIFY 1110
92 : : #define VCLEVENT_SCROLLBAR_SCROLL 1111
93 : : #define VCLEVENT_SCROLLBAR_ENDSCROLL 1112
94 : : #define VCLEVENT_SPINBUTTON_UP 1113
95 : : #define VCLEVENT_SPINBUTTON_DOWN 1114
96 : : #define VCLEVENT_SPINFIELD_UP 1115
97 : : #define VCLEVENT_SPINFIELD_DOWN 1116
98 : : #define VCLEVENT_SPINFIELD_FIRST 1117
99 : : #define VCLEVENT_SPINFIELD_LAST 1118
100 : : #define VCLEVENT_STATUSBAR_CLICK 1119
101 : : #define VCLEVENT_STATUSBAR_DOUBLECLICK 1120
102 : : #define VCLEVENT_TOOLBOX_CLICK 1121
103 : : #define VCLEVENT_TOOLBOX_DOUBLECLICK 1122
104 : : #define VCLEVENT_TOOLBOX_ACTIVATE 1123
105 : : #define VCLEVENT_TOOLBOX_DEACTIVATE 1124
106 : : #define VCLEVENT_TOOLBOX_HIGHLIGHT 1125
107 : : #define VCLEVENT_TOOLBOX_SELECT 1126
108 : : // Resort later...
109 : : #define VCLEVENT_LISTBOX_SCROLLED 1127
110 : : #define VCLEVENT_COMBOBOX_SCROLLED 1128
111 : : #define VCLEVENT_EDIT_SELECTIONCHANGED 1129
112 : : #define VCLEVENT_DROPDOWN_OPEN 1130
113 : : #define VCLEVENT_DROPDOWN_CLOSE 1131
114 : :
115 : : #define VCLEVENT_TOOLBOX_ITEMADDED 1132 // pData = itempos
116 : : #define VCLEVENT_TOOLBOX_ITEMREMOVED 1133 // pData = itempos
117 : : #define VCLEVENT_TOOLBOX_ALLITEMSCHANGED 1134
118 : : #define VCLEVENT_TOOLBOX_HIGHLIGHTOFF 1135 // pData = itempos
119 : : #define VCLEVENT_WINDOW_MENUBARADDED 1136 // pData = pMenuBar
120 : : #define VCLEVENT_TABPAGE_ACTIVATE 1137 // pData = pageid
121 : : #define VCLEVENT_TABPAGE_DEACTIVATE 1138 // pData = pageid
122 : : #define VCLEVENT_TABBAR_PAGEENABLED 1139 // pData = pageid
123 : : #define VCLEVENT_TABBAR_PAGEDISABLED 1140 // pData = pageid
124 : : #define VCLEVENT_TABBAR_PAGESELECTED 1141 // pData = pageid
125 : : #define VCLEVENT_TABBAR_PAGEACTIVATED 1142 // pData = pageid
126 : : #define VCLEVENT_TABBAR_PAGEDEACTIVATED 1143 // pData = pageid
127 : : #define VCLEVENT_TABBAR_PAGEINSERTED 1144 // pData = pageid
128 : : #define VCLEVENT_TABBAR_PAGEREMOVED 1145 // pData = pageid
129 : : #define VCLEVENT_TABBAR_PAGEMOVED 1146 // pData = Pair( pagepos_old, pagepos_new )
130 : : #define VCLEVENT_TABBAR_PAGETEXTCHANGED 1147 // pData = pageid
131 : : #define VCLEVENT_COMBOBOX_DESELECT 1148
132 : : #define VCLEVENT_TOOLBOX_ITEMTEXTCHANGED 1149 // pData = itempos
133 : : #define VCLEVENT_TABPAGE_INSERTED 1150 // pData = pageid
134 : : #define VCLEVENT_TABPAGE_REMOVED 1151 // pData = pageid
135 : : #define VCLEVENT_TABPAGE_REMOVEDALL 1152
136 : : #define VCLEVENT_LISTBOX_ITEMADDED 1153 // pData = itempos
137 : : #define VCLEVENT_LISTBOX_ITEMREMOVED 1154 // pData = itempos, -1=ALL
138 : : #define VCLEVENT_COMBOBOX_ITEMADDED 1155 // pData = itempos
139 : : #define VCLEVENT_COMBOBOX_ITEMREMOVED 1156 // pData = itempos, -1=ALL
140 : : // free 1157
141 : : #define VCLEVENT_WINDOW_MENUBARREMOVED 1158 // pData = pMenuBar
142 : : #define VCLEVENT_STATUSBAR_ITEMADDED 1159 // pData = itemid
143 : : #define VCLEVENT_STATUSBAR_ITEMREMOVED 1160 // pData = itemid
144 : : #define VCLEVENT_STATUSBAR_ALLITEMSREMOVED 1161
145 : : #define VCLEVENT_STATUSBAR_SHOWITEM 1162 // pData = itemid
146 : : #define VCLEVENT_STATUSBAR_HIDEITEM 1163 // pData = itemid
147 : : #define VCLEVENT_STATUSBAR_SHOWALLITEMS 1164
148 : : #define VCLEVENT_STATUSBAR_HIDEALLITEMS 1165
149 : : #define VCLEVENT_STATUSBAR_DRAWITEM 1166 // pData = itemid
150 : : #define VCLEVENT_STATUSBAR_NAMECHANGED 1167 // pData = itemid
151 : : #define VCLEVENT_TOOLBOX_ITEMENABLED 1168 // pData = itempos
152 : : #define VCLEVENT_TOOLBOX_ITEMDISABLED 1169 // pData = itempos
153 : : #define VCLEVENT_TABPAGE_PAGETEXTCHANGED 1170 // pData = pageid
154 : : #define VCLEVENT_ROADMAP_ITEMSELECTED 1171
155 : : #define VCLEVENT_TOOLBOX_FORMATCHANGED 1172 // request new layout
156 : : #define VCLEVENT_COMBOBOX_SETTEXT 1173
157 : : // #i92103#
158 : : #define VCLEVENT_ITEM_EXPANDED 1174
159 : : #define VCLEVENT_ITEM_COLLAPSED 1175
160 : : #define VCLEVENT_DROPDOWN_PRE_OPEN 1176
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 : :
180 : : #define VCLEVENT_MENU_SHOW 1250
181 : : #define VCLEVENT_MENU_HIDE 1251
182 : :
183 : : #define VCLEVENT_TOOLBOX_ITEMWINDOWCHANGED 1216
184 : :
185 : : // DockingWindow
186 : : #define VCLEVENT_WINDOW_STARTDOCKING 1217 // pData = DockingData
187 : : #define VCLEVENT_WINDOW_DOCKING 1218
188 : : #define VCLEVENT_WINDOW_ENDDOCKING 1219 // pData = EndDockingData
189 : : #define VCLEVENT_WINDOW_PREPARETOGGLEFLOATING 1220 // pData = sal_Bool
190 : : #define VCLEVENT_WINDOW_TOGGLEFLOATING 1221
191 : : #define VCLEVENT_WINDOW_ENDPOPUPMODE 1222 // pData = EndPopupModeData
192 : :
193 : : #define VCLEVENT_TOOLBOX_BUTTONSTATECHANGED 1223 // pData = itempos
194 : : #define VCLEVENT_TABLECELL_NAMECHANGED 1224 // pData = struct(Entry, Column, oldText)
195 : : #define VCLEVENT_TABLEROW_SELECT 1225
196 : :
197 : : class VCL_DLLPUBLIC VclSimpleEvent
198 : : {
199 : : private:
200 : : sal_uLong nId;
201 : :
202 : : public:
203 : 2350757 : VclSimpleEvent( sal_uLong n ) { nId = n; }
204 [ - + ]: 2350757 : virtual ~VclSimpleEvent() {}
205 : : TYPEINFO();
206 : :
207 : 5051134 : sal_uLong GetId() const { return nId; }
208 : : };
209 : :
210 : : class VCL_DLLPUBLIC VclWindowEvent : public VclSimpleEvent
211 : : {
212 : : private:
213 : : Window* pWindow;
214 : : void* pData;
215 : :
216 : : public:
217 : 1776915 : VclWindowEvent( Window* pWin, sal_uLong n, void* pDat = NULL ) : VclSimpleEvent(n) { pWindow = pWin; pData = pDat; }
218 [ - + ]: 1776915 : virtual ~VclWindowEvent() {}
219 : : TYPEINFO();
220 : :
221 : 6647723 : Window* GetWindow() const { return pWindow; }
222 : 103892 : void* GetData() const { return pData; }
223 : : };
224 : :
225 : : class VCL_DLLPUBLIC VclMenuEvent : public VclSimpleEvent
226 : : {
227 : : private:
228 : : Menu* pMenu;
229 : : sal_uInt16 mnPos;
230 : :
231 : : public:
232 : 573842 : VclMenuEvent( Menu* pM, sal_uLong n, sal_uInt16 nPos ) : VclSimpleEvent(n) { pMenu = pM; mnPos = nPos; }
233 [ - + ]: 573842 : virtual ~VclMenuEvent() {}
234 : : TYPEINFO();
235 : :
236 : 56 : Menu* GetMenu() const { return pMenu; }
237 : 1043 : sal_uInt16 GetItemPos() const { return mnPos; }
238 : : };
239 : :
240 : : class VCL_DLLPUBLIC VclAccessibleEvent: public VclSimpleEvent
241 : : {
242 : : public:
243 : : VclAccessibleEvent( sal_uLong n, const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxAccessible );
244 : : virtual ~VclAccessibleEvent();
245 : : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetAccessible() const;
246 : :
247 : : private:
248 : : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxAccessible;
249 : : };
250 : :
251 : 761623 : class VCL_DLLPUBLIC VclEventListeners
252 : : {
253 : : public:
254 : : void Call( VclSimpleEvent* pEvent ) const;
255 : :
256 : : // stops notifying when any handler has processed the event
257 : : // and returns sal_True in that case
258 : : // a handler must return sal_True to signal that it has processed the event
259 : : sal_Bool Process( VclSimpleEvent* pEvent ) const;
260 : : void addListener( const Link& rListener );
261 : : void removeListener( const Link& rListener );
262 : : private:
263 : : std::list<Link> m_aListeners;
264 : : };
265 : :
266 : : class VCL_DLLPUBLIC VclEventListeners2 : public vcl::DeletionNotifier
267 : : {
268 : : std::list< Link > m_aListeners;
269 : :
270 : : struct ListenerIt
271 : : {
272 : : std::list< Link >::iterator m_aIt;
273 : : bool m_bWasInvalidated;
274 : :
275 : 0 : ListenerIt(const std::list<Link>::iterator& rIt)
276 : : : m_aIt(rIt)
277 : 0 : , m_bWasInvalidated( false )
278 : 0 : {}
279 : : };
280 : :
281 : : std::vector< ListenerIt > m_aIterators;
282 : :
283 : :
284 : : public:
285 : : VclEventListeners2();
286 : : ~VclEventListeners2();
287 : :
288 : : void addListener( const Link& );
289 : : void removeListener( const Link& );
290 : :
291 : : void callListeners( VclSimpleEvent* );
292 : : };
293 : :
294 : : #endif // _VCL_VCLEVENT_HXX
295 : :
296 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|