www.pudn.com > mu_explorer.rar > BBHyperLink.h


#if !defined(AFX_BBHYPERLINK_H__5C16B427_F8FA_4F6A_8A9D_6BB7F9D33B56__INCLUDED_) 
#define AFX_BBHYPERLINK_H__5C16B427_F8FA_4F6A_8A9D_6BB7F9D33B56__INCLUDED_ 
 
#if _MSC_VER > 1000 
#pragma once 
#endif // _MSC_VER > 1000 
// BBHyperLink.h : header file 
// 
 
///////////////////////////////////////////////////////////////////////////// 
// CBBHyperLink window 
 
/* 
 
 
 
  超级连接控件 
  整理设计:邓振波 
  时间:2001.5.8 
  E-Mail:bozi@china.com 
  功能:一个功能齐全的超级连接控件, 
		支持各种状态下的颜色(鼠标进入、离开、点击后)、 
		字体、字形(斜体、下划线)、鼠标形状、提示信息 
		具体使用参见示例,跟普通的控件使用一样 
 
 
 
*/ 
///////////////////////////////////////////////////////////////////////////// 
// CBBHyperLink window 
 
class CBBHyperLink : public CStatic 
{ 
	DECLARE_DYNAMIC(CBBHyperLink) 
 
public: 
// 连接控件的风格 
	static const DWORD STYLEUNDERLINE; 
	static const DWORD STYLEUSEHOVER; 
	static const DWORD STYLEAUTOSIZE; 
	static const DWORD STYLEDOWNCLICK; 
	static const DWORD STYLEGETFOCUSONCLICK; 
	static const DWORD STYLENOHANDCURSOR; 
	static const DWORD STYLENOACTIVECOLOR; 
 
// Construction/destruction 
	CBBHyperLink(); 
	virtual ~CBBHyperLink(); 
 
// Attributes 
public: 
 
// Operations 
public:	 
	static void GetColors(COLORREF	&crLink,COLORREF &crActive,COLORREF	&crVisited,COLORREF	&crHover); 
 
	static HCURSOR GetLinkCursor(); 
	static void SetLinkCursor(HCURSOR hCursor); 
     
    static void SetColors(COLORREF crLinkColor, COLORREF crActiveColor,  
				   COLORREF crVisitedColor, COLORREF crHoverColor = -1); 
 
	void SetURL(CString strURL); 
    CString GetURL() const; 
 
	DWORD GetLinkStyle() const; 
	BOOL ModifyLinkStyle(DWORD dwRemove, DWORD dwAdd, BOOL bApply=TRUE);	 
     
	void SetWindowText(LPCTSTR lpszText); 
	void SetFont(CFont *pFont); 
	 
	BOOL IsVisited() const; 
	void SetVisited(BOOL bVisited = TRUE); 
	 
	//如果你想SubClass,可以使用该函数并设置URL 
	BOOL SubclassDlgItem(UINT nID, CWnd* pParent, LPCTSTR lpszURL=NULL)  
	{ 
		m_strURL = lpszURL; 
		return CStatic::SubclassDlgItem(nID, pParent); 
	} 
 
// Overrides 
	// ClassWizard generated virtual function overrides 
	//{{AFX_VIRTUAL(CBBHyperLink) 
	public: 
	virtual BOOL PreTranslateMessage(MSG* pMsg);	 
	protected: 
	virtual void PreSubclassWindow();	 
	//}}AFX_VIRTUAL 
 
// Implementation 
protected: 
	static void SetDefaultCursor(); 
	static HINSTANCE GotoURL(LPCTSTR url, int showcmd); 
 
	void AdjustWindow();	 
	void FollowLink(); 
	inline void SwitchUnderline(); 
	 
// Protected attributes 
protected: 
	static COLORREF m_crLinkColor;		// 通常颜色 
	static COLORREF m_crActiveColor;	// 连接活动颜色 
	static COLORREF m_crVisitedColor;	// 浏览过颜色 
	static COLORREF m_crHoverColor;		// 掠过颜色 
	static HCURSOR  m_hLinkCursor;		// 鼠标形状 
 
	BOOL	 m_bLinkActive;				// 是否活动 
	BOOL     m_bOverControl;			// 是否鼠标掠过 
	BOOL	 m_bVisited;				// 是否可见 
	DWORD	 m_dwStyle;					// 风格 
	CString  m_strURL;					// 连接的目标URL 
	CFont    m_Font;					// 下划线 
	CToolTipCtrl m_ToolTip;				// 工具提示 
 
	// Generated message map functions 
protected: 
	//{{AFX_MSG(CBBHyperLink) 
	afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor); 
	afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message); 
	afx_msg void OnMouseMove(UINT nFlags, CPoint point); 
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point); 
	afx_msg void OnSetFocus(CWnd* pOldWnd); 
	afx_msg void OnKillFocus(CWnd* pNewWnd); 
	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); 
	afx_msg UINT OnNcHitTest(CPoint point); 
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point); 
	//}}AFX_MSG 
	DECLARE_MESSAGE_MAP() 
}; 
 
///////////////////////////////////////////////////////////////////////////// 
 
//{{AFX_INSERT_LOCATION}} 
// Microsoft Visual C++ will insert additional declarations immediately before the previous line. 
 
#endif // !defined(AFX_BBHYPERLINK_H__5C16B427_F8FA_4F6A_8A9D_6BB7F9D33B56__INCLUDED_)