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