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

COptionTree

Rate me:
Please Sign up or sign in to vote.
4.95/5 (103 votes)
19 Sep 20025 min read 1.4M   15.8K   316  
An article on an easy and neat way to include options, preferences, or settings into your applications
// COptionTree
//
// License
// -------
// This code is provided "as is" with no expressed or implied warranty.
// 
// You may use this code in a commercial product with or without acknowledgement.
// However you may not sell this code or any modification of this code.
//
// I would appreciate a notification of any bugs to help the control grow.
//
// History:
// --------
//	See License.txt for full history information.
//
//
// Copyright (c) 1999-2002 
// ComputerSmarts.net 
// mattrmiller@computersmarts.net


#ifndef OT_FONTSEL_COLORBUTTON
#define OT_FONTSEL_COLORBUTTON
#pragma once

#ifndef OT_COLORPOPUP
	#include "OptionTreeColorPopUp.h"
#endif

void AFXAPI DDX_FontSelColorButton(CDataExchange *pDX, int nIDC, COLORREF& crColor);

class COptionTreeFontSelColorButton : public CButton
{
public:
	DECLARE_DYNCREATE(COptionTreeFontSelColorButton);

	COptionTreeFontSelColorButton();
	virtual ~COptionTreeFontSelColorButton();	
	COLORREF GetColor() const;
	void SetColor(COLORREF crColor);
	COLORREF GetDefaultColor() const;
	void SetDefaultColor(COLORREF crColor);
	void SetCustomText(LPCTSTR tszText);
	void SetDefaultText(LPCTSTR tszText);
	void SetTrackSelection(BOOL bTrack);
	BOOL GetTrackSelection() const;

	//{{AFX_VIRTUAL(COptionTreeFontSelColorButton)
    public:
    virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
    protected:
    virtual void PreSubclassWindow();
    //}}AFX_VIRTUAL

protected:
	//{{AFX_MSG(COptionTreeFontSelColorButton)
    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);
	static void DrawArrow(CDC* pDC, RECT* pRect, int nDirection = 0, COLORREF crArrow = RGB(0, 0, 0));


	DECLARE_MESSAGE_MAP()

	COLORREF m_crColor;
	COLORREF m_crDefaultColor;
	CString m_strDefaultText;
	CString m_strCustomText;
	BOOL m_bPopupActive;
	BOOL m_bTrackSelection;

private:

	typedef CButton _Inherited;

};

#endif //!OT_FONTSEL_COLORBUTTON

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
Web Developer
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions