Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
CHyperLink.h
Go to the documentation of this file.
1 //
6 //
7 
8 #ifndef _INC_CHyperLink_H
9 #define _INC_CHyperLink_H
10 #ifndef NO_PRAGMA_ONCE
11 #pragma once
12 #endif
13 
14 #include "../GrayLibBase.h"
15 #ifdef _MFC_VER
16 #include "../Geometry/cRectI.h"
18 
19 namespace GrayLib
20 {
21  class CHyperLink : public CStatic
22  {
25 
26  typedef CStatic SUPER_t;
27 
28  public:
29  CHyperLink();
30  virtual ~CHyperLink();
31 
32  public:
33  enum UnderLine_TYPE
34  {
35  UL_Hover = -1, UL_None = 0, UL_Always = 1
36  };
37 
38  public:
39  void SetURL(cString strURL);
40  cString GetURL() const
41  {
42  return m_strURL;
43  }
44 
45  void SetColours(COLORREF crLinkColour, COLORREF crVisitedColour, COLORREF crHoverColour = -1);
46  COLORREF GetLinkColour() const
47  {
48  return m_crLinkColour;
49  }
50  COLORREF GetVisitedColour() const
51  {
52  return m_crVisitedColour;
53  }
54  COLORREF GetHoverColour() const
55  {
56  return m_crHoverColour;
57  }
58 
59  void SetVisited(BOOL bVisited = true);
60  BOOL GetVisited() const
61  {
62  return m_bVisited;
63  }
64 
65  void SetLinkCursor(HCURSOR hCursor);
66  HCURSOR GetLinkCursor() const
67  {
68  return m_hLinkCursor;
69  }
70 
71  void SetUnderline(UnderLine_TYPE nUnderline = UL_Hover);
72  UnderLine_TYPE GetUnderline() const
73  {
74  return m_nUnderline;
75  }
76 
77  void SetAutoSize(BOOL bAutoSize = true);
78  BOOL GetAutoSize() const
79  {
80  return m_bAdjustToFit;
81  }
82 
83  // Overrides
84  // ClassWizard generated virtual function overrides
85  //{{AFX_VIRTUAL(CHyperLink)
86  public:
87  virtual BOOL PreTranslateMessage(MSG* pMsg);
88  virtual BOOL DestroyWindow();
89  protected:
90  virtual void PreSubclassWindow();
91  //}}AFX_VIRTUAL
92 
93  // Implementation
94  protected:
95  void ReportError(HRESULT nError);
96  void PositionWindow();
97  void SetDefaultCursor();
98 
99  // Protected attributes
100  protected:
101  // exposed params.
102  cString m_strURL;
103  COLORREF m_crLinkColour;
104  COLORREF m_crVisitedColour;
105  COLORREF m_crHoverColour;
106  BOOL m_bVisited;
107  UnderLine_TYPE m_nUnderline;
108  HCURSOR m_hLinkCursor;
109  BOOL m_bAdjustToFit;
110 
111  // internal vars.
112  CFont m_UnderlineFont;
113  CFont m_StdFont;
114  CToolTipCtrl m_ToolTip;
115  UINT m_nTimerID;
116  BOOL m_bOverControl;
117 
118  // Generated message map functions
119  protected:
120  //{{AFX_MSG(CHyperLink)
121  afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
122  afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
123  afx_msg void OnMouseMove(UINT nFlags, CPoint point);
124  afx_msg void OnTimer(UINT_PTR nIDEvent);
125  afx_msg BOOL OnEraseBkgnd(CDC* pDC);
126  //}}AFX_MSG
127  afx_msg void OnClicked();
128  DECLARE_MESSAGE_MAP()
129  };
130 };
131 
132 //*******************************************
133 //{{AFX_INSERT_LOCATION}}
134 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
135 
136 #endif // _INC_CHyperLink_H
137 #endif
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
UINT32 COLORREF
ABGR (high to low bits)
Definition: cVariantData.h:21
Definition: cMesh.h:22
cWndHandle CWnd
Definition: cWndHandle.h:669
cPoint2i CPoint
Compatible with MFC 2d CPoint,CRect.
Definition: cPoint2.h:65
cStringT< GChar_t > cString
Definition: cString.h:636