HyperLink.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. // HyperLink.h : header file
  2. //
  3. //
  4. // HyperLink static control. Will open the default browser with the given URL
  5. // when the user clicks on the link.
  6. //
  7. // Copyright Chris Maunder, 1997, 1998
  8. // Feel free to use and distribute. May not be sold for profit.
  9. #if !defined(AFX_HYPERLINK_H__D1625061_574B_11D1_ABBA_00A0243D1382__INCLUDED_)
  10. #define AFX_HYPERLINK_H__D1625061_574B_11D1_ABBA_00A0243D1382__INCLUDED_
  11. #if _MSC_VER >= 1000
  12. #pragma once
  13. #endif // _MSC_VER >= 1000
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CHyperLink window
  16. class CHyperLink : public CStatic
  17. {
  18. // Construction/destruction
  19. public:
  20. int m_nParent;
  21. BOOL m_bDisable;
  22. int m_fontsize;
  23. BOOL m_bBlackBk;
  24. CHyperLink();
  25. virtual ~CHyperLink();
  26. // Attributes
  27. public:
  28. // Operations
  29. public:
  30. void PositionWindow();
  31. void SetURL(CString strURL);
  32. CString GetURL() const;
  33. void SetColours(COLORREF crLinkColour, COLORREF crVisitedColour,
  34. COLORREF crHoverColour = -1);
  35. COLORREF GetLinkColour() const;
  36. COLORREF GetVisitedColour() const;
  37. COLORREF GetHoverColour() const;
  38. void SetVisited(BOOL bVisited = TRUE);
  39. BOOL GetVisited() const;
  40. void SetLinkCursor(HCURSOR hCursor);
  41. HCURSOR GetLinkCursor() const;
  42. void SetUnderline(BOOL bUnderline = TRUE);
  43. BOOL GetUnderline() const;
  44. void SetAutoSize(BOOL bAutoSize = TRUE);
  45. BOOL GetAutoSize() const;
  46. // Overrides
  47. // ClassWizard generated virtual function overrides
  48. //{{AFX_VIRTUAL(CHyperLink)
  49. public:
  50. virtual BOOL PreTranslateMessage(MSG* pMsg);
  51. protected:
  52. virtual void PreSubclassWindow();
  53. //}}AFX_VIRTUAL
  54. // Implementation
  55. protected:
  56. HINSTANCE GotoURL(LPCTSTR url, int showcmd);
  57. void ReportError(int nError);
  58. LONG GetRegKey(HKEY key, LPCTSTR subkey, LPTSTR retdata);
  59. void SetDefaultCursor();
  60. // Protected attributes
  61. protected:
  62. COLORREF m_crLinkColour, m_crVisitedColour; // Hyperlink colours
  63. COLORREF m_crHoverColour; // Hover colour
  64. BOOL m_bOverControl; // cursor over control?
  65. BOOL m_bVisited; // Has it been visited?
  66. BOOL m_bUnderline; // underline hyperlink?
  67. BOOL m_bAdjustToFit; // Adjust window size to fit text?
  68. CString m_strURL; // hyperlink URL
  69. CFont m_Font; // Underline font if necessary
  70. HCURSOR m_hLinkCursor; // Cursor for hyperlink
  71. CToolTipCtrl m_ToolTip; // The tooltip
  72. // Generated message map functions
  73. protected:
  74. //{{AFX_MSG(CHyperLink)
  75. afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
  76. afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
  77. afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  78. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  79. //}}AFX_MSG
  80. afx_msg void OnClicked();
  81. DECLARE_MESSAGE_MAP()
  82. };
  83. /////////////////////////////////////////////////////////////////////////////
  84. //{{AFX_INSERT_LOCATION}}
  85. // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
  86. #endif // !defined(AFX_HYPERLINK_H__D1625061_574B_11D1_ABBA_00A0243D1382__INCLUDED_)