InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
PaletteRef.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 // This file contains the type used to represent various Palette entities in the OWL Palette world
24 //
25 //========================================================================================
26 
27 #ifndef __PaletteRef__
28 #define __PaletteRef__
29 
30 // Preprocessor macros/constants
31 #define FIXME_OWL(comment) {ASSERT_FAIL(FORMAT_ARGS("FIXME_OWL: %s\n", comment));}
32 
33 //Types
34 #if MACINTOSH
35  #if ID_COCOA_ENABLE
36  #include <Cocoa/Cocoa.h>
37  typedef NSObject* OWLControlRef;
38  typedef NSView* OWLLeafControlRef;
39  typedef NSView* OSViewRef;
40  #else
41  typedef HIViewRef OWLControlRef;
42  typedef HIViewRef OWLLeafControlRef;
43  typedef HIViewRef OSViewRef;
44 #endif
45 #elif WINDOWS
46  typedef HWND OWLControlRef;
47  typedef HWND OWLLeafControlRef;
48  typedef HWND OSViewRef;
49 #endif
50 
51 class IXMLGenerator;
52 class IPaletteFactory;
53 class IControlView;
54 
126 enum PaletteRefType
127 {
128  kUnknownPaletteType,
129 
131  kRootPaletteNode = 1,
132 
134  kTabGroupClusterType_OBSOLETE, //keep so we don't disrupt the id values
135 
137  kDockType,
138 
140  kToolbarType,
141 
143  kControlBarType,
144 
146  kTabPaneType,
147 
149  kTabGroupType,
150 
152  kTabPanelContainerType,
153 
155  kControlBarPaneType,
156 
157  // New types for OWL2
158 
160  kApplicationContainerType,
161 
163  kDocumentPresentationType
164 
165 };
166 
172 {
173  public:
174  typedef base_type data_type;
175 
176  PaletteRef(PaletteRefType type, OWLControlRef ref) : fRef(ref), fType(type) {}
177  PaletteRef(PaletteRefType type) : fRef(NULL), fType(type) {}
178  PaletteRef() : fRef(NULL), fType(kUnknownPaletteType) {}
179 
181  bool16 IsValid() const {return fRef != NULL && fType != kUnknownPaletteType;}
182 
184  PaletteRefType GetPaletteRefType() const {return fType;}
185 
187  OWLControlRef GetOWLControl() const {return fRef;}
188  OWLLeafControlRef GetOWLLeafControl() const {return (OWLLeafControlRef) fRef;}
189 
191  bool16 operator==(const PaletteRef& other) const { return fType == other.fType && fRef == other.fRef; }
192  bool16 operator!=(const PaletteRef& other) const { return fType != other.fType || fRef != other.fRef; }
193 
194  private:
195  PaletteRefType fType;
196  OWLControlRef fRef;
197 };
198 
199 #endif // __PaletteRef__