home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 October: Mac OS SDK / Dev.CD Oct 96 SDK / Dev.CD Oct 96 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / Container / Sources / Proxy.h < prev    next >
Encoding:
Text File  |  1996-08-16  |  4.9 KB  |  172 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                Proxy.h
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Copyright:            (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef PROXY_H
  11. #define PROXY_H
  12.  
  13. // ----- Part Layer -----
  14.  
  15. #ifndef FWFRMING_H
  16. #include "FWFrming.h"
  17. #endif
  18.  
  19. #ifndef FWPROXY_H
  20. #include "FWProxy.h"
  21. #endif
  22.  
  23. // ----- OS Layer -----
  24.  
  25. #ifndef FWRECT_H
  26. #include "FWRect.h"
  27. #endif
  28.  
  29. //========================================================================================
  30. // Constants
  31. //========================================================================================
  32.  
  33. // ----- Selection handle locations -----
  34. const short kInTopLeftCorner = 1;
  35. const short kInBottomRightCorner = kInTopLeftCorner + 1;
  36. const short kInTopRightCorner = kInBottomRightCorner + 1;
  37. const short kInBottomLeftCorner = kInTopRightCorner + 1;
  38. const short kInTopMiddle = kInBottomLeftCorner + 1;
  39. const short kInLeftMiddle = kInTopMiddle + 1;
  40. const short kInBottomMiddle = kInLeftMiddle + 1;
  41. const short kInRightMiddle = kInBottomMiddle + 1;
  42.  
  43. #define kNumberOfHandles 8
  44.  
  45. //========================================================================================
  46. // Forward Declarations
  47. //========================================================================================
  48.  
  49. class ODFrame;
  50. class CContainerPart;
  51. class FW_CFacetClipper;
  52.  
  53. //========================================================================================
  54. //    class CProxy
  55. //========================================================================================
  56.  
  57. class CProxy : public FW_MProxy
  58. {
  59. //----------------------------------------------------------------------------------------
  60. //    Initialization/Destruction
  61. //
  62.   public:
  63.     CProxy(Environment* ev, const FW_CRect& bounds, CContainerPart* part);
  64.     virtual ~CProxy();
  65.  
  66.   protected:
  67.     void                 InitStatic();
  68.  
  69. //----------------------------------------------------------------------------------------
  70. //    Inherited API from FW_MProxy
  71. //
  72.   public:
  73.     virtual void         UsedShapeChanged(Environment* ev, 
  74.                                     FW_CEmbeddingFrame* embeddingFrame, 
  75.                                     ODFrame* odEmbeddedFrame);
  76.     
  77.     virtual ODShape*    FrameShapeRequested(Environment* ev, 
  78.                                     FW_CEmbeddingFrame* embeddingFrame, 
  79.                                     ODFrame* odEmbeddedFrame, 
  80.                                     ODShape* requestedFrameShape);
  81.                                             
  82. //-----------------------------------------------------------------------------------------
  83. //    New API
  84. //
  85.   public:
  86.     void        Render(Environment *ev, ODFacet* facet, FW_CGraphicContext& gc);
  87.  
  88.     FW_CRect    GetBounds(Environment* ev) const;
  89.     void        SetBounds(Environment* ev, 
  90.                         const FW_CRect& bounds);
  91.     
  92.     ODShape*    CreateProxyOutline(Environment *ev);
  93.     
  94.     void        GetUpdateBox(Environment* ev, 
  95.                         ODShape* updateBox) const;
  96.  
  97.     FW_Boolean    InSelectionRect(const FW_CRect& selectRect) const;
  98.  
  99.     void        ResizeFeedback(FW_CGraphicContext& gc, 
  100.                         const FW_CInk& ink, 
  101.                         const FW_CStyle& style, 
  102.                         short whichHandle, 
  103.                         const FW_CPoint& mouseLoc);
  104.  
  105.     FW_Boolean    HitTest(Environment *ev, 
  106.                         FW_CGraphicContext& gc, 
  107.                         const FW_CPoint& where) const;
  108.  
  109.     void        OffsetProxy(Environment* ev, 
  110.                         FW_Fixed xDelta, 
  111.                         FW_Fixed yDelta);
  112.     void        ResizeProxy(Environment* ev, 
  113.                         const FW_CRect& srcRect, 
  114.                         const FW_CRect& dstRect);
  115.  
  116.     void        CalcHandle(short whichHandle, 
  117.                         FW_CRectShape* handle, 
  118.                         const FW_CPoint& penSize) const;
  119.     void        GetHandleCenter(short whichHandle, 
  120.                         FW_CPoint& center) const;
  121.     void        RenderHandles(FW_CGraphicContext& gc);
  122.     void        RenderSelectionFrame(FW_CGraphicContext& gc);
  123.     
  124.     short        WhichHandle(FW_CGraphicContext& gc, 
  125.                         const FW_CPoint& mouse) const;
  126.  
  127.     void        SelectProxy(Environment* ev, 
  128.                         FW_Boolean state);
  129.  
  130.     void        SubtractToWindowClip(Environment* ev, 
  131.                          FW_CFacetClipper* facetClipper, 
  132.                          ODFacet* containingFacet, 
  133.                          ODShape* windowClip,
  134.                          ODShape* tempShape);
  135.  
  136.     FW_Boolean    IsSelected() const;
  137.     void        GetMappedRects(short whichHandle, 
  138.                         const FW_CPoint& mouseLoc, 
  139.                         FW_CRect& srcRect, 
  140.                         FW_CRect& dstRect);
  141.  
  142. //----------------------------------------------------------------------------------------
  143. //    Data Members
  144. //
  145.   public:
  146.     static unsigned long    gProxyCount;
  147.     static FW_CRectShape*    gWorkingHandle;
  148.  
  149.   private:
  150.     CContainerPart*        fContainerPart;
  151.     FW_CRect            fBounds;
  152.     FW_Boolean            fSelected;
  153. };
  154.  
  155. //========================================================================================
  156. //    Inlines
  157. //========================================================================================
  158.  
  159. //----------------------------------------------------------------------------------------
  160. inline FW_CRect CProxy::GetBounds(Environment*) const
  161. {
  162.     return fBounds;
  163. }
  164.  
  165. //----------------------------------------------------------------------------------------
  166. inline FW_Boolean CProxy::IsSelected() const
  167. {
  168.     return fSelected;
  169. }
  170.  
  171. #endif
  172.