xref: /aoo41x/main/vcl/inc/vcl/event.hxx (revision e1beba7d)
10d63794cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
30d63794cSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
40d63794cSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
50d63794cSAndrew Rist  * distributed with this work for additional information
60d63794cSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
70d63794cSAndrew Rist  * to you under the Apache License, Version 2.0 (the
80d63794cSAndrew Rist  * "License"); you may not use this file except in compliance
90d63794cSAndrew Rist  * with the License.  You may obtain a copy of the License at
100d63794cSAndrew Rist  *
110d63794cSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
120d63794cSAndrew Rist  *
130d63794cSAndrew Rist  * Unless required by applicable law or agreed to in writing,
140d63794cSAndrew Rist  * software distributed under the License is distributed on an
150d63794cSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
160d63794cSAndrew Rist  * KIND, either express or implied.  See the License for the
170d63794cSAndrew Rist  * specific language governing permissions and limitations
180d63794cSAndrew Rist  * under the License.
190d63794cSAndrew Rist  *
200d63794cSAndrew Rist  *************************************************************/
210d63794cSAndrew Rist 
220d63794cSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _SV_EVENT_HXX
25cdf0e10cSrcweir #define _SV_EVENT_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <vcl/sv.h>
28cdf0e10cSrcweir #include <vcl/dllapi.h>
29cdf0e10cSrcweir #include <tools/gen.hxx>
30cdf0e10cSrcweir #include <vcl/keycod.hxx>
31cdf0e10cSrcweir #include <vcl/cmdevt.hxx>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir class AllSettings;
34cdf0e10cSrcweir class OutputDevice;
35cdf0e10cSrcweir class Window;
36cdf0e10cSrcweir struct IDataObject;
37cdf0e10cSrcweir 
38cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace awt {
39cdf0e10cSrcweir 	struct KeyEvent;
40cdf0e10cSrcweir 	struct MouseEvent;
41cdf0e10cSrcweir } } } }
42cdf0e10cSrcweir 
43cdf0e10cSrcweir enum TextDirectionality {
44cdf0e10cSrcweir     TextDirectionality_LeftToRight_TopToBottom,
45cdf0e10cSrcweir     TextDirectionality_RightToLeft_TopToBottom,
46cdf0e10cSrcweir     TextDirectionality_TopToBottom_RightToLeft
47cdf0e10cSrcweir };
48cdf0e10cSrcweir 
49cdf0e10cSrcweir // ------------
50cdf0e10cSrcweir // - KeyEvent -
51cdf0e10cSrcweir // ------------
52cdf0e10cSrcweir class VCL_DLLPUBLIC KeyEvent
53cdf0e10cSrcweir {
54cdf0e10cSrcweir private:
55cdf0e10cSrcweir     KeyCode         maKeyCode;
56cdf0e10cSrcweir     sal_uInt16          mnRepeat;
57cdf0e10cSrcweir     xub_Unicode     mnCharCode;
58cdf0e10cSrcweir 
59cdf0e10cSrcweir public:
60cdf0e10cSrcweir                     KeyEvent();
61cdf0e10cSrcweir                     KeyEvent( xub_Unicode nChar, const KeyCode& rKeyCode,
62cdf0e10cSrcweir                               sal_uInt16 nRepeat = 0 );
63cdf0e10cSrcweir 
64cdf0e10cSrcweir 					/** inits this vcl KeyEvent with all settings from the given awt event **/
65cdf0e10cSrcweir 					KeyEvent( const ::com::sun::star::awt::KeyEvent& rEvent );
66cdf0e10cSrcweir 
67cdf0e10cSrcweir 	/** fills out the given awt KeyEvent with all settings from this vcl event **/
68cdf0e10cSrcweir 	void InitKeyEvent( ::com::sun::star::awt::KeyEvent& rEvent ) const;
69cdf0e10cSrcweir 
GetCharCode() const70cdf0e10cSrcweir     xub_Unicode     GetCharCode() const     { return mnCharCode; }
GetKeyCode() const71cdf0e10cSrcweir     const KeyCode&  GetKeyCode() const      { return maKeyCode;  }
GetRepeat() const72cdf0e10cSrcweir     sal_uInt16          GetRepeat() const       { return mnRepeat;   }
73cdf0e10cSrcweir 
74cdf0e10cSrcweir     KeyEvent        LogicalTextDirectionality (TextDirectionality eMode) const;
75cdf0e10cSrcweir                     KeyEvent (const KeyEvent& rKeyEvent);
76cdf0e10cSrcweir 
77cdf0e10cSrcweir };
78cdf0e10cSrcweir 
KeyEvent()79cdf0e10cSrcweir inline KeyEvent::KeyEvent()
80cdf0e10cSrcweir {
81cdf0e10cSrcweir     mnCharCode  = 0;
82cdf0e10cSrcweir     mnRepeat    = 0;
83cdf0e10cSrcweir }
84cdf0e10cSrcweir 
KeyEvent(xub_Unicode nChar,const KeyCode & rKeyCode,sal_uInt16 nRepeat)85cdf0e10cSrcweir inline KeyEvent::KeyEvent( xub_Unicode nChar, const KeyCode& rKeyCode,
86cdf0e10cSrcweir                            sal_uInt16 nRepeat ) :
87cdf0e10cSrcweir             maKeyCode( rKeyCode )
88cdf0e10cSrcweir 
89cdf0e10cSrcweir {
90cdf0e10cSrcweir     mnCharCode  = nChar;
91cdf0e10cSrcweir     mnRepeat    = nRepeat;
92cdf0e10cSrcweir }
93cdf0e10cSrcweir 
94cdf0e10cSrcweir // --------------------
95cdf0e10cSrcweir // - MouseEvent-Types -
96cdf0e10cSrcweir // --------------------
97cdf0e10cSrcweir 
98cdf0e10cSrcweir // Maus-Move-Modi
99cdf0e10cSrcweir #define MOUSE_SIMPLEMOVE        ((sal_uInt16)0x0001)
100cdf0e10cSrcweir #define MOUSE_DRAGMOVE          ((sal_uInt16)0x0002)
101cdf0e10cSrcweir #define MOUSE_DRAGCOPY          ((sal_uInt16)0x0004)
102cdf0e10cSrcweir #define MOUSE_ENTERWINDOW       ((sal_uInt16)0x0010)
103cdf0e10cSrcweir #define MOUSE_LEAVEWINDOW       ((sal_uInt16)0x0020)
104cdf0e10cSrcweir #define MOUSE_SYNTHETIC         ((sal_uInt16)0x0040)
105cdf0e10cSrcweir #define MOUSE_MODIFIERCHANGED   ((sal_uInt16)0x0080)
106cdf0e10cSrcweir 
107cdf0e10cSrcweir // Maus-Button-Down/Up-Modi
108cdf0e10cSrcweir #define MOUSE_SIMPLECLICK       ((sal_uInt16)0x0001)
109cdf0e10cSrcweir #define MOUSE_SELECT            ((sal_uInt16)0x0002)
110cdf0e10cSrcweir #define MOUSE_MULTISELECT       ((sal_uInt16)0x0004)
111cdf0e10cSrcweir #define MOUSE_RANGESELECT       ((sal_uInt16)0x0008)
112cdf0e10cSrcweir 
113cdf0e10cSrcweir // Maus-Buttons
114cdf0e10cSrcweir #define MOUSE_LEFT              ((sal_uInt16)0x0001)
115cdf0e10cSrcweir #define MOUSE_MIDDLE            ((sal_uInt16)0x0002)
116cdf0e10cSrcweir #define MOUSE_RIGHT             ((sal_uInt16)0x0004)
117cdf0e10cSrcweir 
118cdf0e10cSrcweir // --------------
119cdf0e10cSrcweir // - MouseEvent -
120cdf0e10cSrcweir // --------------
121cdf0e10cSrcweir 
122cdf0e10cSrcweir class VCL_DLLPUBLIC MouseEvent
123cdf0e10cSrcweir {
124cdf0e10cSrcweir private:
125cdf0e10cSrcweir     Point           maPos;
126cdf0e10cSrcweir     sal_uInt16          mnMode;
127cdf0e10cSrcweir     sal_uInt16          mnClicks;
128cdf0e10cSrcweir     sal_uInt16          mnCode;
129cdf0e10cSrcweir 
130cdf0e10cSrcweir public:
131*e1beba7dSHerbert Dürr     explicit        MouseEvent();
132*e1beba7dSHerbert Dürr     explicit        MouseEvent( const Point& rPos, sal_uInt16 nClicks = 1,
133cdf0e10cSrcweir                                 sal_uInt16 nMode = 0, sal_uInt16 nButtons = 0,
134cdf0e10cSrcweir                                 sal_uInt16 nModifier = 0 );
135cdf0e10cSrcweir 
GetPosPixel() const136cdf0e10cSrcweir     const Point&    GetPosPixel() const     { return maPos; }
GetMode() const137cdf0e10cSrcweir     sal_uInt16          GetMode() const         { return mnMode; }
138cdf0e10cSrcweir 					/** inits this vcl KeyEvent with all settings from the given awt event **/
139cdf0e10cSrcweir 					MouseEvent( const ::com::sun::star::awt::MouseEvent& rEvent );
140cdf0e10cSrcweir 
141cdf0e10cSrcweir 	/** fills out the given awt KeyEvent with all settings from this vcl event **/
142cdf0e10cSrcweir 	void InitMouseEvent( ::com::sun::star::awt::MouseEvent& rEvent ) const;
143cdf0e10cSrcweir 
GetClicks() const144cdf0e10cSrcweir     sal_uInt16          GetClicks() const       { return mnClicks; }
145cdf0e10cSrcweir 
IsEnterWindow() const146cdf0e10cSrcweir     sal_Bool            IsEnterWindow() const
147cdf0e10cSrcweir                         { return ((mnMode & MOUSE_ENTERWINDOW) != 0); }
IsLeaveWindow() const148cdf0e10cSrcweir     sal_Bool            IsLeaveWindow() const
149cdf0e10cSrcweir                         { return ((mnMode & MOUSE_LEAVEWINDOW) != 0); }
IsSynthetic() const150cdf0e10cSrcweir     sal_Bool            IsSynthetic() const
151cdf0e10cSrcweir                         { return ((mnMode & MOUSE_SYNTHETIC) != 0); }
IsModifierChanged() const152cdf0e10cSrcweir     sal_Bool            IsModifierChanged() const
153cdf0e10cSrcweir                         { return ((mnMode & MOUSE_MODIFIERCHANGED) != 0); }
154cdf0e10cSrcweir 
GetButtons() const155cdf0e10cSrcweir     sal_uInt16          GetButtons() const
156cdf0e10cSrcweir                         { return (mnCode & (MOUSE_LEFT | MOUSE_MIDDLE | MOUSE_RIGHT)); }
IsLeft() const157cdf0e10cSrcweir     sal_Bool            IsLeft() const
158cdf0e10cSrcweir                         { return ((mnCode & MOUSE_LEFT) != 0); }
IsMiddle() const159cdf0e10cSrcweir     sal_Bool            IsMiddle() const
160cdf0e10cSrcweir                         { return ((mnCode & MOUSE_MIDDLE) != 0); }
IsRight() const161cdf0e10cSrcweir     sal_Bool            IsRight() const
162cdf0e10cSrcweir                         { return ((mnCode & MOUSE_RIGHT) != 0); }
163cdf0e10cSrcweir 
GetModifier() const164cdf0e10cSrcweir     sal_uInt16          GetModifier() const
165cdf0e10cSrcweir                         { return (mnCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2)); }
IsShift() const166cdf0e10cSrcweir     sal_Bool            IsShift() const
167cdf0e10cSrcweir                         { return ((mnCode & KEY_SHIFT) != 0); }
IsMod1() const168cdf0e10cSrcweir     sal_Bool            IsMod1() const
169cdf0e10cSrcweir                         { return ((mnCode & KEY_MOD1) != 0); }
IsMod2() const170cdf0e10cSrcweir     sal_Bool            IsMod2() const
171cdf0e10cSrcweir                         { return ((mnCode & KEY_MOD2) != 0); }
IsMod3() const172cdf0e10cSrcweir     sal_Bool            IsMod3() const
173cdf0e10cSrcweir                         { return ((mnCode & KEY_MOD3) != 0); }
174cdf0e10cSrcweir };
175cdf0e10cSrcweir 
MouseEvent()176cdf0e10cSrcweir inline MouseEvent::MouseEvent()
177cdf0e10cSrcweir {
178cdf0e10cSrcweir     mnMode      = 0;
179cdf0e10cSrcweir     mnClicks    = 0;
180cdf0e10cSrcweir     mnCode      = 0;
181cdf0e10cSrcweir }
182cdf0e10cSrcweir 
MouseEvent(const Point & rPos,sal_uInt16 nClicks,sal_uInt16 nMode,sal_uInt16 nButtons,sal_uInt16 nModifier)183cdf0e10cSrcweir inline MouseEvent::MouseEvent( const Point& rPos, sal_uInt16 nClicks,
184cdf0e10cSrcweir                                sal_uInt16 nMode,
185cdf0e10cSrcweir                                sal_uInt16 nButtons, sal_uInt16 nModifier ) :
186cdf0e10cSrcweir             maPos( rPos )
187cdf0e10cSrcweir {
188cdf0e10cSrcweir     mnClicks    = nClicks;
189cdf0e10cSrcweir     mnMode      = nMode;
190cdf0e10cSrcweir     mnCode      = nButtons | nModifier;
191cdf0e10cSrcweir }
192cdf0e10cSrcweir 
193cdf0e10cSrcweir // -------------
194cdf0e10cSrcweir // - HelpEvent -
195cdf0e10cSrcweir // -------------
196cdf0e10cSrcweir 
197cdf0e10cSrcweir #define HELPMODE_CONTEXT        ((sal_uInt16)0x0001)
198cdf0e10cSrcweir #define HELPMODE_EXTENDED       ((sal_uInt16)0x0002)
199cdf0e10cSrcweir #define HELPMODE_BALLOON        ((sal_uInt16)0x0004)
200cdf0e10cSrcweir #define HELPMODE_QUICK          ((sal_uInt16)0x0008)
201cdf0e10cSrcweir 
202cdf0e10cSrcweir class VCL_DLLPUBLIC HelpEvent
203cdf0e10cSrcweir {
204cdf0e10cSrcweir private:
205cdf0e10cSrcweir     Point           maPos;
206cdf0e10cSrcweir     sal_uInt16          mnMode;
207cdf0e10cSrcweir     sal_Bool            mbKeyboardActivated;
208cdf0e10cSrcweir 
209cdf0e10cSrcweir public:
210*e1beba7dSHerbert Dürr     explicit        HelpEvent();
211*e1beba7dSHerbert Dürr     explicit        HelpEvent( sal_uInt16 nHelpMode );
212*e1beba7dSHerbert Dürr     explicit        HelpEvent( const Point& rMousePos, sal_uInt16 nHelpMode );
213cdf0e10cSrcweir 
214cdf0e10cSrcweir     const Point&    GetMousePosPixel() const;
GetMode() const215cdf0e10cSrcweir     sal_uInt16          GetMode() const { return mnMode; }
KeyboardActivated() const216cdf0e10cSrcweir     sal_Bool            KeyboardActivated() const { return mbKeyboardActivated; }
SetKeyboardActivated(sal_Bool bKeyboard)217cdf0e10cSrcweir 	void			SetKeyboardActivated( sal_Bool bKeyboard ) { mbKeyboardActivated = bKeyboard; }
218cdf0e10cSrcweir };
219cdf0e10cSrcweir 
HelpEvent()220cdf0e10cSrcweir inline HelpEvent::HelpEvent()
221cdf0e10cSrcweir {
222cdf0e10cSrcweir     mnMode  = HELPMODE_CONTEXT;
223cdf0e10cSrcweir     mbKeyboardActivated = sal_True;
224cdf0e10cSrcweir }
225cdf0e10cSrcweir 
HelpEvent(const Point & rMousePos,sal_uInt16 nHelpMode)226cdf0e10cSrcweir inline HelpEvent::HelpEvent( const Point& rMousePos, sal_uInt16 nHelpMode ) :
227cdf0e10cSrcweir             maPos( rMousePos )
228cdf0e10cSrcweir {
229cdf0e10cSrcweir     mnMode  = nHelpMode;
230cdf0e10cSrcweir     mbKeyboardActivated = sal_False;
231cdf0e10cSrcweir }
232cdf0e10cSrcweir 
HelpEvent(sal_uInt16 nHelpMode)233cdf0e10cSrcweir inline HelpEvent::HelpEvent( sal_uInt16 nHelpMode )
234cdf0e10cSrcweir {
235cdf0e10cSrcweir     mnMode  = nHelpMode;
236cdf0e10cSrcweir     mbKeyboardActivated = sal_True;
237cdf0e10cSrcweir }
238cdf0e10cSrcweir 
239cdf0e10cSrcweir // -----------------
240cdf0e10cSrcweir // - UserDrawEvent -
241cdf0e10cSrcweir // -----------------
242cdf0e10cSrcweir 
243cdf0e10cSrcweir class VCL_DLLPUBLIC UserDrawEvent
244cdf0e10cSrcweir {
245cdf0e10cSrcweir private:
246cdf0e10cSrcweir     OutputDevice*       mpOutDev;
247cdf0e10cSrcweir     Rectangle           maOutRect;
248cdf0e10cSrcweir     sal_uInt16              mnItemId;
249cdf0e10cSrcweir     sal_uInt16              mnStyle;
250cdf0e10cSrcweir 
251cdf0e10cSrcweir public:
252cdf0e10cSrcweir                         UserDrawEvent();
253cdf0e10cSrcweir                         UserDrawEvent( OutputDevice* pOut,
254cdf0e10cSrcweir                                        const Rectangle& rOutRect,
255cdf0e10cSrcweir                                        sal_uInt16 nId, sal_uInt16 nStyle = 0 );
256cdf0e10cSrcweir 
GetDevice() const257cdf0e10cSrcweir     OutputDevice*       GetDevice() const { return mpOutDev; }
GetRect() const258cdf0e10cSrcweir     const Rectangle&    GetRect() const { return maOutRect; }
GetItemId() const259cdf0e10cSrcweir     sal_uInt16              GetItemId() const { return mnItemId; }
GetStyle() const260cdf0e10cSrcweir     sal_uInt16              GetStyle() const { return mnStyle; }
261cdf0e10cSrcweir };
262cdf0e10cSrcweir 
UserDrawEvent()263cdf0e10cSrcweir inline UserDrawEvent::UserDrawEvent()
264cdf0e10cSrcweir {
265cdf0e10cSrcweir     mpOutDev    = NULL;
266cdf0e10cSrcweir     mnItemId    = 0;
267cdf0e10cSrcweir     mnStyle     = 0;
268cdf0e10cSrcweir }
269cdf0e10cSrcweir 
UserDrawEvent(OutputDevice * pOut,const Rectangle & rOutRect,sal_uInt16 nId,sal_uInt16 nStyle)270cdf0e10cSrcweir inline UserDrawEvent::UserDrawEvent( OutputDevice* pOut,
271cdf0e10cSrcweir                                      const Rectangle& rOutRect,
272cdf0e10cSrcweir                                      sal_uInt16 nId, sal_uInt16 nStyle ) :
273cdf0e10cSrcweir             maOutRect( rOutRect )
274cdf0e10cSrcweir {
275cdf0e10cSrcweir     mpOutDev    = pOut;
276cdf0e10cSrcweir     mnItemId    = nId;
277cdf0e10cSrcweir     mnStyle     = nStyle;
278cdf0e10cSrcweir }
279cdf0e10cSrcweir 
280cdf0e10cSrcweir // ------------------
281cdf0e10cSrcweir // - Tracking-Types -
282cdf0e10cSrcweir // ------------------
283cdf0e10cSrcweir 
284cdf0e10cSrcweir #define ENDTRACK_CANCEL         ((sal_uInt16)0x0001)
285cdf0e10cSrcweir #define ENDTRACK_KEY            ((sal_uInt16)0x0002)
286cdf0e10cSrcweir #define ENDTRACK_FOCUS          ((sal_uInt16)0x0004)
287cdf0e10cSrcweir #define ENDTRACK_END            ((sal_uInt16)0x1000)
288cdf0e10cSrcweir #define ENDTRACK_DONTCALLHDL    ((sal_uInt16)0x8000)
289cdf0e10cSrcweir 
290cdf0e10cSrcweir #define TRACKING_REPEAT         ((sal_uInt16)0x0100)
291cdf0e10cSrcweir 
292cdf0e10cSrcweir // -----------------
293cdf0e10cSrcweir // - TrackingEvent -
294cdf0e10cSrcweir // -----------------
295cdf0e10cSrcweir 
296cdf0e10cSrcweir class VCL_DLLPUBLIC TrackingEvent
297cdf0e10cSrcweir {
298cdf0e10cSrcweir private:
299cdf0e10cSrcweir     MouseEvent          maMEvt;
300cdf0e10cSrcweir     sal_uInt16              mnFlags;
301cdf0e10cSrcweir 
302cdf0e10cSrcweir public:
303*e1beba7dSHerbert Dürr     explicit            TrackingEvent();
304*e1beba7dSHerbert Dürr     explicit            TrackingEvent( const MouseEvent&,
305cdf0e10cSrcweir                                        sal_uInt16 nTrackFlags = 0 );
306cdf0e10cSrcweir 
GetMouseEvent() const307cdf0e10cSrcweir     const MouseEvent&   GetMouseEvent() const { return maMEvt; }
308cdf0e10cSrcweir 
IsTrackingRepeat() const309cdf0e10cSrcweir     sal_Bool                IsTrackingRepeat() const
310cdf0e10cSrcweir                             { return ((mnFlags & TRACKING_REPEAT) != 0); }
311cdf0e10cSrcweir 
IsTrackingEnded() const312cdf0e10cSrcweir     sal_Bool                IsTrackingEnded() const
313cdf0e10cSrcweir                             { return ((mnFlags & ENDTRACK_END) != 0); }
IsTrackingCanceled() const314cdf0e10cSrcweir     sal_Bool                IsTrackingCanceled() const
315cdf0e10cSrcweir                             { return ((mnFlags & ENDTRACK_CANCEL) != 0); }
GetTrackingFlags() const316cdf0e10cSrcweir     sal_uInt16              GetTrackingFlags() const { return mnFlags; }
317cdf0e10cSrcweir };
318cdf0e10cSrcweir 
TrackingEvent()319cdf0e10cSrcweir inline TrackingEvent::TrackingEvent()
320cdf0e10cSrcweir {
321cdf0e10cSrcweir     mnFlags = 0;
322cdf0e10cSrcweir }
323cdf0e10cSrcweir 
TrackingEvent(const MouseEvent & rMEvt,sal_uInt16 nTrackFlags)324cdf0e10cSrcweir inline TrackingEvent::TrackingEvent( const MouseEvent& rMEvt,
325cdf0e10cSrcweir                                      sal_uInt16 nTrackFlags ) :
326cdf0e10cSrcweir             maMEvt( rMEvt )
327cdf0e10cSrcweir {
328cdf0e10cSrcweir     mnFlags = nTrackFlags;
329cdf0e10cSrcweir }
330cdf0e10cSrcweir 
331cdf0e10cSrcweir // ---------------
332cdf0e10cSrcweir // - NotifyEvent -
333cdf0e10cSrcweir // ---------------
334cdf0e10cSrcweir 
335cdf0e10cSrcweir #define EVENT_MOUSEBUTTONDOWN   1
336cdf0e10cSrcweir #define EVENT_MOUSEBUTTONUP     2
337cdf0e10cSrcweir #define EVENT_MOUSEMOVE         3
338cdf0e10cSrcweir #define EVENT_KEYINPUT          4
339cdf0e10cSrcweir #define EVENT_KEYUP             5
340cdf0e10cSrcweir #define EVENT_GETFOCUS          6
341cdf0e10cSrcweir #define EVENT_LOSEFOCUS         7
342cdf0e10cSrcweir #define EVENT_COMMAND           8
343cdf0e10cSrcweir #define EVENT_DESTROY           9
344cdf0e10cSrcweir #define EVENT_INPUTENABLE       10
345cdf0e10cSrcweir #define EVENT_INPUTDISABLE      11
346cdf0e10cSrcweir #define EVENT_EXECUTEDIALOG     100
347cdf0e10cSrcweir #define EVENT_ENDEXECUTEDIALOG  101
348cdf0e10cSrcweir #define EVENT_USER              10000
349cdf0e10cSrcweir 
350cdf0e10cSrcweir class VCL_DLLPUBLIC NotifyEvent
351cdf0e10cSrcweir {
352cdf0e10cSrcweir private:
353cdf0e10cSrcweir     Window*                 mpWindow;
354cdf0e10cSrcweir     void*                   mpData;
355cdf0e10cSrcweir     sal_uInt16                  mnType;
356cdf0e10cSrcweir     long                    mnRetValue;
357cdf0e10cSrcweir 
358cdf0e10cSrcweir public:
359cdf0e10cSrcweir                             NotifyEvent();
360cdf0e10cSrcweir                             NotifyEvent( sal_uInt16 nType,
361cdf0e10cSrcweir                                          Window* pWindow,
362cdf0e10cSrcweir                                          const void* pEvent = NULL,
363cdf0e10cSrcweir                                          long nRet = 0 );
364cdf0e10cSrcweir 
GetType() const365cdf0e10cSrcweir     sal_uInt16                  GetType() const { return mnType; }
GetWindow() const366cdf0e10cSrcweir     Window*                 GetWindow() const { return mpWindow; }
GetData() const367cdf0e10cSrcweir     void*                   GetData() const { return mpData; }
368cdf0e10cSrcweir 
SetReturnValue(long nRet)369cdf0e10cSrcweir     void                    SetReturnValue( long nRet ) { mnRetValue = nRet; }
GetReturnValue() const370cdf0e10cSrcweir     long                    GetReturnValue() const { return mnRetValue; }
371cdf0e10cSrcweir 
372cdf0e10cSrcweir     const KeyEvent*         GetKeyEvent() const;
373cdf0e10cSrcweir     const MouseEvent*       GetMouseEvent() const;
374cdf0e10cSrcweir     const CommandEvent*     GetCommandEvent() const;
375cdf0e10cSrcweir };
376cdf0e10cSrcweir 
NotifyEvent()377cdf0e10cSrcweir inline NotifyEvent::NotifyEvent()
378cdf0e10cSrcweir {
379cdf0e10cSrcweir     mpWindow    = NULL;
380cdf0e10cSrcweir     mpData      = NULL;
381cdf0e10cSrcweir     mnType      = 0;
382cdf0e10cSrcweir     mnRetValue  = 0;
383cdf0e10cSrcweir }
384cdf0e10cSrcweir 
NotifyEvent(sal_uInt16 nType,Window * pWindow,const void * pEvent,long nRet)385cdf0e10cSrcweir inline NotifyEvent::NotifyEvent( sal_uInt16 nType, Window* pWindow,
386cdf0e10cSrcweir                                  const void* pEvent, long nRet )
387cdf0e10cSrcweir {
388cdf0e10cSrcweir     mpWindow    = pWindow;
389cdf0e10cSrcweir     mpData      = (void*)pEvent;
390cdf0e10cSrcweir     mnType      = nType;
391cdf0e10cSrcweir     mnRetValue  = nRet;
392cdf0e10cSrcweir }
393cdf0e10cSrcweir 
GetKeyEvent() const394cdf0e10cSrcweir inline const KeyEvent* NotifyEvent::GetKeyEvent() const
395cdf0e10cSrcweir {
396cdf0e10cSrcweir     if ( (mnType == EVENT_KEYINPUT) || (mnType == EVENT_KEYUP) )
397cdf0e10cSrcweir         return (const KeyEvent*)mpData;
398cdf0e10cSrcweir     else
399cdf0e10cSrcweir         return NULL;
400cdf0e10cSrcweir }
401cdf0e10cSrcweir 
GetMouseEvent() const402cdf0e10cSrcweir inline const MouseEvent* NotifyEvent::GetMouseEvent() const
403cdf0e10cSrcweir {
404cdf0e10cSrcweir     if ( (mnType >= EVENT_MOUSEBUTTONDOWN) && (mnType <= EVENT_MOUSEMOVE) )
405cdf0e10cSrcweir         return (const MouseEvent*)mpData;
406cdf0e10cSrcweir     else
407cdf0e10cSrcweir         return NULL;
408cdf0e10cSrcweir }
409cdf0e10cSrcweir 
GetCommandEvent() const410cdf0e10cSrcweir inline const CommandEvent* NotifyEvent::GetCommandEvent() const
411cdf0e10cSrcweir {
412cdf0e10cSrcweir     if ( mnType == EVENT_COMMAND )
413cdf0e10cSrcweir         return (const CommandEvent*)mpData;
414cdf0e10cSrcweir     else
415cdf0e10cSrcweir         return NULL;
416cdf0e10cSrcweir }
417cdf0e10cSrcweir 
418cdf0e10cSrcweir // --------------------
419cdf0e10cSrcweir // - DataChangedEvent -
420cdf0e10cSrcweir // --------------------
421cdf0e10cSrcweir 
422cdf0e10cSrcweir #define DATACHANGED_SETTINGS            ((sal_uInt16)1)
423cdf0e10cSrcweir #define DATACHANGED_DISPLAY             ((sal_uInt16)2)
424cdf0e10cSrcweir #define DATACHANGED_DATETIME            ((sal_uInt16)3)
425cdf0e10cSrcweir #define DATACHANGED_FONTS               ((sal_uInt16)4)
426cdf0e10cSrcweir #define DATACHANGED_PRINTER             ((sal_uInt16)5)
427cdf0e10cSrcweir #define DATACHANGED_FONTSUBSTITUTION    ((sal_uInt16)6)
428cdf0e10cSrcweir #define DATACHANGED_USER                ((sal_uInt16)10000)
429cdf0e10cSrcweir 
430cdf0e10cSrcweir class VCL_DLLPUBLIC DataChangedEvent
431cdf0e10cSrcweir {
432cdf0e10cSrcweir private:
433cdf0e10cSrcweir     void*                   mpData;
434cdf0e10cSrcweir     sal_uLong                   mnFlags;
435cdf0e10cSrcweir     sal_uInt16                  mnType;
436cdf0e10cSrcweir 
437cdf0e10cSrcweir public:
438*e1beba7dSHerbert Dürr     explicit                DataChangedEvent();
439*e1beba7dSHerbert Dürr     explicit                DataChangedEvent( sal_uInt16 nType,
440cdf0e10cSrcweir                                               const void* pData = NULL,
441cdf0e10cSrcweir                                               sal_uLong nFlags = 0 );
442cdf0e10cSrcweir 
GetType() const443cdf0e10cSrcweir     sal_uInt16                  GetType() const { return mnType; }
GetData() const444cdf0e10cSrcweir     void*                   GetData() const { return mpData; }
GetFlags() const445cdf0e10cSrcweir     sal_uLong                   GetFlags() const { return mnFlags; }
446cdf0e10cSrcweir 
447cdf0e10cSrcweir     const AllSettings*      GetOldSettings() const;
448cdf0e10cSrcweir };
449cdf0e10cSrcweir 
DataChangedEvent()450cdf0e10cSrcweir inline DataChangedEvent::DataChangedEvent()
451cdf0e10cSrcweir {
452cdf0e10cSrcweir     mpData  = NULL;
453cdf0e10cSrcweir     mnFlags = 0;
454cdf0e10cSrcweir     mnType  = 0;
455cdf0e10cSrcweir }
456cdf0e10cSrcweir 
DataChangedEvent(sal_uInt16 nType,const void * pData,sal_uLong nChangeFlags)457cdf0e10cSrcweir inline DataChangedEvent::DataChangedEvent( sal_uInt16 nType,
458cdf0e10cSrcweir                                            const void* pData,
459cdf0e10cSrcweir                                            sal_uLong nChangeFlags )
460cdf0e10cSrcweir {
461cdf0e10cSrcweir     mpData  = (void*)pData;
462cdf0e10cSrcweir     mnFlags = nChangeFlags;
463cdf0e10cSrcweir     mnType  = nType;
464cdf0e10cSrcweir }
465cdf0e10cSrcweir 
GetOldSettings() const466cdf0e10cSrcweir inline const AllSettings* DataChangedEvent::GetOldSettings() const
467cdf0e10cSrcweir {
468cdf0e10cSrcweir     if ( mnType == DATACHANGED_SETTINGS )
469cdf0e10cSrcweir         return (const AllSettings*)mpData;
470cdf0e10cSrcweir     else
471cdf0e10cSrcweir         return NULL;
472cdf0e10cSrcweir }
473cdf0e10cSrcweir 
474cdf0e10cSrcweir #endif // _SV_EVENT_HXX
475cdf0e10cSrcweir 
476