InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ITextValue.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: lance bushore
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 __ITextValue__
25 #define __ITextValue__
26 
27 #include "IPMUnknown.h"
28 #include "widgetid.h"
29 
30 class ITextValue : public IPMUnknown
31 {
32 public:
33  enum { kDefaultIID = IID_ITEXTVALUE };
34 
35  typedef enum {
36  kNormal = 0, // normal state (usually reads 'value')
37  kUnknown, // unknown or mixed state (usually blank)
38  kCalculated, // calculated value state (usually reads '(value)')
39  kMixedCalculated // calculated, but mixed values (usually reads 'Auto')
40  } TextControlState;
41 
42  typedef enum {
43  kAbsolute = 0, // User typed in a number (or a formula)
44  kDelta, // User typed in addition/subtraction
45  kProportional // User typed in a percent or mult/div
46  } TextControlChange;
47 
48 
49  // gets the text from the control, converts it to an appropriate value, and returns it.
50  // i.e. for measurement editboxes, returns value in points, or for percentage editboxes,
51  // returns percentage as a real. Sets errorOut to true if error in conversion.
52  virtual PMReal GetTextAsValue(bool16 *errorOut = nil,bool16 *blankEntry = nil) = 0;
53 
54  // sets the text for the control,given an appropriate value
55  // i.e. for measurement editboxes, takes value in points and converts to current
56  // measurement system string like 4p5, or for percentage editboxes, converts 45.0 to 45 %
57  virtual void SetTextFromValue(const PMReal& valueIn, bool16 invalidate = kTrue, bool16 notifyOfChange = kTrue) = 0;
58 
59  // gets the text for the control, formats it nicely, and resets it.
60  // i.e. converts '10' to '10 %' or 'Auto' to '(14 pt)'
61  // this is generally called when the user changes the text, by typing and hitting return or
62  // selecting a new item from a popup.
63  virtual void ReformatText(bool16 invalidate = kTrue, bool16 notifyOfChange = kTrue) = 0;
64 
65  // call this if you are unable to display values for multiple
66  // selected items. Calling SetTextFromValue will clear it.
67  virtual void SetControlState(TextControlState newState, bool16 invalidate = kTrue, bool16 notifyOfChange = kTrue) = 0;
68  virtual TextControlState GetControlState() const = 0;
69  virtual TextControlChange GetLastControlChange(PMReal* value) const = 0;
70 };
71 
72 
73 
74 #endif // __ITextValue__