GME  13
ColourPicker.h
Go to the documentation of this file.
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 // ColourPicker.h : header file
00009 //
00010 // Written by Chris Maunder (chrismaunder@codeguru.com)
00011 // Extended by Alexander Bischofberger (bischofb@informatik.tu-muenchen.de)
00012 // Copyright (c) 1998.
00013 //
00014 // This code may be used in compiled form in any way you desire. This
00015 // file may be redistributed unmodified by any means PROVIDING it is 
00016 // not sold for profit without the authors written consent, and 
00017 // providing that this notice and the authors name is included. If 
00018 // the source code in  this file is used in any commercial application 
00019 // then a simple email would be nice.
00020 //
00021 // This file is provided "as is" with no expressed or implied warranty.
00022 // The author accepts no liability if it causes any damage whatsoever.
00023 // It's free - so you get what you pay for.
00024 
00025 #include "ColourPopup.h"
00026 
00028 // CColourPicker window
00029 
00030 void AFXAPI DDX_ColourPicker(CDataExchange *pDX, int nIDC, COLORREF& crColour);
00031 
00033 // CColourPicker window
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 // Construction
00041 public:
00042     CColourPicker();
00043     DECLARE_DYNCREATE(CColourPicker);
00044 
00045 // Attributes
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 // Operations
00066 public:
00067 
00068 // Overrides
00069     // ClassWizard generated virtual function overrides
00070     //{{AFX_VIRTUAL(CColourPicker)
00071     public:
00072     virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
00073     protected:
00074     virtual void PreSubclassWindow();
00075     //}}AFX_VIRTUAL
00076 
00077 // Implementation
00078 public:
00079     virtual ~CColourPicker();
00080 
00081 protected:
00082     void SetWindowSize();
00083 
00084 // protected attributes
00085 protected:
00086     BOOL     m_bActive,                // Is the dropdown active?
00087              m_bTrackSelection;        // track colour changes?
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     // Generated message map functions
00096 protected:
00097     //{{AFX_MSG(CColourPicker)
00098     afx_msg BOOL OnClicked();
00099     afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
00100     //}}AFX_MSG
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 //{{AFX_INSERT_LOCATION}}
00111 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
00112 
00113 #endif // !defined(AFX_COLOURPICKER_H__D0B75901_9830_11D1_9C0F_00A0243D1382__INCLUDED_)