home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-17 | 8.1 KB | 273 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWMaping.h
- // Release Version: $ ODF 2 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWMAPING_H
- #define FWMAPING_H
-
- #ifndef SLGRDEF_H
- #include "SLGrDef.h"
- #endif
-
- #ifndef SLPTRECT_H
- #include "SLPtRect.h"
- #endif
-
- #ifndef SLMAPING_H
- #include "SLMaping.h"
- #endif
-
- #ifndef FWPOINT_H
- #include "FWPoint.h"
- #endif
-
- #ifndef FWRECT_H
- #include "FWRect.h"
- #endif
-
- // ----- Foundation Includes -----
-
- #ifndef FWEXCLIB_H
- #include "FWExcLib.h"
- #endif
-
- //========================================================================================
- // class FW_CMapping
- //========================================================================================
-
- class FW_CMapping : public FW_SMapping
- {
-
- //----------------------------------------------------------------------------------------
- // Constructors/Destructors
- //
- public:
- FW_DECLARE_AUTO(FW_CMapping)
-
- FW_CMapping(FW_EMappingModes mappingMode = FW_kPoint);
- FW_CMapping(const FW_CMapping& mapping);
- FW_CMapping(const FW_SMapping& sMapping);
-
- ~FW_CMapping();
-
- //----------------------------------------------------------------------------------------
- // operators
- //
- public:
- FW_CMapping& operator= (const FW_CMapping& mapping);
- FW_CMapping& operator= (const FW_SMapping& sMapping);
-
- FW_Boolean operator==(const FW_CMapping& mapping) const;
- FW_Boolean operator!=(const FW_CMapping& mapping) const;
-
- //----------------------------------------------------------------------------------------
- // New API
- //
- public:
-
- // ----- Setting the mapping -----
-
- void Reset(Environment* ev)
- {FW_PrivMapping_Reset(*this, ev); }
-
- void SetMappingMode(Environment* ev, FW_EMappingModes newMappingMode)
- {FW_PrivMapping_SetMode(*this, ev, newMappingMode); }
- FW_EMappingModes GetMappingMode(Environment*) const
- {return fMappingMode;}
-
- void SetExtents(Environment* ev,
- const FW_CPoint& logicalExtent,
- const FW_CPoint& deviceExtent)
- {FW_PrivMapping_SetExtents(*this, ev, logicalExtent, deviceExtent); }
-
- FW_CPoint GetLogicalExtent() const
- {return fLogicalExtent; }
-
- FW_CPoint GetDeviceExtent() const
- {return fDeviceExtent; }
-
- void SetDeviceOrigin(Environment* ev, FW_Fixed x, FW_Fixed y)
- {FW_PrivMapping_SetDeviceOrigin(*this, ev, x, y); }
-
- void SetLogicalOrigin(Environment* ev, FW_Fixed x, FW_Fixed y)
- {FW_PrivMapping_SetLogicalOrigin(*this, ev, x, y); }
-
- FW_CPoint GetDeviceOrigin() const
- {return fDeviceOrg; }
-
- FW_CPoint GetLogicalOrigin() const
- {return fLogicalOrg; }
-
- //----------------------------------------------------------------------------------------
- // Conversion methods: delegated
- //
- public:
-
- // ----- Logical ---> Content
-
- void LogicalToContent(
- Environment* ev,
- const FW_SPoint& ptFrom,
- FW_SPoint& ptTo,
- FW_HGDevice device,
- ODTransform* transform = NULL) const
- { FW_PrivMapping_LogicalToContentPoint(*this, ev, ptFrom, ptTo, device, transform); }
-
- void LogicalToContent(
- Environment* ev,
- const FW_SRect& rectFrom,
- FW_SRect& rectTo,
- FW_HGDevice device,
- ODTransform* transform = NULL) const
- { FW_PrivMapping_LogicalToContentRect(*this, ev, rectFrom, rectTo, device, transform); }
-
- ODShape* LogicalToContent(
- Environment* ev,
- ODShape* shape,
- FW_HGDevice device,
- ODTransform* transform = NULL) const
- { return FW_PrivMapping_LogicalToContentShape(*this, ev, shape, device, transform); }
-
- // ----- Logical ---> Device
-
- void LogicalToDevice(
- Environment* ev,
- const FW_SPoint& ptFrom,
- FW_PlatformPoint& ptTo,
- FW_HGDevice device,
- ODTransform* transform = NULL) const
- { FW_PrivMapping_LogicalToDevicePoint(*this, ev, ptFrom, ptTo, device, transform); }
-
- void LogicalToDevice(
- Environment* ev,
- const FW_SRect& rectFrom,
- FW_PlatformRect& rectTo,
- FW_HGDevice device,
- ODTransform* transform = NULL) const
- { FW_PrivMapping_LogicalToDeviceRect(*this, ev, rectFrom, rectTo, device, transform); }
-
- ODShape* LogicalToDevice(
- Environment* ev,
- ODShape* shape,
- FW_HGDevice device,
- ODTransform* transform) const
- { return FW_PrivMapping_LogicalToDeviceShape(*this, ev, shape, device, transform); }
-
- // ----- Device ---> Logical
-
- void DeviceToLogical(
- Environment* ev,
- const FW_PlatformPoint& ptFrom,
- FW_SPoint& ptTo,
- FW_HGDevice device,
- ODTransform* transform = NULL) const
- { FW_PrivMapping_DeviceToLogicalPoint(*this, ev, ptFrom, ptTo, device, transform); }
-
- void DeviceToLogical(
- Environment* ev,
- const FW_PlatformRect& rectFrom,
- FW_SRect& rectTo,
- FW_HGDevice device,
- ODTransform* transform = NULL) const
- { FW_PrivMapping_DeviceToLogicalRect(*this, ev, rectFrom, rectTo, device, transform); }
-
- ODShape* DeviceToLogical(
- Environment* ev,
- ODShape* shape,
- FW_HGDevice device,
- ODTransform* transform = NULL) const
- { return FW_PrivMapping_DeviceToLogicalShape(*this, ev, shape, device, transform); }
-
- // ----- Device ---> Content
-
- void DeviceToContent(
- Environment* ev,
- const FW_PlatformPoint& ptFrom,
- FW_SPoint& ptTo,
- FW_HGDevice device,
- ODTransform* transform = NULL) const
- { FW_PrivMapping_DeviceToContentPoint(*this, ev, ptFrom, ptTo, device, transform); }
-
- void DeviceToContent(
- Environment* ev,
- const FW_PlatformRect& rectFrom,
- FW_SRect& rectTo,
- FW_HGDevice device,
- ODTransform* transform = NULL) const
- { FW_PrivMapping_DeviceToContentRect(*this, ev, rectFrom, rectTo, device, transform); }
-
- ODShape* DeviceToContent(
- Environment* ev,
- ODShape* shape,
- FW_HGDevice device,
- ODTransform* transform = NULL) const
- { return FW_PrivMapping_DeviceToContentShape(*this, ev, shape, device, transform); }
-
-
- // ----- Content ---> Logical
-
- void ContentToLogical(
- Environment* ev,
- const FW_SPoint& ptFrom,
- FW_SPoint& ptTo,
- FW_HGDevice device,
- ODTransform* transform = NULL) const
- { FW_PrivMapping_ContentToLogicalPoint(*this, ev, ptFrom, ptTo, device, transform); }
-
- void ContentToLogical(
- Environment* ev,
- const FW_SRect& rectFrom,
- FW_SRect& rectTo,
- FW_HGDevice device,
- ODTransform* transform = NULL) const
- { FW_PrivMapping_ContentToLogicalRect(*this, ev, rectFrom, rectTo, device, transform); }
-
- ODShape* ContentToLogical(
- Environment* ev,
- ODShape* shape,
- FW_HGDevice device,
- ODTransform* transform = NULL) const
- { return FW_PrivMapping_ContentToLogicalShape(*this, ev, shape, device, transform); }
-
- // ----- Content ---> Device
-
- void ContentToDevice(
- Environment* ev,
- const FW_SPoint& ptFrom,
- FW_PlatformPoint& ptTo,
- FW_HGDevice device,
- ODTransform* transform = NULL) const
- { FW_PrivMapping_ContentToDevicePoint(*this, ev, ptFrom, ptTo, device, transform); }
-
- void ContentToDevice(
- Environment* ev,
- const FW_SRect& rectFrom,
- FW_PlatformRect& rectTo,
- FW_HGDevice device,
- ODTransform* transform = NULL) const
- { FW_PrivMapping_ContentToDeviceRect(*this, ev, rectFrom, rectTo, device, transform); }
-
- ODShape* ContentToDevice(
- Environment* ev,
- ODShape* shape,
- FW_HGDevice device,
- ODTransform* transform = NULL) const
- { return FW_PrivMapping_ContentToDeviceShape(*this, ev, shape, device, transform); }
- };
-
- //----------------------------------------------------------------------------------------
- // FW_CMapping::operator!=
- //----------------------------------------------------------------------------------------
-
- inline FW_Boolean FW_CMapping::operator!=(const FW_CMapping& mapping) const
- {
- return !(*this == mapping);
- }
-
- #endif
-