www.pudn.com > News Search3.01.rar > ColorPicker.h


#if !defined(AFX_COLORPICKER_H__BB48B102_C5DB_11D4_B45A_00104B1269BD__INCLUDED_) 
#define AFX_COLORPICKER_H__BB48B102_C5DB_11D4_B45A_00104B1269BD__INCLUDED_ 
 
#if _MSC_VER > 1000 
#pragma once 
#endif // _MSC_VER > 1000 
// ColorPicker.h : header file 
// 
#include "ColorPopup.h" 
 
///////////////////////////////////////////////////////////////////////////// 
// CColorPicker window 
 
void AFXAPI DDX_ColorPicker(CDataExchange *pDX, int nIDC, COLORREF& crColor); 
 
#define CP_MODE_TEXT 1  // edit text color 
#define CP_MODE_BK   2  // edit background color (default) 
 
class CColorPicker : public CButton 
{ 
// Construction 
public: 
	CColorPicker(); 
    DECLARE_DYNCREATE(CColorPicker); 
 
// Attributes 
public: 
    COLORREF GetColor(); 
    void     SetColor(COLORREF crColor);  
 
    void     SetDefaultText(LPCTSTR szDefaultText); 
    void     SetCustomText(LPCTSTR szCustomText); 
 
    void     SetTrackSelection(BOOL bTracking = TRUE)  { m_bTrackSelection = bTracking; } 
    BOOL     GetTrackSelection()                       { return m_bTrackSelection; } 
 
    void     SetSelectionMode(UINT nMode)              { m_nSelectionMode = nMode; } 
    UINT     GetSelectionMode()                        { return m_nSelectionMode; }; 
 
    void     SetBkColor(COLORREF crColorBk); 
    COLORREF GetBkColor()                             { return m_crColorBk; } 
     
    void     SetTextColor(COLORREF crColorText); 
    COLORREF GetTextColor()                           { return m_crColorText;} 
 
// Operations 
public: 
 
// Overrides 
	// ClassWizard generated virtual function overrides 
	//{{AFX_VIRTUAL(CColorPicker) 
	public: 
	virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct); 
	protected: 
	virtual void PreSubclassWindow(); 
	//}}AFX_VIRTUAL 
 
// Implementation 
public: 
	virtual ~CColorPicker(); 
 
protected: 
    void SetWindowSize(); 
 
// protected attributes 
protected: 
    BOOL     m_bActive,                // Is the dropdown active? 
             m_bTrackSelection;        // track color changes? 
    COLORREF m_crColorBk; 
    COLORREF m_crColorText; 
    UINT     m_nSelectionMode; 
    CRect    m_ArrowRect; 
    CString  m_strDefaultText; 
    CString  m_strCustomText; 
 
	// Generated message map functions 
protected: 
	//{{AFX_MSG(CColorPicker) 
	afx_msg BOOL OnClicked(); 
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); 
	//}}AFX_MSG 
    afx_msg LONG OnSelEndOK(UINT lParam, LONG wParam); 
    afx_msg LONG OnSelEndCancel(UINT lParam, LONG wParam); 
    afx_msg LONG OnSelChange(UINT lParam, LONG wParam); 
 
	DECLARE_MESSAGE_MAP() 
}; 
 
///////////////////////////////////////////////////////////////////////////// 
 
//{{AFX_INSERT_LOCATION}} 
// Microsoft Visual C++ will insert additional declarations immediately before the previous line. 
 
#endif // !defined(AFX_COLORPICKER_H__BB48B102_C5DB_11D4_B45A_00104B1269BD__INCLUDED_)