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 / Select.h < prev    next >
Encoding:
Text File  |  1996-08-16  |  5.3 KB  |  169 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.  
  42. //========================================================================================
  43. //    class CContainerSelection
  44. //========================================================================================
  45.  
  46. class CContainerSelection : public FW_CSelection
  47. {
  48. //----------------------------------------------------------------------------------------
  49. //    Initialization/Destruction
  50. //
  51.   public:
  52.     FW_DECLARE_AUTO(CContainerSelection)
  53.  
  54.     CContainerSelection(Environment* ev, CContainerPart* part);
  55.     virtual         ~CContainerSelection();
  56.     
  57. //----------------------------------------------------------------------------------------
  58. //    Inherited API
  59. //
  60.   public:
  61.     virtual void        CloseSelection(Environment* ev);
  62.     virtual void        SelectAll(Environment* ev);
  63.     virtual FW_Boolean    IsEmpty(Environment* ev) const;
  64.     virtual void        ClearSelection(Environment* ev);
  65.     
  66.     virtual FW_CContent* GetSelectedContent(Environment* ev);
  67.     
  68.     virtual ODShape*    CreateSelectionShape(Environment* ev, ODFacet* facet, FW_CFrame* frame) const;
  69.     virtual ODShape*    CreateSelectionOutline(Environment* ev, ODFacet* facet, FW_CFrame* frame) const;
  70.     
  71.     virtual FW_Boolean    IsMouseInDraggableItem(Environment* ev, 
  72.                             FW_CFrame* frame,
  73.                             const FW_CMouseEvent& theMouseEvent, 
  74.                             FW_Boolean inBackground);
  75.  
  76.     virtual void        UpdateSelectionOnMouseDown(Environment* ev, 
  77.                             const FW_CMouseEvent& mouseEvent,
  78.                             ODFacet* embeddedFacet,
  79.                             FW_Boolean inEmbeddedFrameBorder,
  80.                             FW_Boolean inBackground);
  81.     
  82. //----------------------------------------------------------------------------------------
  83. //    New API
  84. //
  85.   public:
  86.     CProxy*         WhichHandle(Environment* ev, FW_CGraphicContext& gc, const FW_CPoint& mouse, short& whichHandle) const;
  87.     
  88.     void            RenderSelectionHandles(Environment* ev, FW_CGraphicContext& gc);
  89.     void            RenderHandles(Environment* ev, CProxy* proxy);
  90.     void            RenderAllHandles(Environment* ev, FW_CFrame* frame);
  91.     
  92.     void            AddToSelection(Environment* ev, CProxy* theProxy, FW_Boolean renderHandles);
  93.     void            RemoveFromSelection(Environment* ev, CProxy* theProxy, FW_Boolean renderHandles);
  94.  
  95.     void            OffsetSelection(Environment* ev, FW_Fixed xDelta, FW_Fixed yDelta);
  96.  
  97.     FW_Boolean        Resize(Environment* ev, const FW_CMouseEvent& theMouseEvent);    
  98.  
  99.     void            SelectWithRectangle(Environment* ev, const FW_CMouseEvent& theMouseEvent);
  100.  
  101.     FW_CPoint        CenterSelection(Environment* ev, FW_CFrame* scopeFrame);
  102.     
  103.     ODShape*        GetUpdateShape() const;
  104.     void            GetDragRect(FW_CRect& dragRect) const;
  105.  
  106.     CProxy*            GetAnchorProxy() const;
  107.  
  108.     void            CalcCache(Environment* ev);
  109.  
  110.   private:
  111.     void            DoAdd(Environment* ev, CProxy* proxy);
  112.     void            DoRemove(Environment* ev, CProxy* proxy);
  113.         
  114.   public:
  115.     void            ProxyAdded(Environment* ev, CProxy* proxy);
  116.     void            SelectContent(Environment* ev, CBaseContent* content);
  117.     CBaseContent*    GetSelectionContent(Environment* ev);
  118.  
  119.     void            DeleteSelection(Environment* ev);
  120.     FW_Boolean        IsOKtoEdit(Environment* ev);
  121.  
  122.     void            SelectionChanged(Environment* ev);
  123.  
  124. //----------------------------------------------------------------------------------------
  125. //    Data Members
  126. //
  127.   private:
  128.     CContainerPart*        fContainerPart;
  129.     FW_CRect            fDragRect;
  130.     ODShape*            fUpdateShape;
  131.     unsigned long        fCount;
  132.     CProxy*                fAnchorProxy;
  133.     short                fClickedHandle;
  134.     
  135.     CSelectionContent*    fSelectionContent;
  136.     
  137.     FW_CRectShape        fWorkingHandle;
  138.     CSelectionContent*    fDraggedContent;
  139. };
  140.  
  141. //========================================================================================
  142. //    CContainerSelection Inlines
  143. //========================================================================================
  144.  
  145. //----------------------------------------------------------------------------------------
  146. //    CContainerSelection::GetUpdateShape
  147. //----------------------------------------------------------------------------------------
  148. inline ODShape* CContainerSelection::GetUpdateShape() const
  149. {        
  150.     return fUpdateShape;
  151. }
  152.  
  153. //----------------------------------------------------------------------------------------
  154. //    CContainerSelection::GetDragRect
  155. //----------------------------------------------------------------------------------------
  156. inline void CContainerSelection::GetDragRect(FW_CRect& dragRect) const
  157. {        
  158.     dragRect = fDragRect;
  159. }
  160.  
  161. //----------------------------------------------------------------------------------------
  162. //    CContainerSelection::GetAnchorProxy
  163. //----------------------------------------------------------------------------------------
  164. inline CProxy* CContainerSelection::GetAnchorProxy() const
  165. {
  166.     return fAnchorProxy;
  167. }
  168.  
  169. #endif