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 / Container / Sources / Select.h < prev    next >
Encoding:
Text File  |  1996-09-17  |  5.1 KB  |  168 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                Select.h
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Copyright:            (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef SELECT_H
  11. #define SELECT_H
  12.  
  13. // ----- Part Layer -----
  14.  
  15. #ifndef FWSELECT_H
  16. #include "FWSelect.h"
  17. #endif
  18.  
  19. // ----- OS Layer -----
  20.  
  21. #ifndef FWRECT_H
  22. #include "FWRect.h"
  23. #endif
  24.  
  25. #ifndef FWRECSHP_H
  26. #include "FWRecShp.h"
  27. #endif
  28.  
  29. //========================================================================================
  30. //    Forward Declarations
  31. //========================================================================================
  32.  
  33. class FW_CContent;
  34. class FW_CGraphicContext;
  35. class FW_CMouseEvent;
  36.  
  37. class CContainerPart;
  38. class CProxy;
  39. class CBaseContent;
  40. class CSelectionContent;
  41. class CContainerFrame;
  42.  
  43. //========================================================================================
  44. //    class CContainerSelection
  45. //========================================================================================
  46.  
  47. class CContainerSelection : public FW_CSelection
  48. {
  49. //----------------------------------------------------------------------------------------
  50. //    Initialization/Destruction
  51. //
  52.   public:
  53.     FW_DECLARE_AUTO(CContainerSelection)
  54.  
  55.     CContainerSelection(Environment* ev, CContainerPart* part);
  56.     virtual         ~CContainerSelection();
  57.     
  58. //----------------------------------------------------------------------------------------
  59. //    Inherited API
  60. //
  61.   public:
  62.     virtual void        CloseSelection(Environment* ev);
  63.     virtual void        SelectAll(Environment* ev);
  64.     virtual FW_Boolean    IsEmpty(Environment* ev) const;
  65.     virtual void        ClearSelection(Environment* ev);
  66.     
  67.     virtual FW_CContent* GetSelectedContent(Environment* ev);
  68.     
  69.     virtual ODShape*    AcquireSelectionShape(Environment* ev, ODFacet* facet, FW_CFrame* frame);
  70.     virtual ODShape*    AcquireSelectionOutline(Environment* ev, ODFacet* facet, FW_CFrame* frame);
  71.     
  72.     virtual FW_Boolean    IsMouseInDraggableItem(Environment* ev, 
  73.                             FW_CFrame* frame,
  74.                             const FW_CMouseEvent& theMouseEvent, 
  75.                             FW_Boolean inBackground);
  76.  
  77.     virtual void        UpdateSelectionOnMouseDown(Environment* ev, 
  78.                             const FW_CMouseEvent& mouseEvent,
  79.                             ODFacet* embeddedFacet,
  80.                             FW_Boolean inEmbeddedFrameBorder,
  81.                             FW_Boolean inBackground);
  82.     
  83. //----------------------------------------------------------------------------------------
  84. //    New API
  85. //
  86.   public:
  87.     CProxy*         WhichHandle(Environment* ev, 
  88.                             FW_CGraphicContext& gc, 
  89.                             const FW_CPoint& mouse, 
  90.                             short& whichHandle,
  91.                             FW_Fixed zoomFactor) const;
  92.     
  93.     void            RenderSelectionHandles(Environment* ev, FW_CGraphicContext& gc, FW_Fixed zoomFactor);
  94.     void            RenderHandles(Environment* ev, CProxy* proxy);
  95.     void            RenderAllHandles(Environment* ev, CContainerFrame* frame);
  96.     
  97.     void            InvalidateSelectionHandles(Environment* ev, CContainerFrame* frame);
  98.  
  99.     void            AddToSelection(Environment* ev, CProxy* theProxy, FW_Boolean renderHandles);
  100.     void            RemoveFromSelection(Environment* ev, CProxy* theProxy, FW_Boolean renderHandles);
  101.  
  102.     void            OffsetSelection(Environment* ev, FW_Fixed xDelta, FW_Fixed yDelta);
  103.  
  104.     FW_Boolean        Resize(Environment* ev, const FW_CMouseEvent& theMouseEvent);    
  105.  
  106.     void            SelectWithRectangle(Environment* ev, const FW_CMouseEvent& theMouseEvent);
  107.  
  108.     FW_CPoint        CenterSelection(Environment* ev, FW_CFrame* scopeFrame);
  109.     
  110.     ODShape*        GetUpdateShape(Environment *ev) const;
  111.     FW_CRect        GetDragRect(Environment *ev) const;
  112.  
  113.     CProxy*            GetAnchorProxy() const;
  114.  
  115.     void            ClearCache(Environment *ev);
  116.     void            CalcCache(Environment* ev);
  117.  
  118.     unsigned long    Count() const;
  119.     
  120.     CProxy*            GetFirstSelectedProxy() const;
  121.     
  122.   private:
  123.     void            DoAdd(Environment* ev, CProxy* proxy);
  124.     void            DoRemove(Environment* ev, CProxy* proxy);
  125.     FW_Boolean        IsSelectedShapesChanged(Environment* ev) const;
  126.         
  127.   public:
  128.     void            ProxyAdded(Environment* ev, CProxy* proxy);
  129.     void            SelectContent(Environment* ev, CBaseContent* content);
  130.     CBaseContent*    GetSelectionContent(Environment* ev);
  131.  
  132.     void            DeleteSelection(Environment* ev);
  133.     FW_Boolean        IsOKtoEdit(Environment* ev);
  134.  
  135.     void            SelectionChanged(Environment* ev);
  136.     virtual FW_Boolean  CanPasteAsLink(Environment* ev,  ODPasteAsMergeSetting& setting,  ODStorageUnit* su); //Override
  137.  
  138.  
  139. //----------------------------------------------------------------------------------------
  140. //    Data Members
  141. //
  142.   private:
  143.     CContainerPart*        fContainerPart;
  144.     FW_CRect            fDragRect;
  145.     ODShape*            fUpdateShape;
  146.     unsigned long        fCount;
  147.     CProxy*                fAnchorProxy;
  148.     short                fClickedHandle;
  149.     
  150.     CSelectionContent*    fSelectionContent;
  151.     
  152.     FW_CRectShape        fWorkingHandle;
  153.     CSelectionContent*    fDraggedContent;
  154. };
  155.  
  156. //========================================================================================
  157. //    CContainerSelection Inlines
  158. //========================================================================================
  159.  
  160. //----------------------------------------------------------------------------------------
  161. //    CContainerSelection::GetAnchorProxy
  162. //----------------------------------------------------------------------------------------
  163. inline CProxy* CContainerSelection::GetAnchorProxy() const
  164. {
  165.     return fAnchorProxy;
  166. }
  167.  
  168. #endif