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 / ODF / Framewrk / FWPart / FWLink.h < prev    next >
Encoding:
Text File  |  1996-09-17  |  4.2 KB  |  142 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWLink.h
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWLINK_H
  11. #define FWLINK_H
  12.  
  13. #ifndef FWSTDDEF_H
  14. #include "FWStdDef.h"
  15. #endif
  16.  
  17. #ifndef FWRUNTYP_H
  18. #include "FWRunTyp.h"
  19. #endif
  20.  
  21. #ifndef FWTCOLL_H
  22. #include "FWTColl.h"
  23. #endif
  24.  
  25. #ifndef FWODTYPS_H
  26. #include "FWODTyps.h"
  27. #endif
  28.  
  29. #ifndef FWORDCOL_H
  30. #include "FWOrdCol.h"
  31. #endif
  32.  
  33. //========================================================================================
  34. //    Forward Declarations
  35. //========================================================================================
  36.  
  37. class ODShape;
  38. class ODFacet;
  39.  
  40. class FW_CFrame;
  41. class FW_CMouseEvent;
  42. class FW_CPart;
  43. class FW_CPresentation;
  44. class FW_CGraphicContext;
  45.  
  46. union FW_BitPattern;
  47.  
  48. //=======================================================================================
  49. //    Constants
  50. //=======================================================================================
  51.  
  52. #define FW_kLinkBorderWidth 4
  53.  
  54. extern const FW_BitPattern    FW_kHLinkPat;
  55. extern const FW_BitPattern    FW_kVLinkPat;
  56. extern const FW_BitPattern    FW_kSelectedHLinkPat;
  57. extern const FW_BitPattern    FW_kSelectedVLinkPat;
  58.  
  59. // Current version of persistent links
  60. #define FW_kLinkVersionNumber 1
  61.  
  62. //========================================================================================
  63. //    class FW_CLink
  64. //========================================================================================
  65.  
  66. class FW_CLink
  67. {
  68.   public:
  69.     FW_CLink(Environment* ev, FW_CPresentation* presentation);
  70.     virtual ~ FW_CLink();
  71.  
  72. //----------------------------------------------------------------------------------------
  73. //    API
  74. //
  75.   public:
  76.     virtual ODShape*    DoCreateLinkBorderShape(Environment* ev);
  77.     virtual void        DoDrawLinkBorder(Environment* ev, ODShape* outline, FW_CGraphicContext& gc);
  78.     virtual void        SelectionChanged(Environment* ev, FW_Boolean newState);
  79.  
  80.     void                InvalidateBorder(Environment* ev);
  81.     FW_Boolean            IsMouseInBorder(Environment* ev, FW_CFrame* frame, const FW_CMouseEvent& theMouseEvent);
  82.  
  83.     FW_Boolean            IsBorderShown(Environment* ev) const;
  84.     FW_Boolean            IsLinkSelected(Environment* ev) const;
  85.     void                Select(Environment* ev, FW_Boolean newState);
  86.  
  87.     void                SetSelectState(Environment* ev, FW_Boolean state);
  88.     void                SetShowBorder(Environment* ev, FW_Boolean showBorder);
  89.  
  90.     void                ShowHideLinkBorder(Environment* ev, FW_Boolean turnOn, ODFacet* facet);
  91.  
  92.     void                DrawLinkBorder(Environment* ev, ODFacet* facet);
  93.  
  94. //----------------------------------------------------------------------------------------
  95. //    Data Members
  96. //
  97.   protected:
  98.     FW_CPresentation*    fPresentation;
  99.  
  100.   private:
  101.     FW_Boolean            fSelected;
  102.     FW_Boolean            fShowBorder;        // Is the link border turned on?
  103. };
  104.  
  105. //========================================================================================
  106. //    FW_CLink Inlines
  107. //========================================================================================
  108.  
  109. //----------------------------------------------------------------------------------------
  110. //    FW_CLink::IsBorderShown
  111. //----------------------------------------------------------------------------------------
  112. inline FW_Boolean FW_CLink::IsBorderShown(Environment*) const
  113. {
  114.     return fShowBorder;
  115. }
  116.  
  117. //----------------------------------------------------------------------------------------
  118. //    FW_CLink::SetShowBorder
  119. //----------------------------------------------------------------------------------------
  120. inline void FW_CLink::SetShowBorder(Environment*, FW_Boolean showBorder)
  121. {
  122.     fShowBorder = showBorder;
  123. }
  124.  
  125. //----------------------------------------------------------------------------------------
  126. //    FW_CLink::IsLinkSelected
  127. //----------------------------------------------------------------------------------------
  128. inline FW_Boolean FW_CLink::IsLinkSelected(Environment*) const
  129. {
  130.     return fSelected;
  131. }
  132.  
  133. //----------------------------------------------------------------------------------------
  134. //    FW_CLink::SetSelectState
  135. //----------------------------------------------------------------------------------------
  136. inline void FW_CLink::SetSelectState(Environment*, FW_Boolean state)
  137. {
  138.     fSelected = state;
  139. }
  140.  
  141. #endif
  142.