Click here to Skip to main content
15,896,487 members
Articles / Desktop Programming / MFC

Enhancements of Matthew R. Millers COptionTree

Rate me:
Please Sign up or sign in to vote.
4.76/5 (15 votes)
26 Apr 2006CPOL3 min read 120.5K   2.6K   58  
This article demonstrates an enhanced version of Matthew R. Millers Option Tree
// 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, this includes 
// commercial libraries and anything else for profit.
//
// I would appreciate a notification of any bugs or bug fixes to help the control grow.
//
// History:
// --------
//	See License.txt for full history information.
//
//
// Copyright (c) 1999-2002 
// ComputerSmarts.net 
// mattrmiller@computersmarts.net

#ifndef OT_ITEMHYPERLINK
#define OT_ITEMFONT

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

// Added Headers
#include "CommonRes.h"
#include "OptionTreeDef.h"
#include "OptionTreeItem.h"
#include "OptionTreeFontSel.h"

/////////////////////////////////////////////////////////////////////////////
// COptionTreeItemHyperLink window

class COptionTreeItemHyperLink : public CWnd, public COptionTreeItem
{
// Construction
public:
	COptionTreeItemHyperLink();
	virtual void OnMove();
	virtual void OnRefresh();
	virtual void OnCommit();
	virtual void OnActivate();
	virtual void CleanDestroyWindow();
	virtual void OnDeSelect();
	virtual void OnSelect();
	virtual void DrawAttribute(CDC *pDC, const RECT &rcRect);
	virtual void OnExpand(BOOL bExpand);
  virtual void OnShow(BOOL bShow);
  virtual CString GetAttributeText(void);

// Attributes
public:

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(COptionTreeItemHyperLink)
	//}}AFX_VIRTUAL

// Implementation
public:
	void SetVisited(BOOL bVisited);
	void SetLink(CString strLink);
	CString GetLink();
	COLORREF GetVisitedColor();
	COLORREF GetHoverColor();
	COLORREF GetLinkColor();
	void SetVisitedColor(COLORREF crColor);
	void SetHoverColor(COLORREF crColor);
	void SetLinkColor(COLORREF crColor);
	BOOL GetVisited();
	HCURSOR GetLinkCursor();
	void SetLinkCursor(HCURSOR hCursor);
	BOOL CreateHyperlinkItem(DWORD dwOptions, CString strLink, COLORREF crLink, COLORREF crHover = NULL, COLORREF crVisited = NULL);
	virtual ~COptionTreeItemHyperLink();

	// Generated message map functions
protected:
	BOOL m_bFocus;
	void SetDefaultCursor();
	COLORREF m_crLink;
	COLORREF m_crHover;
	COLORREF m_crVisited;
	BOOL m_bVisited;
	CString m_strLink;
	HCURSOR  m_hLinkCursor;
	CRect m_rcHover;
	BOOL m_bHover;
	CFont m_fUnderlineFont;
	//{{AFX_MSG(COptionTreeItemHyperLink)
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg void OnPaint();
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnKillFocus(CWnd* pNewWnd);
	afx_msg void OnSetFocus(CWnd* pOldWnd);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

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

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

#endif // !OT_ITEMHYPERLINK

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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
Germany Germany
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions