home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-11-08 | 5.1 KB | 162 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWGrUtil.h
- // Release Version: $ 1.0d11 $
- //
- // Copyright: © 1993, 1995 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWGRUTIL_H
- #define FWGRUTIL_H
-
- #ifndef FWRECT_H
- #include "FWRect.h"
- #endif
-
- // ----- Foundation Layer -----
-
- #ifndef FWCOMMON_H
- #include "FWCommon.h"
- #endif
-
- #ifdef FWEXCLIB_H
- #include "FWExcLib.h"
- #endif
-
- // ----- OpenDoc Includes -----
-
- #ifndef _ODTYPES_
- #include <ODTypes.h>
- #endif
-
- #ifndef SOM_ODShape_xh
- #include <Shape.xh>
- #endif
-
- // ----- Macintosh Includes -----
-
- #if defined(FW_BUILD_MAC) && !defined(__WINDOWS__)
- #include <Windows.h>
- #endif
-
- #if defined(FW_BUILD_MAC) && !defined(__TEXTEDIT__)
- #include <TextEdit.h>
- #endif
-
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma lib_export on
- #endif
-
- //========================================================================================
- // Forward Declarations
- //========================================================================================
-
- class FW_CLASS_ATTR ODShape;
- class FW_CLASS_ATTR ODTransform;
- class FW_CLASS_ATTR FW_CPoint;
- class FW_CLASS_ATTR FW_CRect;
-
- //========================================================================================
- // Global Utilities
- //========================================================================================
-
- // ----- ODShape utilities -----
- //########################################################################################
- // SCpp Hack
- // Work around SCpp 8.0.3 bug - importing overloaded functions doesn't work.
- // Replace overloaded functions with normal functions with different names.
- // Use inline overloaded functions which turn around and call the renamed
- // functions so client code isn't affected.
- //########################################################################################
-
- FW_FUNC_ATTR void FW_OutlineODShape(Environment *ev, ODShape* odShapeToOutline, FW_CFixed outlineSize);
-
- FW_FUNC_ATTR ODShape* FW_CreateLineODShape(Environment *ev,
- const FW_CPoint& firstPoint,
- const FW_CPoint& lastPoint,
- FW_CFixed penSize);
- FW_FUNC_ATTR ODShape* FW_CreateOvalODShape(Environment *ev, const FW_CRect& rect);
- FW_FUNC_ATTR ODShape* FW_CreateRoundRectODShape(Environment *ev, const FW_CRect& rect, const FW_CPoint& ovalSize);
- FW_FUNC_ATTR ODShape* FW_CreateArcODShape(Environment *ev, const FW_CRect& rect, short startAngle, short arcAngle);
-
- // ----- Hit testing utilities -----
- FW_FUNC_ATTR FW_Boolean FW_PtInOval(const FW_CRect& ovalRect, const FW_CPoint& test);
- FW_FUNC_ATTR FW_Boolean FW_PtInRoundRect(const FW_CRect& rect, const FW_CPoint& ovalSize, const FW_CPoint& test);
- FW_FUNC_ATTR FW_Boolean FW_HitTestLine(const FW_CPoint& pt1, const FW_CPoint& pt2, const FW_CPoint& test, FW_CFixed tolerance);
-
- // ----- Private utilities -----
- void FW_PrivCalcArcPoints(const FW_SPlatformRect& rect,
- short angle,
- FW_SPlatformPoint& arcPoint);
-
- // ----- Debugging tools -----
- FW_FUNC_ATTR void FW_LogPoint(Environment* ev, const char* prompt, const FW_CPoint& point);
- FW_FUNC_ATTR void FW_LogRect(Environment* ev, const char* prompt, const FW_CRect& rect);
- FW_FUNC_ATTR void FW_LogShape(Environment* ev, const char* prompt, ODShape* shape);
- FW_FUNC_ATTR void FW_LogTransform(Environment* ev, const char* prompt, ODTransform* transform);
-
- //========================================================================================
- // Windows Utilities
- //========================================================================================
-
- #ifdef FW_BUILD_WIN
- FW_FUNC_ATTR void FW_WinPrivGetDisplayColorInfo(short& planeCount, short& bitsPixel);
- #endif
-
- //========================================================================================
- // Macintosh Utilities
- //========================================================================================
-
- #ifdef FW_BUILD_MAC
- void FW_MacPrivGetPortTextStyle(TextStyle& theTextStyle);
- void FW_MacPrivSetPortTextStyle(const TextStyle& theTextStyle);
-
- FW_Boolean FW_MacIsColorPort(GrafPtr grafPort);
-
- // We cannot use AltPoly.h because of a compile problem with OD exceptions (Except.h)
-
- struct FW_ODContour
- {
- long fVertexCount;
- FW_CPoint fVertex[1]; // Actual count is fVertexCount
-
- FW_ODContour* NextContour() const
- { return (FW_ODContour*)&fVertex[fVertexCount]; }
- };
-
- struct FW_ODPolygonData
- {
- long fContourCount;
- FW_ODContour fContours[1]; // Actual count varies
- };
-
- //========================================================================================
- // class FW_CMacTempPort
- //========================================================================================
-
- class FW_CMacTempPort FW_AUTO_DESTRUCT_OBJECT
- {
- public:
- FW_CMacTempPort(GrafPtr tempPort = NULL);
- virtual ~FW_CMacTempPort();
-
- private:
- GrafPtr fMacPort;
- };
-
- //========================================================================================
- // Debugging
- //========================================================================================
-
- FW_FUNC_ATTR void FW_MacShowColorTable(CTabHandle cth);
-
- #endif
-
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma lib_export off
- #endif
-
- #endif
-
-