InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IEvent.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: ?
6 //
7 // $Author$
8 //
9 // $DateTime$
10 //
11 // $Revision$
12 //
13 // $Change$
14 //
15 // Copyright 1997-2010 Adobe Systems Incorporated. All rights reserved.
16 //
17 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
18 // with the terms of the Adobe license agreement accompanying it. If you have received
19 // this file from a source other than Adobe, then your use, modification, or
20 // distribution of it requires the prior written permission of Adobe.
21 //
22 //========================================================================================
23 
24 #ifndef __IEVENT__
25 #define __IEVENT__
26 
27 #include "PMTypes.h"
28 #include "VirtualKey.h"
29 
30 class IEventHandler;
31 
34 class INTERFACE_DECL IEvent {
35 public:
36  virtual ~IEvent() {}
37 
41  virtual bool16 LButtonDn() const = 0;
42 
46  virtual bool16 OptionAltKeyDown() const = 0;
47 
51  virtual bool16 CmdKeyDown() const = 0;
52 
56  virtual bool16 ShiftKeyDown() const = 0;
57 
61  virtual bool16 ShiftLockKeyDown() const = 0;
62 
66  virtual bool16 MacCtrlDown() const = 0;
67 
71  virtual bool16 LeftAltDown() const = 0;
72 
76  virtual bool16 RightAltDown() const = 0;
77 
82  virtual bool16 LeftControlDown() const = 0;
83 
88  virtual bool16 RightControlDown() const = 0;
89 
93  virtual SysChar GetChar() const = 0;
94 
100  virtual void SetChar( SysChar theChar ) = 0;
101 
105  virtual VirtualKey GetVirtualKey() const = 0;
106 
113  virtual bool16 IsAltGrChar() const = 0;
114 
115 
118  virtual bool16 IsRepeatKey() const = 0;
119 
127  virtual GSysPoint GlobalWhere() const = 0;
128 
129  enum ScrollUnits { kLines, kPixels };
130 
140  virtual PMPoint GetMouseScrollDelta(ScrollUnits units = kLines) const = 0;
141 
146  virtual PMReal GetTime() const = 0;
147 
148 
175  enum BaseEventHandledState { kShouldCall, kDontCall, kHasCalled };
176  typedef BaseEventHandledState UI_DoEventHandledState;
177 
182 
186  virtual UI_DoEventHandledState GetUI_DoEventHandledState() const {return kDontCall;}
187 
188  // Note: These API are needed in CC and beyond - and should be removed. For now they are no-ops.
189 #ifdef ID_DEPRECATED
190  typedef BaseEventHandledState SystemHandledState;
191 
197  virtual void SetSystemHandledState(SystemHandledState state) = 0;
198 
203  virtual SystemHandledState GetSystemHandledState() const = 0;
204 #endif // ID_DEPRECATED
205 
211  typedef enum IEventType {
213  kFirstEventType = 1,
214 
215  // The following event types are available to event watchers and to event handlers pushed on to the event dispatcher, and are also delivered to widget event handlers,
216 
218  kMouseMove = kFirstEventType,
259 
260 
261  // The following event types are ONLY available to event watchers and to event handlers pushed on to the event dispatcher
262  // Note: These events may be removed later in the CC dev cycle, so it is preferable to rely on alternative mechanisms
263  // see: IApplicationActiveState, kApplicationSuspend/ResumeMsg notifications, and the WindowActivationChanged method of IControlView
264 
273 
274 
275  // The following event types are ONLY available to event watchers
276  // Note: This events may be removed later in the CC dev cycle, so it is preferable to rely on alternative mechanisms
277  // see: idle tasks or timers.
278 
281 
282 
283  // Unrecognized event
284 
287 
288 #if 0 // OBSOLETE EVENT TYPES, these are not sent in CC and beyond
289  kApple,
290  kUpdate,
291  kCarbonModifierChangedEvent,
292  kCommandProcess,
293  kPlatformEvent,
294 #endif // OBSOLETE
295 
300  kEndOfEventTypes
301  } EventType;
302 
306  virtual EventType GetType() const = 0;
307 
311  virtual void SetType(const EventType theType) = 0;
312 
314  enum GestureType {
315  kGestureNone = 0,
316  kGestureBegin,
317  kGestureEnd,
318  kGestureRotation,
319  kGestureMagnify,
320  kGestureSwipe,
321  kGesturePan,
322  kEndOfGestureTypes
323  };
324 
328  virtual GestureType GetGestureType() const {return IEvent::kGestureNone;}
329 
331  virtual float GetRotationInDegrees() const {return 0.0f;}
332  virtual float GetMagnificationAmount() const {return 0.0f;}
333 
334  enum SwipeDirection {
335  kSwipeDirectionNone = 0,
336  kSwipeDirectionLeft,
337  kSwipeDirectionRight,
338  kSwipeDirectionUp,
339  kSwipeDirectionDown
340  };
341  virtual SwipeDirection GetSwipeDirection() const {return IEvent::kSwipeDirectionNone;}
342 
345  kTabletActionNone = 0,
346  kTabletActionProximity, // pen entered/exited the tablet's sensitivity range
347  kTabletActionPen, // pen param changed: pressure, tilt, tip, etc. -- not just position
348  kEndOfTabletActions
349  };
350 
354  virtual TabletAction GetTabletAction() const {return IEvent::kTabletActionNone;}
355 
356  // Note: no support yet for tablet event details (have to look at underlying platform event)
357 
358 };
359 
360 #endif // __IEVENT__