Allow to put URLs into "<>" and allow spaces and other chars there (as the RichEdit...
[TortoiseGit.git] / src / Utils / MiscUI / LinkControl.h
blobbfcba517aac84c595fb628f8a0bb8f10283e1261
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2009, 2012 - TortoiseSVN
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software Foundation,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #pragma once
20 #include <Windows.h>
22 class CLinkControl
24 public:
25 CLinkControl(void);
26 virtual ~CLinkControl(void);
28 bool ConvertStaticToLink(HWND hwndCtl);
29 bool ConvertStaticToLink(HWND hwndParent, UINT uiCtlId);
31 static const UINT LK_LINKITEMCLICKED;
33 protected:
34 private:
35 static HCURSOR g_hLinkCursor; // Cursor for hyperlink
36 static HFONT g_UnderlineFont; // Font for underline display
37 static HFONT g_NormalFont; // Font for default display
38 static int g_counter; // Global resources user counter
39 bool m_bOverControl; // cursor over control?
40 bool m_bMouseDownPressed; // was WM_LBUTTONDOWN received?
41 HFONT m_StdFont; // Standard font
42 WNDPROC m_pfnOrigCtlProc;
44 void createUnderlineFont(void);
45 static void createLinkCursor(void);
46 void createGlobalResources(void)
48 createUnderlineFont();
49 createLinkCursor();
51 static void destroyGlobalResources(void)
54 * No need to call DestroyCursor() for cursors acquired through
55 * LoadCursor().
57 g_hLinkCursor = NULL;
58 DeleteObject(g_UnderlineFont);
59 g_UnderlineFont = NULL;
62 static void DrawFocusRect(HWND hwnd);
63 static LRESULT CALLBACK _HyperlinkParentProc(HWND hwnd, UINT message,
64 WPARAM wParam, LPARAM lParam);
65 static LRESULT CALLBACK _HyperlinkProc(HWND hwnd, UINT message,
66 WPARAM wParam, LPARAM lParam);