InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ITextCaret.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Michael Burbidge
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 __ITEXTCARET__
25 #define __ITEXTCARET__
26 
27 #include "IPMUnknown.h"
28 
29 #include "TextEditorID.h"
30 
31 //========================================================================================
32 // Forward declarations
33 //========================================================================================
34 
35 class PMLineSeg;
36 class RangeData;
37 class IControlView;
38 class IGraphicsContext;
39 
40 //========================================================================================
41 // CLASS ITextCaret
42 //========================================================================================
43 
47 class ITextCaret : public IPMUnknown
48 {
49 // ----- Blinking the caret
50 public:
51  enum { kDefaultIID = IID_ITEXTCARET };
52 
53 
58  virtual bool16 IsCaretStroked() const = 0; //looks easy
59 
60 // virtual bool16 IsCaretBlinking() const = 0; //likely easy
61 
64  enum{ kStopCaretBlinking = 0, kStartCaretBlinking};
65 
68  enum{ kEraseCaretNow = 0, kStrokeCaretNow};
69 // virtual void SetCaretBlinking( bool16 bOn, bool16 bVisible = kStrokeCaretNow ) = 0;
70  // To set a steady TextCaret call SetBlinking( kStopCaretBlinking, kStrokeCaretNow ).
71 
72 
77  virtual void DrawingRegion(IControlView* view, const SysRgn& invalidRgn) = 0;
78 
79 // ----- Activating
80 // virtual void ActivateCaret(bool16 active) = 0;
81  // Use to activate the caret when the view the caret is
82  // in becomes active.
83 // virtual bool16 IsCaretActive() const = 0;
84  //TextCaretSelectionObserver::Update and several incopy callers
85  //also TextCaretThread::RunTask (which is silly) and EditorToFrame::ActivateTextEditor
86 
87 
88 
89 // ----- Position
90 
97  virtual bool16 UpdateCaretPosition(IControlView *view = nil, const RangeData* newCaretPosition = nil) = 0;
98 
99 
105  virtual bool16 GetCaretBounds( PMLineSeg* pCaretBounds ) const = 0; //WritingObserver::DoAutoScroll, ChangesDialogMenuAction::DoAutoScroll --reconcile these
106 
107 
111  virtual void ToggleCaret() = 0;
112 
117  virtual void DrawCaret(IGraphicsContext *gc, PMRect updateRect) = 0;
118 
119 public:
120  /* The state of text caret.
121  */
122  enum CaretState {
123  kCaretOff, kCaretErased = kCaretOff,
124  kCaretParked, kCaretStroked = kCaretParked,
125  kCaretOn, kCaretBlinking = kCaretOn
126  };
127 
128 
136  virtual void SetCaretState(CaretState, const RangeData* newCaretPosition = nil) = 0;
137 
142  virtual CaretState GetCaretState() = 0;
143 };
144 
145 #endif