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 / FWMaping.h < prev    next >
Encoding:
Text File  |  1996-09-17  |  8.1 KB  |  273 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWMaping.h
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWMAPING_H
  11. #define FWMAPING_H
  12.  
  13. #ifndef SLGRDEF_H
  14. #include "SLGrDef.h"
  15. #endif
  16.  
  17. #ifndef SLPTRECT_H
  18. #include "SLPtRect.h"
  19. #endif
  20.  
  21. #ifndef SLMAPING_H
  22. #include "SLMaping.h"
  23. #endif
  24.  
  25. #ifndef FWPOINT_H
  26. #include "FWPoint.h"
  27. #endif
  28.  
  29. #ifndef FWRECT_H
  30. #include "FWRect.h"
  31. #endif
  32.  
  33. // ----- Foundation Includes -----
  34.  
  35. #ifndef FWEXCLIB_H
  36. #include "FWExcLib.h"
  37. #endif
  38.  
  39. //========================================================================================
  40. //    class FW_CMapping
  41. //========================================================================================
  42.  
  43. class FW_CMapping : public FW_SMapping
  44. {
  45.  
  46. //----------------------------------------------------------------------------------------
  47. //    Constructors/Destructors
  48. //
  49. public:
  50.     FW_DECLARE_AUTO(FW_CMapping)
  51.  
  52.     FW_CMapping(FW_EMappingModes mappingMode = FW_kPoint);
  53.     FW_CMapping(const FW_CMapping& mapping);
  54.     FW_CMapping(const FW_SMapping& sMapping);
  55.  
  56.     ~FW_CMapping();
  57.  
  58. //----------------------------------------------------------------------------------------
  59. //    operators
  60. //
  61. public:
  62.     FW_CMapping&    operator= (const FW_CMapping& mapping);
  63.     FW_CMapping&    operator= (const FW_SMapping& sMapping);
  64.     
  65.     FW_Boolean        operator==(const FW_CMapping& mapping) const;
  66.     FW_Boolean        operator!=(const FW_CMapping& mapping) const;
  67.  
  68. //----------------------------------------------------------------------------------------
  69. //    New API
  70. //
  71. public:
  72.     
  73.     // ----- Setting the mapping -----
  74.  
  75.     void                Reset(Environment* ev)
  76.                                 {FW_PrivMapping_Reset(*this, ev); }
  77.     
  78.     void                SetMappingMode(Environment* ev, FW_EMappingModes newMappingMode)
  79.                                 {FW_PrivMapping_SetMode(*this, ev, newMappingMode); }
  80.     FW_EMappingModes    GetMappingMode(Environment*) const
  81.                                 {return fMappingMode;}
  82.         
  83.     void                SetExtents(Environment* ev,
  84.                                     const FW_CPoint& logicalExtent,
  85.                                     const FW_CPoint& deviceExtent)
  86.                                 {FW_PrivMapping_SetExtents(*this, ev, logicalExtent, deviceExtent); }
  87.     
  88.     FW_CPoint            GetLogicalExtent() const
  89.                                 {return fLogicalExtent; }
  90.                     
  91.     FW_CPoint            GetDeviceExtent() const
  92.                                 {return fDeviceExtent; }
  93.     
  94.     void                SetDeviceOrigin(Environment* ev, FW_Fixed x, FW_Fixed y)
  95.                                 {FW_PrivMapping_SetDeviceOrigin(*this, ev, x, y); }
  96.         
  97.     void                SetLogicalOrigin(Environment* ev, FW_Fixed x, FW_Fixed y)
  98.                                 {FW_PrivMapping_SetLogicalOrigin(*this, ev, x, y); }
  99.     
  100.     FW_CPoint            GetDeviceOrigin() const
  101.                                 {return fDeviceOrg; }
  102.                     
  103.     FW_CPoint            GetLogicalOrigin() const
  104.                                 {return fLogicalOrg; }
  105.  
  106. //----------------------------------------------------------------------------------------
  107. //    Conversion methods: delegated
  108. //
  109. public:
  110.     
  111.     // ----- Logical ---> Content
  112.  
  113.     void                    LogicalToContent(
  114.                                 Environment* ev,
  115.                                 const FW_SPoint& ptFrom,
  116.                                 FW_SPoint& ptTo,
  117.                                 FW_HGDevice device,
  118.                                 ODTransform* transform = NULL) const
  119.         { FW_PrivMapping_LogicalToContentPoint(*this, ev, ptFrom, ptTo, device, transform); }
  120.  
  121.     void                    LogicalToContent(
  122.                                 Environment* ev,
  123.                                 const FW_SRect& rectFrom,
  124.                                 FW_SRect& rectTo,
  125.                                 FW_HGDevice device,
  126.                                 ODTransform* transform = NULL) const
  127.         { FW_PrivMapping_LogicalToContentRect(*this, ev, rectFrom, rectTo, device, transform); }
  128.     
  129.     ODShape*                LogicalToContent(
  130.                                 Environment* ev,
  131.                                 ODShape* shape,
  132.                                 FW_HGDevice device,
  133.                                 ODTransform* transform = NULL) const
  134.         { return FW_PrivMapping_LogicalToContentShape(*this, ev, shape, device, transform); }                                
  135.  
  136.     // ----- Logical ---> Device
  137.  
  138.     void                    LogicalToDevice(
  139.                                 Environment* ev,
  140.                                 const FW_SPoint& ptFrom,
  141.                                 FW_PlatformPoint& ptTo,
  142.                                 FW_HGDevice device,
  143.                                 ODTransform* transform = NULL) const
  144.         { FW_PrivMapping_LogicalToDevicePoint(*this, ev, ptFrom, ptTo, device, transform); }                                
  145.  
  146.     void                    LogicalToDevice(
  147.                                 Environment* ev,
  148.                                 const FW_SRect& rectFrom,
  149.                                 FW_PlatformRect& rectTo,
  150.                                 FW_HGDevice device,
  151.                                 ODTransform* transform = NULL) const
  152.         { FW_PrivMapping_LogicalToDeviceRect(*this, ev, rectFrom, rectTo, device, transform); }                                
  153.  
  154.     ODShape*                LogicalToDevice(
  155.                                 Environment* ev,
  156.                                 ODShape* shape,
  157.                                 FW_HGDevice device,
  158.                                 ODTransform* transform) const
  159.         { return FW_PrivMapping_LogicalToDeviceShape(*this, ev, shape, device, transform); }                                
  160.  
  161.     // ----- Device ---> Logical
  162.  
  163.     void                    DeviceToLogical(
  164.                                 Environment* ev,
  165.                                 const FW_PlatformPoint& ptFrom,
  166.                                 FW_SPoint& ptTo,
  167.                                 FW_HGDevice device,
  168.                                 ODTransform* transform = NULL) const
  169.         { FW_PrivMapping_DeviceToLogicalPoint(*this, ev, ptFrom, ptTo, device, transform); }                                
  170.     
  171.     void                    DeviceToLogical(
  172.                                 Environment* ev,
  173.                                 const FW_PlatformRect& rectFrom,
  174.                                 FW_SRect& rectTo,
  175.                                 FW_HGDevice device,
  176.                                 ODTransform* transform = NULL) const
  177.         { FW_PrivMapping_DeviceToLogicalRect(*this, ev, rectFrom, rectTo, device, transform); }
  178.  
  179.     ODShape*                DeviceToLogical(
  180.                                 Environment* ev,
  181.                                 ODShape* shape,
  182.                                 FW_HGDevice device,
  183.                                 ODTransform* transform = NULL) const
  184.         { return FW_PrivMapping_DeviceToLogicalShape(*this, ev, shape, device, transform); }                                
  185.  
  186.     // ----- Device ---> Content
  187.  
  188.     void                    DeviceToContent(
  189.                                 Environment* ev,
  190.                                 const FW_PlatformPoint& ptFrom,
  191.                                 FW_SPoint& ptTo,
  192.                                 FW_HGDevice device,
  193.                                 ODTransform* transform = NULL) const
  194.         { FW_PrivMapping_DeviceToContentPoint(*this, ev, ptFrom, ptTo, device, transform); }                                
  195.     
  196.     void                    DeviceToContent(
  197.                                 Environment* ev,
  198.                                 const FW_PlatformRect& rectFrom,
  199.                                 FW_SRect& rectTo,
  200.                                 FW_HGDevice device,
  201.                                 ODTransform* transform = NULL) const
  202.         { FW_PrivMapping_DeviceToContentRect(*this, ev, rectFrom, rectTo, device, transform); }                                
  203.     
  204.     ODShape*                DeviceToContent(
  205.                                 Environment* ev,
  206.                                 ODShape* shape,
  207.                                 FW_HGDevice device,
  208.                                 ODTransform* transform = NULL) const
  209.         { return FW_PrivMapping_DeviceToContentShape(*this, ev, shape, device, transform); }                                
  210.  
  211.  
  212.     // ----- Content ---> Logical
  213.                             
  214.     void                    ContentToLogical(
  215.                                 Environment* ev,
  216.                                 const FW_SPoint& ptFrom,
  217.                                 FW_SPoint& ptTo,
  218.                                 FW_HGDevice device,
  219.                                 ODTransform* transform = NULL) const
  220.         { FW_PrivMapping_ContentToLogicalPoint(*this, ev, ptFrom, ptTo, device, transform); }                                
  221.     
  222.     void                    ContentToLogical(
  223.                                 Environment* ev,
  224.                                 const FW_SRect& rectFrom,
  225.                                 FW_SRect& rectTo,
  226.                                 FW_HGDevice device,
  227.                                 ODTransform* transform = NULL) const
  228.         { FW_PrivMapping_ContentToLogicalRect(*this, ev, rectFrom, rectTo, device, transform); }                                
  229.  
  230.     ODShape*                ContentToLogical(
  231.                                 Environment* ev,
  232.                                 ODShape* shape,
  233.                                 FW_HGDevice device,
  234.                                 ODTransform* transform = NULL) const
  235.         { return FW_PrivMapping_ContentToLogicalShape(*this, ev, shape, device, transform); }
  236.  
  237.     // ----- Content ---> Device
  238.  
  239.     void                    ContentToDevice(
  240.                                 Environment* ev,
  241.                                 const FW_SPoint& ptFrom,
  242.                                 FW_PlatformPoint& ptTo,
  243.                                 FW_HGDevice device,
  244.                                 ODTransform* transform = NULL) const
  245.         {     FW_PrivMapping_ContentToDevicePoint(*this, ev, ptFrom, ptTo, device, transform); }                        
  246.     
  247.     void                    ContentToDevice(
  248.                                 Environment* ev,
  249.                                 const FW_SRect& rectFrom,
  250.                                 FW_PlatformRect& rectTo,
  251.                                 FW_HGDevice device,
  252.                                 ODTransform* transform = NULL) const
  253.         { FW_PrivMapping_ContentToDeviceRect(*this, ev, rectFrom, rectTo, device, transform); }
  254.     
  255.     ODShape*                ContentToDevice(
  256.                                 Environment* ev,
  257.                                 ODShape* shape,
  258.                                 FW_HGDevice device,
  259.                                 ODTransform* transform = NULL) const
  260.         { return FW_PrivMapping_ContentToDeviceShape(*this, ev, shape, device, transform); }
  261. };
  262.  
  263. //----------------------------------------------------------------------------------------
  264. //    FW_CMapping::operator!=
  265. //----------------------------------------------------------------------------------------
  266.  
  267. inline FW_Boolean FW_CMapping::operator!=(const FW_CMapping& mapping) const
  268. {
  269.     return !(*this == mapping);
  270. }
  271.  
  272. #endif
  273.