home *** CD-ROM | disk | FTP | other *** search
/ Media Share 13 / mediashare_13.zip / mediashare_13 / ZIPPED / PROGRAM / WTJ9403.ZIP / WILDASS / SOURCE / ICONBTN.H < prev    next >
C/C++ Source or Header  |  1993-08-12  |  1KB  |  57 lines

  1. // iconbtn.h
  2. //
  3. // class interface to the icon button class
  4. // an icon button is an ownerdraw (self-drawn)
  5. // button that is capable of displaying an icon that
  6. // is associated to a windows executable
  7. //
  8. // if no path to an executable is given, no icon is painted
  9. // if the executable doesnt contain an icon, no icon is painted
  10. // 
  11. // the icon that is painted might be changed to another icon
  12. //
  13. // update: 1.00 02-Aug.93 tw
  14. //         1.01 10-Aug-93 tw added drag n drop
  15. //                           dropinfo is routed to the parent
  16.  
  17. #ifndef _INC_ICONBTNH
  18. #define _INC_ICONBTNH
  19.  
  20. class CIconButton : public CButton
  21. {                   
  22. private:
  23.    enum 
  24.    {
  25.       cxFrame = 8,   // 4 pixel frame on each side
  26.       cyFrame = 8
  27.    };
  28.  
  29.    HICON    m_hIcon;   
  30.    
  31.    int   m_cxIcon,
  32.          m_cyIcon,
  33.          m_cxButton,
  34.          m_cyButton;
  35.    
  36. public: 
  37.    CIconButton();
  38.    void Create( CWnd * pParent, const CPoint& rPos, UINT nID, const char * pszIconFile=0 );
  39.    void SetIcon( HICON hIcon );
  40.    static UINT Width();
  41.    
  42. protected:
  43.    virtual void DrawItem( LPDRAWITEMSTRUCT lp );
  44.    afx_msg void OnDropFiles( HDROP hDrop );
  45.     
  46. private:
  47.    // Helper fxns
  48.    void DrawEntire( CDC * pDC );
  49.    void DrawUpState( CDC * pDC );
  50.    void DrawDownState( CDC * pDC );
  51.                   
  52.    DECLARE_MESSAGE_MAP()                  
  53. };  
  54.  
  55. #endif // INC_ICNBTNH
  56.  
  57.