Click here to Skip to main content
15,895,746 members
Articles / Desktop Programming / MFC

CColorChooser an IDE style Color Picker

Rate me:
Please Sign up or sign in to vote.
4.70/5 (11 votes)
4 Oct 20011 min read 59.7K   2K   29  
CColorChooser an IDE style Color Picker
/////////////////////////////////////////////////////////////////////////////
//
// Disclaimer Notice
// ------------------
// The Author cannot guarantee this software is error free.
// The author also disclaims all responsibility for damages or 
// loss of profits caused by the failure of this software
//. Your usage of these modifications indicates your willingness to 
// accept complete responsibility.
//
//
// Developed by: Norm Almond for www.codeproject.com 
//
// Please use this software freely, if you fix or make any modifications to
// the software you can let me know so I can improve future versions.
//
// Version 1.00 - First Released 03 March 2001
//
/////////////////////////////////////////////////////////////////////////////


#if !defined(AFX_COLORCHOOSER_H__D0F786BD_F34A_4798_88BB_B2E3DD1DC78C__INCLUDED_)
#define AFX_COLORCHOOSER_H__D0F786BD_F34A_4798_88BB_B2E3DD1DC78C__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// ColorChooser.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// CColorChooser window

#include "PaletteWnd.h"
#include "SysColorWnd.h"
#include "WebColorWnd.h"

// Mask use for detect system color - sets COLORREF hi order bit
#define		SYSTEM_COLOR_MASK		0x80000000
#define		WEB_COLOR_MASK			0x40000000


#define		COLOR_CHANGED			0x0001


typedef struct tagCOLOR_NOTIFY 
{
    NMHDR   hdr;
    COLORREF color;
} COLOR_NOTIFY;



class CColorChooser : public CWnd
{
// Construction
public:
	CColorChooser();
	CColorChooser(CPoint pt, CWnd *pWnd, COLORREF crCurrent);

protected:

	CTabCtrl		m_wndTab;
	CPaletteWnd		m_wndPalette;
	CSysColorWnd	m_wndSysColor;
	CWebColorWnd	m_wndWebColor;
	CWnd*			m_pWndParent;
	CWnd*			m_pWndSelect;
// Attributes
public:

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CColorChooser)
	public:
	protected:
	//}}AFX_VIRTUAL

// Implementation
public:
	BOOL Create(CPoint pt, CWnd* pWnd, COLORREF crCurrent);

	virtual ~CColorChooser();

	// Generated message map functions
protected:
	//{{AFX_MSG(CColorChooser)
	afx_msg void OnSelchangeTab(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnPaletteColorChange(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnSystemColorChange(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnWebColorChange(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnKillFocus(CWnd* pNewWnd);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_COLORCHOOSER_H__D0F786BD_F34A_4798_88BB_B2E3DD1DC78C__INCLUDED_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Software Developer (Senior) Software Kinetics
United Kingdom United Kingdom




Software Kinetics
are experts in developing customised and bespoke applications and have expertise in the development of desktop, mobile and internet applications on Windows.


We specialise in:

  • User Interface Design
  • Desktop Development
  • Windows Phone Development
  • Windows Presentation Framework
  • Windows Forms
  • Windows Communication Framework
  • Windows Services
  • Network Applications
  • Database Applications
  • Web Development
  • Web Services
  • Silverlight
  • ASP.net


Visit Software Kinetics

Comments and Discussions