home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 21 / IOPROG_21.ISO / SOFT / DEMOT.ZIP / Src / Include / HyperLink.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-23  |  3.1 KB  |  102 lines

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