home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-17 | 7.3 KB | 231 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: DrawSel.h
- // Release Version: $ ODF 1 $
- //
- // Author: Henri Lamiraux
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef DRAWSEL_H
- #define DRAWSEL_H
-
- // ----- Part Layer -----
-
- #ifndef FWSELECT_H
- #include "FWSelect.h"
- #endif
-
- // ----- OS Layer -----
-
- #ifndef FWRECT_H
- #include "FWRect.h"
- #endif
-
- #ifndef FWRECSHP_H
- #include "FWRecShp.h"
- #endif
-
- //========================================================================================
- // Forward Declarations
- //========================================================================================
-
- class FW_CGraphicContext;
- class FW_CMouseEvent;
-
- class CDrawPart;
- class CDrawFrame;
- class CSelectionIterator;
- class CDrawSelection;
- class CBaseShape;
-
- class CDrawContent;
- class CDrawSelectionContent;
- class CDrawPublishLinkCollection;
-
- //========================================================================================
- // class CDrawSelection
- //========================================================================================
-
- class CDrawSelection : public FW_CSelection
- {
- //----------------------------------------------------------------------------------------
- // Initialization/Destruction
- //
- public:
- FW_DECLARE_AUTO(CDrawSelection)
-
- CDrawSelection(Environment* ev, CDrawPart* drawPart);
- virtual ~CDrawSelection();
-
- //----------------------------------------------------------------------------------------
- // Inherited API
- //
- public:
- virtual void CloseSelection(Environment* ev);
- virtual void SelectAll(Environment* ev);
- virtual FW_Boolean IsEmpty(Environment* ev) const;
- virtual void ClearSelection(Environment* ev);
-
- virtual FW_CContent* GetSelectedContent(Environment* ev);
-
- virtual ODShape* AcquireSelectionShape(Environment* ev, ODFacet* facet, FW_CFrame* frame);
- virtual ODShape* AcquireSelectionOutline(Environment* ev, ODFacet* facet, FW_CFrame* frame);
-
- virtual FW_Boolean CanPasteAsLink(Environment* ev, ODPasteAsMergeSetting& setting, ODStorageUnit* su);
- virtual FW_Boolean IsSelectionLinkable(Environment* ev);
-
- virtual FW_Boolean IsMouseInDraggableItem(Environment* ev,
- FW_CFrame* frame,
- const FW_CMouseEvent& theMouseEvent,
- FW_Boolean inBackground);
-
- virtual void UpdateSelectionOnMouseDown(Environment* ev,
- const FW_CMouseEvent& mouseEvent,
- ODFacet* embeddedFacet,
- FW_Boolean inEmbeddedFrameBorder,
- FW_Boolean inBackground);
-
- virtual FW_CLinkDestination* GetLinkDestination(Environment* ev, FW_Boolean& multipleLinks);
-
- //----------------------------------------------------------------------------------------
- // New API
- //
- public:
- CBaseShape* WhichHandle(Environment* ev, FW_CGraphicContext& gc, const FW_CPoint& mouse, short& whichHandle, FW_Fixed zoomFactor) const;
-
- void RenderSelectionHandles(Environment* ev, FW_CGraphicContext& gc, FW_Fixed zoomFactor);
- void InvalidateSelectionHandles(Environment* ev, CDrawFrame* frame);
-
- void RenderHandles(Environment* ev, CBaseShape* shape);
- void RenderAllHandles(Environment* ev, CDrawFrame* frame);
-
- void AddToSelection(Environment* ev, CBaseShape* theShape, FW_Boolean renderHandles);
- void RemoveFromSelection(Environment* ev, CBaseShape* theShape, FW_Boolean renderHandles);
-
- void OffsetSelection(Environment* ev, FW_Fixed xDelta, FW_Fixed yDelta);
-
- FW_Boolean Resize(Environment* ev, const FW_CMouseEvent& theMouseEvent);
-
- void SelectWithRectangle(Environment* ev, const FW_CMouseEvent& theMouseEvent);
-
- FW_Boolean GetSelectionPenSize(Environment* ev, FW_Fixed& penSize);
-
- FW_CPoint CenterSelection(Environment* ev, FW_CFrame* scopeFrame);
-
- unsigned long Count() const;
-
- // ----- Frozen state -----
- FW_Boolean HasFrozen() const;
- FW_Boolean HasNotFrozen() const;
- void SetFrozen(Environment* ev, FW_Boolean state);
-
- ODShape* GetUpdateShape() const;
- const FW_CRect& GetDragRect() const;
-
- // ----- Anchor Shape -----
- CBaseShape* GetAnchorShape() const;
- void SetAnchorShape(CBaseShape* shape);
-
-
- // ----- Linking -----
- void SelectionChanged(Environment* ev, ODUpdateID updateID);
- void DeleteSelection(Environment* ev);
-
- void CalcCache(Environment* ev);
-
- private:
-
- void DoAdd(Environment* ev, CBaseShape *shape);
- void DoRemove(Environment* ev, CBaseShape *shape);
-
- public:
- void ShapeAdded(Environment* ev, CBaseShape* shape);
- void SelectContent(Environment* ev, CDrawContent* content);
- CDrawContent* GetDrawContent(Environment* ev);
- CDrawPart* GetDrawPart() const
- {return fDrawPart;}
- CDrawPublishLinkCollection* GetSelectedLinkSources();
-
-
- //----------------------------------------------------------------------------------------
- // Data Members
- //
- private:
- CDrawPart* fDrawPart;
- FW_CRect fDragRect;
- ODShape* fUpdateShape;
- unsigned short fFrozenCount;
- unsigned long fCount;
- CBaseShape* fAnchorShape;
- short fClickedHandle;
-
- CDrawSelectionContent* fSelectionContent;
-
- FW_CRectShape fWorkingHandle;
- CDrawSelectionContent* fDraggedContent;
- };
-
- //========================================================================================
- // CDrawSelection Inlines
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // CDrawSelection::GetUpdateShape
- //----------------------------------------------------------------------------------------
- inline ODShape* CDrawSelection::GetUpdateShape() const
- {
- return fUpdateShape;
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawSelection::GetDragRect
- //----------------------------------------------------------------------------------------
- inline const FW_CRect& CDrawSelection::GetDragRect() const
- {
- return fDragRect;
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawSelection::HasFrozen
- //----------------------------------------------------------------------------------------
- inline FW_Boolean CDrawSelection::HasFrozen() const
- {
- return fFrozenCount != 0;
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawSelection::HasNotFrozen
- //----------------------------------------------------------------------------------------
- inline FW_Boolean CDrawSelection::HasNotFrozen() const
- {
- return fCount != 0 && fFrozenCount != fCount;
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawSelection::Count
- //----------------------------------------------------------------------------------------
- inline unsigned long CDrawSelection::Count() const
- {
- return fCount;
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawSelection::GetAnchorShape
- //----------------------------------------------------------------------------------------
- inline CBaseShape* CDrawSelection::GetAnchorShape() const
- {
- return fAnchorShape;
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawSelection::SetAnchorShape
- //----------------------------------------------------------------------------------------
- inline void CDrawSelection::SetAnchorShape(CBaseShape* shape)
- {
- fAnchorShape = shape;
- }
-
- #endif