OSDN Git Service

add Utils
[tortoisegit/TortoiseGitJp.git] / Utils / MiscUI / Tooltip.h
diff --git a/Utils/MiscUI/Tooltip.h b/Utils/MiscUI/Tooltip.h
new file mode 100644 (file)
index 0000000..641efc4
--- /dev/null
@@ -0,0 +1,74 @@
+// TortoiseSVN - a Windows shell extension for easy version control\r
+\r
+// Copyright (C) 2008 - TortoiseSVN\r
+\r
+// This program is free software; you can redistribute it and/or\r
+// modify it under the terms of the GNU General Public License\r
+// as published by the Free Software Foundation; either version 2\r
+// of the License, or (at your option) any later version.\r
+\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software Foundation,\r
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\r
+//\r
+#pragma once\r
+\r
+\r
+\r
+\r
+/**\r
+ * \ingroup Utils\r
+ * Extends the MFC CToolTipCtrl with convenience methods for dialogs and\r
+ * provides mechanism to use tooltips longer than 80 chars whithout having\r
+ * to implement the TTN_NEEDTEXT handler in every dialog.\r
+ */\r
+class CToolTips : public CToolTipCtrl\r
+{\r
+// Construction\r
+public:\r
+       virtual BOOL Create(CWnd* pParentWnd, DWORD dwStyle = 0) \r
+       { \r
+               m_pParentWnd = pParentWnd;\r
+               m_pParentWnd->EnableToolTips();\r
+               BOOL bRet = CToolTipCtrl::Create(pParentWnd, dwStyle);\r
+               SetMaxTipWidth(600);\r
+               return bRet;\r
+       }\r
+       CToolTips() : CToolTipCtrl(), m_pParentWnd(NULL) {}\r
+       virtual ~CToolTips() {}\r
+\r
+       BOOL AddTool(CWnd* pWnd, UINT nIDText, LPCRECT lpRectTool = NULL, UINT_PTR nIDTool = 0);\r
+       BOOL AddTool(CWnd* pWnd, LPCTSTR lpszText = LPSTR_TEXTCALLBACK, LPCRECT lpRectTool = NULL, UINT_PTR nIDTool = 0);\r
+       void AddTool(int nIdWnd, UINT nIdText, LPCRECT lpRectTool = NULL, UINT_PTR nIDTool = 0);\r
+       void AddTool(int nIdWnd, CString sBalloonTipText, LPCRECT lpRectTool = NULL, UINT_PTR nIDTool = 0);\r
+\r
+       DECLARE_MESSAGE_MAP()\r
+       afx_msg BOOL OnTtnNeedText(NMHDR *pNMHDR, LRESULT *pResult);\r
+\r
+private:\r
+       CWnd *  m_pParentWnd;\r
+       std::map<UINT, CString>         toolTextMap;\r
+};\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r