home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / OS / FWGraphx / FWGrUtil.h < prev    next >
Encoding:
Text File  |  1996-09-17  |  3.7 KB  |  135 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWGrUtil.h
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 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 FWODTYPS_H
  30. #include "FWODTyps.h"
  31. #endif
  32.  
  33. #ifndef SOM_ODShape_xh
  34. #include <Shape.xh>
  35. #endif
  36.  
  37. // ----- OS layer ----
  38.  
  39. #ifndef SLGRUTIL_H
  40. #include "SLGrUtil.h"
  41. #endif
  42.  
  43. // ----- Macintosh Includes -----
  44.  
  45. #if defined(FW_BUILD_MAC) && !defined(__QUICKDRAW__)
  46. #include <Quickdraw.h>
  47. #endif
  48.  
  49. #if defined(FW_BUILD_MAC) && !defined(__WINDOWS__)
  50. #include <Windows.h>
  51. #endif
  52.  
  53. #if defined(FW_BUILD_MAC) && !defined(__TEXTEDIT__)
  54. #include <TextEdit.h>
  55. #endif
  56.  
  57. //========================================================================================
  58. //    Forward Declarations
  59. //========================================================================================
  60.  
  61. class ODShape;
  62. class ODTransform;
  63. class FW_CPoint;
  64. class FW_CRect;
  65.  
  66. //========================================================================================
  67. //    Global Utilities
  68. //========================================================================================
  69.  
  70. // ----- ODShape utilities -----
  71. //########################################################################################
  72. // SCpp Hack
  73. // Work around SCpp 8.0.3 bug - importing overloaded functions doesn't work.
  74. // Replace overloaded functions with normal functions with different names.
  75. // Use inline overloaded functions which turn around and call the renamed
  76. // functions so client code isn't affected.
  77. //########################################################################################
  78.  
  79. void            FW_OutlineODShape(Environment *ev, ODShape* odShapeToOutline, FW_Fixed outlineSize);
  80.  
  81. ODShape*        FW_CreateLineODShape(Environment *ev, 
  82.                                         const FW_CPoint& firstPoint, 
  83.                                         const FW_CPoint& lastPoint,
  84.                                         FW_Fixed penSize);
  85. ODShape*         FW_CreateOvalODShape(Environment *ev, const FW_CRect& rect);
  86. ODShape*         FW_CreateRoundRectODShape(Environment *ev, const FW_CRect& rect, const FW_CPoint& ovalSize);
  87. ODShape*         FW_CreateArcODShape(Environment *ev, const FW_CRect& rect, short startAngle, short arcAngle);
  88. ODShape*         FW_CreatePolygonODShape(Environment *ev, long inPointCount, const FW_SPoint* inPoints);
  89. ODPolygon*         FW_CreateODPolygon(Environment *ev, long inPointCount, const FW_SPoint* inPoints);
  90.  
  91. //========================================================================================
  92. //    Macintosh Utilities
  93. //========================================================================================
  94.  
  95. #ifdef FW_BUILD_MAC
  96.  
  97. inline FW_Boolean        FW_MacIsColorPort(GrafPtr grafPort)
  98. {
  99.     return ((CGrafPtr)grafPort)->portVersion < 0;
  100. }
  101.  
  102. inline FW_Boolean        FW_MacIsColorPort(CGrafPtr grafPort)
  103. {
  104.     return (grafPort)->portVersion < 0;
  105. }
  106.  
  107. #endif
  108.  
  109. //========================================================================================
  110. //    class FW_CMacTempPort
  111. //========================================================================================
  112.  
  113. #ifdef FW_BUILD_MAC
  114. class FW_CMacTempPort
  115. {
  116. public:
  117.     FW_DECLARE_AUTO(FW_CMacTempPort)
  118.  
  119.     FW_CMacTempPort(CGrafPtr tempPort = NULL, GDHandle tempDevice = NULL);
  120.     FW_CMacTempPort(GrafPtr tempPort, GDHandle tempDevice = NULL);
  121.     
  122.     ~FW_CMacTempPort();
  123.  
  124. private:
  125.  
  126.     void PrivSaveAndSet(CGrafPtr tempPort, GDHandle tempDevice);
  127.     
  128.     CGrafPtr    fMacPort;
  129.     GDHandle    fGDevice;
  130. };
  131. #endif
  132.  
  133. #endif
  134.  
  135.