home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-08-16 | 4.9 KB | 172 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: Proxy.h
- // Release Version: $ ODF 1 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef PROXY_H
- #define PROXY_H
-
- // ----- Part Layer -----
-
- #ifndef FWFRMING_H
- #include "FWFrming.h"
- #endif
-
- #ifndef FWPROXY_H
- #include "FWProxy.h"
- #endif
-
- // ----- OS Layer -----
-
- #ifndef FWRECT_H
- #include "FWRect.h"
- #endif
-
- //========================================================================================
- // Constants
- //========================================================================================
-
- // ----- Selection handle locations -----
- const short kInTopLeftCorner = 1;
- const short kInBottomRightCorner = kInTopLeftCorner + 1;
- const short kInTopRightCorner = kInBottomRightCorner + 1;
- const short kInBottomLeftCorner = kInTopRightCorner + 1;
- const short kInTopMiddle = kInBottomLeftCorner + 1;
- const short kInLeftMiddle = kInTopMiddle + 1;
- const short kInBottomMiddle = kInLeftMiddle + 1;
- const short kInRightMiddle = kInBottomMiddle + 1;
-
- #define kNumberOfHandles 8
-
- //========================================================================================
- // Forward Declarations
- //========================================================================================
-
- class ODFrame;
- class CContainerPart;
- class FW_CFacetClipper;
-
- //========================================================================================
- // class CProxy
- //========================================================================================
-
- class CProxy : public FW_MProxy
- {
- //----------------------------------------------------------------------------------------
- // Initialization/Destruction
- //
- public:
- CProxy(Environment* ev, const FW_CRect& bounds, CContainerPart* part);
- virtual ~CProxy();
-
- protected:
- void InitStatic();
-
- //----------------------------------------------------------------------------------------
- // Inherited API from FW_MProxy
- //
- public:
- virtual void UsedShapeChanged(Environment* ev,
- FW_CEmbeddingFrame* embeddingFrame,
- ODFrame* odEmbeddedFrame);
-
- virtual ODShape* FrameShapeRequested(Environment* ev,
- FW_CEmbeddingFrame* embeddingFrame,
- ODFrame* odEmbeddedFrame,
- ODShape* requestedFrameShape);
-
- //-----------------------------------------------------------------------------------------
- // New API
- //
- public:
- void Render(Environment *ev, ODFacet* facet, FW_CGraphicContext& gc);
-
- FW_CRect GetBounds(Environment* ev) const;
- void SetBounds(Environment* ev,
- const FW_CRect& bounds);
-
- ODShape* CreateProxyOutline(Environment *ev);
-
- void GetUpdateBox(Environment* ev,
- ODShape* updateBox) const;
-
- FW_Boolean InSelectionRect(const FW_CRect& selectRect) const;
-
- void ResizeFeedback(FW_CGraphicContext& gc,
- const FW_CInk& ink,
- const FW_CStyle& style,
- short whichHandle,
- const FW_CPoint& mouseLoc);
-
- FW_Boolean HitTest(Environment *ev,
- FW_CGraphicContext& gc,
- const FW_CPoint& where) const;
-
- void OffsetProxy(Environment* ev,
- FW_Fixed xDelta,
- FW_Fixed yDelta);
- void ResizeProxy(Environment* ev,
- const FW_CRect& srcRect,
- const FW_CRect& dstRect);
-
- void CalcHandle(short whichHandle,
- FW_CRectShape* handle,
- const FW_CPoint& penSize) const;
- void GetHandleCenter(short whichHandle,
- FW_CPoint& center) const;
- void RenderHandles(FW_CGraphicContext& gc);
- void RenderSelectionFrame(FW_CGraphicContext& gc);
-
- short WhichHandle(FW_CGraphicContext& gc,
- const FW_CPoint& mouse) const;
-
- void SelectProxy(Environment* ev,
- FW_Boolean state);
-
- void SubtractToWindowClip(Environment* ev,
- FW_CFacetClipper* facetClipper,
- ODFacet* containingFacet,
- ODShape* windowClip,
- ODShape* tempShape);
-
- FW_Boolean IsSelected() const;
- void GetMappedRects(short whichHandle,
- const FW_CPoint& mouseLoc,
- FW_CRect& srcRect,
- FW_CRect& dstRect);
-
- //----------------------------------------------------------------------------------------
- // Data Members
- //
- public:
- static unsigned long gProxyCount;
- static FW_CRectShape* gWorkingHandle;
-
- private:
- CContainerPart* fContainerPart;
- FW_CRect fBounds;
- FW_Boolean fSelected;
- };
-
- //========================================================================================
- // Inlines
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- inline FW_CRect CProxy::GetBounds(Environment*) const
- {
- return fBounds;
- }
-
- //----------------------------------------------------------------------------------------
- inline FW_Boolean CProxy::IsSelected() const
- {
- return fSelected;
- }
-
- #endif
-