InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
MSysType.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: ?
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 __MSYSTYPE__
25 #define __MSYSTYPE__
26 
27 #include "K2TypeTraits.h"
28 //======================================================================
29 // Isolate windowing system (Mac OS QuickDraw or Core Graphics) vs. Windows GDI)
30 //======================================================================
31 
32 // 32-bit integer coordinate space
33 struct Int32Rect { // Use in cases where coords must be integral (but not QD specific). Bitmap bounds, image internal (pixel) bounds, etc.
34  int32 top;
35  int32 left;
36  int32 bottom;
37  int32 right;
38 
39  Int32Rect() {top = 0; left = 0; bottom = 0; right = 0;}
40  Int32Rect(const Int32Rect &) = default;
41  Int32Rect& operator=(const Int32Rect& r) = default;
42 };
43 
44 // Default coordinate space - based on Core Graphics
45 typedef CGFloat SysCoord; // Floating point coordinate system (from Core graphics)
46 
47 struct SysPoint : CGPoint {
48  SysPoint(SysCoord h, SysCoord v ) {x = h; y = v;}
49  SysPoint(const CGPoint& pt) {x = pt.x; y = pt.y;}
50  SysPoint(const SysPoint& pt) {x = pt.x; y = pt.y;}
51  SysPoint() {x = 0; y = 0;}
52  SysPoint& operator=(const SysPoint& pt) {x = pt.x; y = pt.y; return *this;}
53  SysPoint& operator=(const CGPoint& pt) {x = pt.x; y = pt.y; return *this;}
54 };
55 
56 typedef SysPoint GSysPoint; // "Global" SysPoint
57 typedef SysPoint WSysPoint; // "Window" SysPoint
58 
59 struct SysSize : CGSize {
60  SysSize(SysCoord h, SysCoord w ) {width = h; height = w;}
61  SysSize(const CGPoint& pt) {width = pt.x; height = pt.y;}
62  SysSize(const CGSize& sz) {width = sz.width; height = sz.height;}
63  SysSize() {width = 0; height = 0;}
64  SysSize& operator=(const SysPoint& pt) {width = pt.x; height = pt.y; return *this;}
65  SysSize& operator=(const CGSize& sz) {width = sz.width; height = sz.height; return *this;}
66 };
67 
68 struct SysRect : CGRect {
69  SysRect(SysCoord left, SysCoord top, SysCoord right, SysCoord bottom ) {origin.x = left; origin.y = top; size.width = right - left; size.height = bottom - top;}
70  SysRect(const SysPoint& theOrigin, const SysSize& theSize ) {origin = theOrigin; size = theSize;}
71  SysRect(const Int32Rect& r) {origin.x = r.left; origin.y = r.top; size.width = r.right - r.left; size.height = r.bottom - r.top;}
72  SysRect(const CGRect& r) {origin = r.origin; size = r.size;}
73  SysRect(const SysRect& r) {origin = r.origin; size = r.size;}
74  SysRect() {origin.x =0; origin.y = 0; size.width = 0; size.height = 0;}
75  SysRect& operator=(const SysRect& r) {origin = r.origin; size = r.size; return *this;}
76  SysRect& operator=(const CGRect& r) {origin = r.origin; size = r.size; return *this;}
77 // bool16 operator==(const SysRect& r) const {return (origin.x == r.origin.x) && (origin.y == r.origin.y) && (size.width == r.size.width) && (size.height == r.size.height);}
78 // bool16 operator!=(const SysRect& r) const {return !(*this == r);}
79 
80  operator Int32Rect() const
81  {
82  Int32Rect foo;
83  CGRect temp = CGRectIntegral(*this);
84  foo.left = (int32) temp.origin.x; foo.top = (int32) temp.origin.y; foo.right = foo.left + (int32) temp.size.width; foo.bottom = foo.top +(int32) temp.size.height;
85  return foo;
86  }
87 };
88 
89 typedef SysRect GSysRect; // SysRect in "Global" screen or device coordinates
90 typedef SysRect WSysRect; // SysRect in "Window" coordinates
91 
92 typedef HIMutableShapeRef SysRgn;
93 typedef HIShapeRef ConstSysRgn; // Ref counted, const version.
94 
95 typedef SysRgn SysWireframe; // Implementation of wireframe feedback
96 DECLARE_BASE_TYPE(SysRgn);
97 
98 typedef SysCoord GSysCoord; // "Global" coordinate
99 typedef SysCoord WSysCoord; // "Window" coordinate
100 typedef uint16_t SysChar; // UTF16's just like Drover. This will hopefully fix some international languages keyboard shortcut problems.
101 typedef uint16 SysKeyCode; // code for key on keyboard
102 typedef WindowPtr SysWindow;
103 DECLARE_BASE_TYPE(SysWindow);
104 
105 typedef void* SysControl;
106 
107 typedef GrafPtr SysPort;
108 //DECLARE_BASE_TYPE(SysPort); // GrafPtr == WindowPtr
109 typedef CGContextRef SysPort_NEW;
110 DECLARE_BASE_TYPE(SysPort_NEW);
111 
112 typedef GWorldPtr SysBitmap; // This will become a CGContextRef
113 typedef CGContextRef SysBitmap_NEW;
114 
115 typedef int16 SysFileRef; // open file reference
116 typedef void* SysEvent;
117 typedef Handle SysHandle;
118 // Rather than remove calls to HLock and HUnlock we will simply define them as a no-op.
119 #define HLOCK
120 #define HUNLOCK
121 
122 
123 
124 typedef int16 MenuID;
125 typedef int32 PlatformError;
126 typedef uint32 UserError;
127 typedef int16 CursorID;
128 
129 typedef struct FInfo SysFileInfo;
130 
131 typedef ResType RsrcType;
132 typedef char *RsrcName;
133 typedef uint32 RsrcID;
134 
135 // Connection information for loading & unloading DLLs
136 typedef CFBundleRef SysConnection; //BundleRef is nil if plugin bundle/dylib is not loaded
137 DECLARE_BASE_TYPE(SysConnection);
138 
139 #ifndef PARAMS_SYSRECT
140  #define PARAMS_SYSRECT(sysRect) (int)sysRect.origin.x,(int)sysRect.origin.y,(int)sysRect.size.width,(int)sysRect.size.height
141 #endif
142 
143 #endif // __SYSTYPE__