Use angle brackets for system headers
[TortoiseGit.git] / src / Utils / MiscUI / hyperlink_base.h
blobfd5796fef9beee400dd99c7c4efdc4eaf6c11c13
1 /*
2 * Module ID: hyperlink.h
3 * Title : CHyperLink Declaration.
5 * Author : Olivier Langlois <olanglois@sympatico.ca>
6 * Date : November 15, 2005
8 * To read the article describing this class, visit
9 * http://www3.sympatico.ca/olanglois/hyperlinkdemo.htm
11 * Note: Strongly inspired by Neal Stublen code
12 * Minor ideas come from Chris Maunder and Paul DiLascia code
14 * Revision :
16 * 001 26-Nov-2005 - Olivier Langlois
17 * - Added changes to make CHyperLink compatible with UNICODE
18 * - Use dynamic memory allocation for the URL string
21 #ifndef _HYPERLINK_H_
22 #define _HYPERLINK_H_
24 #include <Windows.h>
26 class CHyperLink
28 public:
29 CHyperLink(void);
30 virtual ~CHyperLink(void);
32 BOOL ConvertStaticToHyperlink(HWND hwndCtl, LPCTSTR strURL);
33 BOOL ConvertStaticToHyperlink(HWND hwndParent, UINT uiCtlId, LPCTSTR strURL);
35 BOOL setURL( LPCTSTR strURL);
36 LPCTSTR getURL(void) const { return m_strURL; }
38 protected:
40 * Override if you want to perform some action when the link has the focus
41 * or when the cursor is over the link such as displaying the URL somewhere.
43 virtual void OnSelect(void) {}
44 virtual void OnDeselect(void) {}
46 LPTSTR m_strURL; // hyperlink URL
48 private:
49 static COLORREF g_crLinkColor, g_crVisitedColor;// Hyperlink colors
50 static HCURSOR g_hLinkCursor; // Cursor for hyperlink
51 static HFONT g_UnderlineFont; // Font for underline display
52 static int g_counter; // Global resources user counter
53 BOOL m_bOverControl; // cursor over control?
54 BOOL m_bVisited; // Has it been visited?
55 HFONT m_StdFont; // Standard font
56 WNDPROC m_pfnOrigCtlProc;
58 void createUnderlineFont(void);
59 static void createLinkCursor(void);
60 void createGlobalResources(void)
62 createUnderlineFont();
63 createLinkCursor();
65 static void destroyGlobalResources(void)
68 * No need to call DestroyCursor() for cursors acquired through
69 * LoadCursor().
71 g_hLinkCursor = NULL;
72 DeleteObject(g_UnderlineFont);
73 g_UnderlineFont = NULL;
76 void Navigate(void);
78 static void DrawFocusRect(HWND hwnd);
79 static LRESULT CALLBACK _HyperlinkParentProc(HWND hwnd, UINT message,
80 WPARAM wParam, LPARAM lParam);
81 static LRESULT CALLBACK _HyperlinkProc(HWND hwnd, UINT message,
82 WPARAM wParam, LPARAM lParam);
85 #endif /* _HYPERLINK_H_ */