home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / OS / FWGraphx / Include / FWGrUtil.h < prev    next >
Encoding:
Text File  |  1995-11-08  |  5.1 KB  |  162 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWGrUtil.h
  4. //    Release Version:    $ 1.0d11 $
  5. //
  6. //    Copyright:    © 1993, 1995 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWGRUTIL_H
  11. #define FWGRUTIL_H
  12.  
  13. #ifndef FWRECT_H
  14. #include "FWRect.h"
  15. #endif
  16.  
  17. // ----- Foundation Layer -----
  18.  
  19. #ifndef FWCOMMON_H
  20. #include "FWCommon.h"
  21. #endif
  22.  
  23. #ifdef FWEXCLIB_H
  24. #include "FWExcLib.h"
  25. #endif
  26.  
  27. // ----- OpenDoc Includes -----
  28.  
  29. #ifndef _ODTYPES_
  30. #include <ODTypes.h>
  31. #endif
  32.  
  33. #ifndef SOM_ODShape_xh
  34. #include <Shape.xh>
  35. #endif
  36.  
  37. // ----- Macintosh Includes -----
  38.  
  39. #if defined(FW_BUILD_MAC) && !defined(__WINDOWS__)
  40. #include <Windows.h>
  41. #endif
  42.  
  43. #if defined(FW_BUILD_MAC) && !defined(__TEXTEDIT__)
  44. #include <TextEdit.h>
  45. #endif
  46.  
  47. #if FW_LIB_EXPORT_PRAGMAS
  48. #pragma lib_export on
  49. #endif
  50.  
  51. //========================================================================================
  52. //    Forward Declarations
  53. //========================================================================================
  54.  
  55. class FW_CLASS_ATTR ODShape;
  56. class FW_CLASS_ATTR ODTransform;
  57. class FW_CLASS_ATTR FW_CPoint;
  58. class FW_CLASS_ATTR FW_CRect;
  59.  
  60. //========================================================================================
  61. //    Global Utilities
  62. //========================================================================================
  63.  
  64. // ----- ODShape utilities -----
  65. //########################################################################################
  66. // SCpp Hack
  67. // Work around SCpp 8.0.3 bug - importing overloaded functions doesn't work.
  68. // Replace overloaded functions with normal functions with different names.
  69. // Use inline overloaded functions which turn around and call the renamed
  70. // functions so client code isn't affected.
  71. //########################################################################################
  72.  
  73. FW_FUNC_ATTR void            FW_OutlineODShape(Environment *ev, ODShape* odShapeToOutline, FW_CFixed outlineSize);
  74.  
  75. FW_FUNC_ATTR ODShape*        FW_CreateLineODShape(Environment *ev, 
  76.                                         const FW_CPoint& firstPoint, 
  77.                                         const FW_CPoint& lastPoint,
  78.                                         FW_CFixed penSize);
  79. FW_FUNC_ATTR ODShape*         FW_CreateOvalODShape(Environment *ev, const FW_CRect& rect);
  80. FW_FUNC_ATTR ODShape*         FW_CreateRoundRectODShape(Environment *ev, const FW_CRect& rect, const FW_CPoint& ovalSize);
  81. FW_FUNC_ATTR ODShape*         FW_CreateArcODShape(Environment *ev, const FW_CRect& rect, short startAngle, short arcAngle);
  82.  
  83. // ----- Hit testing utilities -----
  84. FW_FUNC_ATTR FW_Boolean        FW_PtInOval(const FW_CRect& ovalRect, const FW_CPoint& test);
  85. FW_FUNC_ATTR FW_Boolean        FW_PtInRoundRect(const FW_CRect& rect, const FW_CPoint& ovalSize, const FW_CPoint& test);
  86. FW_FUNC_ATTR FW_Boolean        FW_HitTestLine(const FW_CPoint& pt1, const FW_CPoint& pt2, const FW_CPoint& test, FW_CFixed tolerance);
  87.  
  88. // ----- Private utilities -----
  89. void FW_PrivCalcArcPoints(const FW_SPlatformRect& rect, 
  90.                           short angle,
  91.                           FW_SPlatformPoint& arcPoint);
  92.  
  93. // ----- Debugging tools -----
  94. FW_FUNC_ATTR void    FW_LogPoint(Environment* ev, const char* prompt, const FW_CPoint& point);
  95. FW_FUNC_ATTR void    FW_LogRect(Environment* ev, const char* prompt, const FW_CRect& rect);
  96. FW_FUNC_ATTR void    FW_LogShape(Environment* ev, const char* prompt, ODShape* shape);
  97. FW_FUNC_ATTR void    FW_LogTransform(Environment* ev, const char* prompt, ODTransform* transform);
  98.  
  99. //========================================================================================
  100. //    Windows Utilities
  101. //========================================================================================
  102.  
  103. #ifdef FW_BUILD_WIN
  104. FW_FUNC_ATTR void         FW_WinPrivGetDisplayColorInfo(short& planeCount, short& bitsPixel);
  105. #endif
  106.  
  107. //========================================================================================
  108. //    Macintosh Utilities
  109. //========================================================================================
  110.  
  111. #ifdef FW_BUILD_MAC
  112. void         FW_MacPrivGetPortTextStyle(TextStyle& theTextStyle);
  113. void         FW_MacPrivSetPortTextStyle(const TextStyle& theTextStyle);
  114.  
  115. FW_Boolean    FW_MacIsColorPort(GrafPtr grafPort);
  116.  
  117. // We cannot use AltPoly.h because of a compile problem with OD exceptions (Except.h)
  118.  
  119. struct FW_ODContour
  120. {
  121.     long            fVertexCount;
  122.     FW_CPoint        fVertex[1];            // Actual count is fVertexCount
  123.  
  124.     FW_ODContour*    NextContour() const
  125.         { return (FW_ODContour*)&fVertex[fVertexCount]; }
  126. };
  127.  
  128. struct FW_ODPolygonData
  129. {
  130.     long            fContourCount;
  131.     FW_ODContour    fContours[1];        // Actual count varies
  132. };
  133.  
  134. //========================================================================================
  135. //    class FW_CMacTempPort
  136. //========================================================================================
  137.  
  138. class FW_CMacTempPort FW_AUTO_DESTRUCT_OBJECT
  139. {
  140. public:
  141.                 FW_CMacTempPort(GrafPtr tempPort = NULL);
  142.     virtual        ~FW_CMacTempPort();
  143.  
  144. private:
  145.     GrafPtr        fMacPort;
  146. };
  147.  
  148. //========================================================================================
  149. //    Debugging
  150. //========================================================================================
  151.  
  152. FW_FUNC_ATTR void FW_MacShowColorTable(CTabHandle cth);
  153.  
  154. #endif
  155.  
  156. #if FW_LIB_EXPORT_PRAGMAS
  157. #pragma lib_export off
  158. #endif
  159.  
  160. #endif
  161.  
  162.