InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IGradientPanelHelper.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Thanh Nguyen
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 // Helper interface to access the gradient panels.
24 //
25 //========================================================================================
26 
27 #ifndef __IGradientPanelHelper__
28 #define __IGradientPanelHelper__
29 
30 #include "IRenderingObject.h"
31 #include "K2Vector.h"
32 
33 
37 {
38  public:
39  typedef enum
40  {
41  kMidPointThumb = 0,
42  kStopThumb
43  }thumbType;
44 
45 
46  //==================================================================
47  // Setting the gradient rendering setup which is used to draw the gradient
48  // in the gradient panel. This is included the gradient slider and
49  // the proxy...
50  //==================================================================
51  virtual void SetGradientRenderingSetup(IRenderingObject* renderingSetup) = 0;
52 
53  //==================================================================
54  // Set either a midpoint or a thumb stop selection.
55  // This could be used to turn off the selection
56  // of gradient thumbs. To deselect thumb, set
57  // index = -1
58  //==================================================================
59  virtual void SetSelectedThumbIndex(int16 index) = 0;
60 
61  //==================================================================
62  // Set the total number of thumbs in the gradient. The total number of
63  // thumbs are the sum number of thumb stops AND the midpoints
64  //==================================================================
65  virtual void SetTotalThumbNum(int16 thumbNum) = 0;
66 
67  //==================================================================
68  // Set the position for each of the thumbs. This is the list of thumb
69  // stops and midpoint, alternating. The position is ranging from 0...1
70  //==================================================================
71  virtual void SetThumbList(K2Vector<PMReal>thumbList) = 0;
72 
73  //==================================================================
74  // Set the position for the Nth thumb. The thumbPosition should
75  // be between 0...1
76  //==================================================================
77  virtual void SetNthThumbPosition(int16 index, PMReal thumbPosition) = 0;
78 
79  //==================================================================
80  // Setting the ratio of the midpoint relative to the two adjacent
81  // thumb stops.
82  //==================================================================
83  virtual void SetMidPointRatio(K2Vector<PMReal>ratioList) = 0;
84 
85  //==================================================================
86  // Setting the midpoint ratio for the nth midpoint. index is the
87  // index of the midpoint *NOT* the thumb list. For example, if there
88  // are total 5 thumbs (3 stops and 2 midpoints), index = 0 means the
89  // first midpoint and index == 1 is the index of the second midpoint.
90  //==================================================================
91  virtual void SetNthMidPointRatio(int16 index, PMReal ratio) = 0;
92 
93 
94 
95 
96  //==================================================================
97  // For pageItem rendering & graphic state interaction
98  // This is the rendering object of the gradient the is drawn
99  // in the gradient slider and the gradient proxy. This rendering
100  // set up should be gradientMetaDataRendering setup
101  // (ie. IID_IGRADIENTMETADATA, kGradientMetaDataImpl)
102  //==================================================================
103  virtual IRenderingObject* GetGradientRenderingObject() = 0;
104 
105  //==================================================================
106  // Find out the current selected thumb. return -1 if there
107  // is currently no selected thumb.
108  //==================================================================
109  virtual int16 GetSelectedThumbIndex() = 0;
110 
111  //==================================================================
112  // Get the total number of thumbs in the gradient slider. This is
113  // the total of the thumb stops and midpoints.
114  //==================================================================
115  virtual int16 GetTotalThumbNum() = 0;
116 
117  //==================================================================
118  // Get the list of thumb positions of the gradient slider.
119  // This list contains all the positions of both thumb stops
120  // and midpoints in the gradient slider. The position should
121  // be in the range 0...1. The midpoint position also from 0...1.
122  // However, if the midpoint is 0.5, it means that the midpoint is
123  // right at the midpoint of its two adjacent thumb stops
124  //==================================================================
125  virtual K2Vector<PMReal> GetThumbList() = 0;
126 
127  //==================================================================
128  // Get the position of the Nth thumb. The return position should
129  // be between 0...1
130  //==================================================================
131  virtual PMReal GetNthThumbPosition(int16 index) = 0;
132 
133  //==================================================================
134  // Getting the list of all the midpoint ratios.
135  //==================================================================
136  virtual void GetMidPointRatio(K2Vector<PMReal>* thumbList) = 0;
137 
138  //==================================================================
139  // Getting the midpoint ratio for the nth midpoint. index is the
140  // index of the midpoint *NOT* the thumb list. For example, if there
141  // are total 5 thumbs (3 stops and 2 midpoints), index = 0 means the
142  // first midpoint and index == 1 is the index of the second midpoint.
143  //==================================================================
144  virtual PMReal GetNthMidPointRatio(int16 index) = 0;
145 
146 
147  //=============================================================================
148  // ******* GRADIENT PANEL EVENT HELPER METHODS *******
149  //=============================================================================
150 
151  //=============================================================================
152  // Inserting a new thumb stop before the 'index' in the thumb list.
153  //=============================================================================
154  virtual void InsertThumb(int16 index, PMReal thumbPosition) = 0;
155 
156  //=============================================================================
157  // Relocate the Nth thumb to the new location.
158  // This also automatically:
159  // Readjust the midpoint (if a thumb stop is moved)
160  // Update the slider rendering data. (ie. re-arrange the color data list in
161  // the gradient rendering.
162  //=============================================================================
163  virtual void RelocateNthThumb(int16 thumbIndex, PMReal toPosition) = 0;
164 
165  //=============================================================================
166  // Removing the thumb stop at 'index'. This is also removing the
167  // associate midpoint and then readjust the affected midpoint according
168  // to its midpoint ratio between the two adjacent thumb stops
169  //=============================================================================
170  virtual void RemoveThumbStop(int16 index) = 0;
171 
172 };
173 
174 
175 
176 #endif // __IGradientPanelHelper__