InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ICursorMgr.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Dave Burnard
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 __ICURSORMGR__
25 #define __ICURSORMGR__
26 
27 #include "IPMUnknown.h"
28 #include "ShuksanID.h"
29 #include "CursorSpec.h"
30 #include "ISnapTo.h"
31 
32 
33 class ICursorProvider;
34 class ModalCursorTicket;
35 
36 
37 // ===================================================================================
38 // class ICursorMgr
39 // ===================================================================================
49 class ICursorMgr : public IPMUnknown
50 {
51  public:
52  enum { kDefaultIID = IID_ICURSORMGR };
53 
60  public:
62  {
64  kNoModifiers = 0x00,
66  kCmdKey = 0x01,
68  kShiftKey = 0x02,
70  kCapsLockKey = 0x04,
72  kOptionAltKey = 0x08, kAltKey = kOptionAltKey, kOptionKey = kOptionAltKey,
74  kControlKey = 0x10,
76  kSpaceKey = 0x20
77  };
78 
79  public:
82  virtual CursorID GetCursorID() = 0;
83 
86  virtual CursorSpec GetCursorSpec() = 0;
87 
93 
97  virtual void LockToolCursor(bool16 lockit = kTrue) = 0;
98 
108  virtual CursorSpec GetSnapToCursorSpec(CursorSpec& currentSpec, SnapType snapType) = 0;
109 
111  enum {
122  };
124  enum {
131  };
132 
139  virtual void BeginModalCursor(const ModalCursorTicket& callerID) = 0;
141  virtual void BeginModalCursor(const ModalCursorTicket& callerID, const CursorSpec& newspec) = 0;
143  virtual void ChangeModalCursor(const ModalCursorTicket& callerID, const CursorSpec& newspec) = 0;
145  virtual void EndModalCursor(const ModalCursorTicket& callerID) = 0;
147  virtual void BeginWaitCursor(const ModalCursorTicket& callerID) = 0;
149  virtual void AnimateWaitCursor(const ModalCursorTicket& callerID) = 0;
151  virtual void EndWaitCursor(const ModalCursorTicket& callerID) = 0;
153 
158 
162  virtual void SetNewCursor() = 0;
163 
170  virtual ICursorProvider* TheToolCursorProvider() const = 0;
171 
173  virtual void Hide() = 0;
175  virtual void Show() = 0;
177  virtual bool16 IsHidden() const = 0;
178 
180  virtual void Suspend() = 0;
182  virtual bool16 IsSuspended() const= 0;
184  virtual void Resume() = 0;
185 
188  virtual void StopTrackingCursor() =0;
189 
190 
192  virtual void Init() = 0;
194  virtual void Shutdown() = 0;
196  virtual void ClearCache() = 0;
197 
198  public:
199  enum {kSpinningBeachBall = 200, kSpinningWatch = 210, kCyclingArrow = 220};
200 
204  virtual void ObscureCursor() = 0;
205 
208  virtual void UnobscureCursor() = 0;
209 
212  virtual void AnimateWaitCursor() = 0;
213 
214 
215 #if MACINTOSH
216 
221  virtual void SetBusyCursorTimeout(int32 timeout) = 0;
222 
223 
228  virtual void SetBusyCursorDelay(int32 delay) = 0;
229 
230 
234  virtual void SetBusyCursorID(ResID id) = 0;
235 
236 #endif
237 
238  protected:
241  virtual bool16 ModifiersAffectProvider(IControlView *view) const = 0;
242 
245  virtual bool16 LocationAffectsProvider(IControlView *view) const = 0;
246 
252  virtual bool16 HaveModifiersChanged(eCursorModifierState& oldModifiers, eCursorModifierState& newModifiers) = 0;
253 };
254 
255 
256 // ===================================================================================
257 // class ModalCursorTicket
258 // ===================================================================================
262  public:
263  typedef base_type data_type;
264  ModalCursorTicket(uint32 caller = 0xFFFFFFFF, int16 restore = ICursorMgr::kRestorePreviousCursor, int16 modalType = ICursorMgr::kModalCursor) :
265  fModalType(modalType), fRestoreCursor(restore), fCallerID(caller) {}
266  ModalCursorTicket(const ModalCursorTicket& other) :
267  fModalType(other.fModalType), fRestoreCursor(other.fRestoreCursor), fCallerID(other.fCallerID)
268  {
269  }
270 
271  ModalCursorTicket& operator=(const ModalCursorTicket& other)
272  {
273  if (this != &other)
274  {
275  fModalType = other.fModalType;
276  fRestoreCursor = other.fRestoreCursor;
277  fCallerID = other.fCallerID;
278  }
279  return *this;
280  }
281 
282  bool operator==(const ModalCursorTicket& other) const
283  {
284  if ((char*) this == (char*) &other)
285  return kTrue;
286  else if ((fCallerID == other.fCallerID) && (fModalType == other.fModalType))
287  return kTrue;
288  else
289  return kFalse;
290  }
291 
292  int16 fModalType;
293  int16 fRestoreCursor;
294  uint32 fCallerID;
295 };
296 
297 #endif // __ICURSORMGR__