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 / Draw / Sources / PalFrame.h < prev    next >
Encoding:
Text File  |  1996-09-17  |  4.2 KB  |  155 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                PalFrame.h
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Author:                Henri Lamiraux
  7. //
  8. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  9. //
  10. //========================================================================================
  11.  
  12. #ifndef PALFRAME_H
  13. #define PALFRAME_H
  14.  
  15. // ----- OS Layer -----
  16.  
  17. #ifndef FLOATFRM_H
  18. #include "FloatFrm.h"
  19. #endif
  20.  
  21. #ifndef FWNOTIFR_H
  22. #include "FWNotifr.h"
  23. #endif
  24.  
  25. #ifndef FWINTERE_H
  26. #include "FWIntere.h"
  27. #endif
  28.  
  29. #ifndef FWCOLOR_H
  30. #include "FWColor.h"
  31. #endif
  32.  
  33. //========================================================================================
  34. // Forward Declaration
  35. //========================================================================================
  36.  
  37. class FW_CFacetContext;
  38. class FW_CColor;
  39. class FW_CMouseEvent;
  40.  
  41. class CGrid;
  42. class CPaletteFrame;
  43.  
  44. //========================================================================================
  45. // CPalette
  46. //========================================================================================
  47.  
  48. class CPalette
  49. {
  50. //----------------------------------------------------------------------------------------
  51. // Initialization/destruction
  52. //
  53. public:        
  54.     CPalette();
  55.     virtual ~ CPalette();
  56.  
  57. //----------------------------------------------------------------------------------------
  58. // New API
  59. //
  60. public:
  61.     void    GetColor(short colorIndex, FW_CColor* color) const;
  62.     short    NumberOfColors() const
  63.                 {return fNumbersOfColors;}
  64.  
  65. //----------------------------------------------------------------------------------------
  66. // Data Members
  67. //
  68. private:
  69.     short            fNumbersOfColors;
  70. #ifdef FW_BUILD_MAC
  71.     CTabHandle        fColorTable;
  72. #endif
  73. #ifdef FW_BUILD_WIN
  74.     PALETTEENTRY*    fColorTable;
  75. #endif
  76. };
  77.  
  78. //========================================================================================
  79. // CColorChangedInterest
  80. //========================================================================================
  81.  
  82. class CColorChangedInterest: public FW_CInterest
  83. {
  84. public:        
  85.     CColorChangedInterest(FW_MNotifier* notifier);
  86.     virtual ~CColorChangedInterest();
  87. };
  88.  
  89. //========================================================================================
  90. // CColorChangedNotification
  91. //========================================================================================
  92.  
  93. class CColorChangedNotification : public FW_CNotification
  94. {
  95. //----------------------------------------------------------------------------------------
  96. // Initialization/destruction
  97. //
  98. public:        
  99.     CColorChangedNotification(const FW_CInterest& interest, 
  100.                                 const FW_CColor& color, 
  101.                                 FW_ERenderVerbs renderVerb);
  102.     virtual ~CColorChangedNotification();
  103.  
  104. //----------------------------------------------------------------------------------------
  105. // New API
  106. //
  107. public:
  108.     FW_CColor                GetColor() const
  109.                                 {return fColor;}
  110.     FW_ERenderVerbs            GetRenderVerb() const
  111.                                 {return fRenderVerb;}
  112.     
  113. //----------------------------------------------------------------------------------------
  114. // Data Members
  115. //
  116. private:
  117.     FW_CColor                fColor;
  118.     FW_ERenderVerbs            fRenderVerb;
  119. };
  120.  
  121. //========================================================================================
  122. // CPaletteFrame
  123. //========================================================================================
  124.  
  125. class CPaletteFrame : public CFloatingWindowFrame, public FW_MNotifier
  126. {
  127. //----------------------------------------------------------------------------------------
  128. // Initialization/destruction
  129. //
  130. public:        
  131.  
  132.     FW_DECLARE_AUTO(CPaletteFrame)
  133.     
  134.     CPaletteFrame(Environment* ev, ODFrame* odFrame, FW_CPresentation* presentation, FW_CPart* part);
  135.     virtual ~ CPaletteFrame();
  136.  
  137. //----------------------------------------------------------------------------------------
  138. // Inherited API
  139. //
  140. public:        
  141.     virtual void                 Draw(Environment* ev, ODFacet* odFacet, ODShape* invalidShape);
  142.     virtual FW_Handled            DoMouseDown(Environment* ev, const FW_CMouseEvent& theMouseEvent);
  143.  
  144.     virtual void                FacetAdded(Environment* ev, ODFacet* facet, unsigned short facetCount);
  145.     
  146. //----------------------------------------------------------------------------------------
  147. // Data Members
  148. //
  149. private:
  150.     CPalette*                fPalette;
  151.     CGrid                    *fGrid;
  152. };
  153.  
  154. #endif
  155.