00001 #if !defined(AFX_COLOURPICKER_H__D0B75901_9830_11D1_9C0F_00A0243D1382__INCLUDED_)
00002 #define AFX_COLOURPICKER_H__D0B75901_9830_11D1_9C0F_00A0243D1382__INCLUDED_
00003
00004 #if _MSC_VER >= 1000
00005 #pragma once
00006 #endif // _MSC_VER >= 1000
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "ColourPopup.h"
00026
00028
00029
00030 void AFXAPI DDX_ColourPicker(CDataExchange *pDX, int nIDC, COLORREF& crColour);
00031
00033
00034
00035 #define CP_MODE_TEXT 1 // edit text colour
00036 #define CP_MODE_BK 2 // edit background colour (default)
00037
00038 class CColourPicker : public CButton
00039 {
00040
00041 public:
00042 CColourPicker();
00043 DECLARE_DYNCREATE(CColourPicker);
00044
00045
00046 public:
00047 COLORREF GetColour();
00048 void SetColour(COLORREF crColour);
00049
00050 void SetDefaultText(LPCTSTR szDefaultText);
00051 void SetCustomText(LPCTSTR szCustomText);
00052
00053 void SetTrackSelection(BOOL bTracking = TRUE) { m_bTrackSelection = bTracking; }
00054 BOOL GetTrackSelection() { return m_bTrackSelection; }
00055
00056 void SetSelectionMode(UINT nMode) { m_nSelectionMode = nMode; }
00057 UINT GetSelectionMode() { return m_nSelectionMode; };
00058
00059 void SetBkColour(COLORREF crColourBk);
00060 COLORREF GetBkColour() { return m_crColourBk; }
00061
00062 void SetTextColour(COLORREF crColourText);
00063 COLORREF GetTextColour() { return m_crColourText;}
00064
00065
00066 public:
00067
00068
00069
00070
00071 public:
00072 virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
00073 protected:
00074 virtual void PreSubclassWindow();
00075
00076
00077
00078 public:
00079 virtual ~CColourPicker();
00080
00081 protected:
00082 void SetWindowSize();
00083
00084
00085 protected:
00086 BOOL m_bActive,
00087 m_bTrackSelection;
00088 COLORREF m_crColourBk;
00089 COLORREF m_crColourText;
00090 UINT m_nSelectionMode;
00091 CRect m_ArrowRect;
00092 CString m_strDefaultText;
00093 CString m_strCustomText;
00094
00095
00096 protected:
00097
00098 afx_msg BOOL OnClicked();
00099 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
00100
00101 afx_msg LONG OnSelEndOK(UINT lParam, LONG wParam);
00102 afx_msg LONG OnSelEndCancel(UINT lParam, LONG wParam);
00103 afx_msg LONG OnSelChange(UINT lParam, LONG wParam);
00104
00105 DECLARE_MESSAGE_MAP()
00106 };
00107
00109
00110
00111
00112
00113 #endif // !defined(AFX_COLOURPICKER_H__D0B75901_9830_11D1_9C0F_00A0243D1382__INCLUDED_)