home *** CD-ROM | disk | FTP | other *** search
/ Mastering MFC Development / MMD.ISO / labs / c12 / lab01 / baseline / dibpal.h < prev   
Encoding:
C/C++ Source or Header  |  1997-02-20  |  1.0 KB  |  45 lines

  1. // dibpal.h : header file
  2. //
  3. // CDIBPal class
  4. //
  5.  
  6. #ifndef __DIBPAL__
  7. #define __DIBPAL__
  8.  
  9. #include "dib.h"
  10.  
  11.  
  12. class CDIBPal : public CPalette
  13. {
  14.  
  15. // Constructor
  16. public:
  17.     CDIBPal();
  18.     ~CDIBPal();
  19.     BOOL        Create(CDIB *pDIB);     // Create from a DIB.
  20.     int            GetNumColors();            // Get the number of colors
  21.                                     // in the palette.
  22. // Accessors
  23.     int            GetSelectionIndex() const { return m_nSelectionIndex; }
  24.     void        SetSelectionIndex(int nPaletteIndex);
  25.     COLORREF    GetColorFromIndex(int nPaletteIndex);
  26.     // void        SetColorAtIndex(int nPaletteIndex, COLORREF cr);
  27.     BOOL        GetDraw3D() const { return m_bDraw3D; }
  28.     void        SetDraw3D(BOOL bDraw3D = TRUE) { m_bDraw3D = bDraw3D; }
  29.  
  30.  
  31. // Drawing function
  32.     void        Draw(    CDC* pDC, 
  33.                         const CRect& rcRect, 
  34.                         BOOL bShowSelection = FALSE,
  35.                         BOOL bBkgnd = FALSE);
  36.     int            HitTest(const CRect& rcRect, CPoint pt);
  37.  
  38. // Implementation
  39. protected:
  40.     int        m_nSelectionIndex;
  41.     BOOL    m_bDraw3D;
  42. };
  43.  
  44. #endif // __DIBPAL__
  45.