ColourPicker.h
上传用户:cn05999
上传日期:2020-06-29
资源大小:84k
文件大小:2k
- #if !defined(AFX_COLOURPICKER_H__9200FF1E_28AB_41F3_A870_84A72BEDA649__INCLUDED_)
- #define AFX_COLOURPICKER_H__9200FF1E_28AB_41F3_A870_84A72BEDA649__INCLUDED_
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- // ColourPicker.h : header file
- //
- #include "ColourPopup.h"
- #define CP_MODE_TEXT 1
- #define CP_MODE_BK 2
- /////////////////////////////////////////////////////////////////////////////
- // CColourPicker window
- void AFXAPI DDX_ColourPicker(CDataExchange* pDX,int nIDC,COLORREF& crColour);
- class CColourPicker : public CButton
- {
- DECLARE_DYNCREATE(CColourPicker)
- // Construction
- public:
- CColourPicker();
- void SetBkColour(COLORREF crColourBk);
- COLORREF GetBkColour(){return m_crColourBk;}
- void SetTextColour(COLORREF crColourText);
- COLORREF GetTextColour(){return m_crColourText;}
- 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;}
- COLORREF GetColour()
- {
- return (m_nSelectionMode==CP_MODE_TEXT)?
- GetTextColour():GetBkColour();
- }
- void SetColour(COLORREF crColour)
- {
- (m_nSelectionMode==CP_MODE_TEXT)?
- SetTextColour(crColour):SetBkColour(crColour);
- }
- // Attributes
- public:
- // Operations
- public:
- // Overrides
- // ClassWizard generated virtual function overrides
- //{{AFX_VIRTUAL(CColourPicker)
- public:
- virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
- protected:
- virtual void PreSubclassWindow();
- //}}AFX_VIRTUAL
- // Implementation
- public:
- void SetWindowSize();
- virtual ~CColourPicker();
- afx_msg LONG OnSelEndOK(UINT lParam, LONG wParam);
- afx_msg LONG OnSelEndCancel(UINT lParam, LONG wParam);
- afx_msg LONG OnSelChange(UINT lParam, LONG wParam);
- // Generated message map functions
- protected:
- BOOL m_bActive,
- m_bTrackSelection;
- COLORREF m_crColourBk;
- COLORREF m_crColourText;
- UINT m_nSelectionMode;
- CRect m_ArrowRect;
- CString m_strText;
- //{{AFX_MSG(CColourPicker)
- afx_msg void OnClicked();
- afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
- };
- /////////////////////////////////////////////////////////////////////////////
- //{{AFX_INSERT_LOCATION}}
- // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
- #endif // !defined(AFX_COLOURPICKER_H__9200FF1E_28AB_41F3_A870_84A72BEDA649__INCLUDED_)