OSDN Git Service

Change Dir Structure to be same as TortoiseSVN'
[tortoisegit/TortoiseGitJp.git] / src / Utils / MiscUI / BaseDialog.h
diff --git a/src/Utils/MiscUI/BaseDialog.h b/src/Utils/MiscUI/BaseDialog.h
new file mode 100644 (file)
index 0000000..bc03d90
--- /dev/null
@@ -0,0 +1,53 @@
+// TortoiseSVN - a Windows shell extension for easy version control\r
+\r
+// Copyright (C) 2003-2007 - Stefan Kueng\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
+#include <string>\r
+\r
+\r
+/**\r
+ * \ingroup Utils\r
+ * A base window class.\r
+ * Provides separate window message handlers for every window object based on\r
+ * this class.\r
+ */\r
+class CDialog\r
+{\r
+public:\r
+       INT_PTR DoModal(HINSTANCE hInstance, int resID, HWND hWndParent);\r
+    HWND    Create(HINSTANCE hInstance, int resID, HWND hWndParent);\r
+\r
+       virtual LRESULT CALLBACK DlgFunc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) = 0;\r
+\r
+       operator HWND() {return m_hwnd;}\r
+protected:\r
+       HINSTANCE hResource;\r
+       HWND m_hwnd;\r
+\r
+       void InitDialog(HWND hwndDlg, UINT iconID);\r
+\r
+       // the real message handler\r
+       static INT_PTR CALLBACK stDlgFunc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);\r
+\r
+       // returns a pointer the dialog (stored as the WindowLong)\r
+       inline static CDialog * GetObjectFromWindow(HWND hWnd)\r
+       {\r
+               return (CDialog *)GetWindowLongPtr(hWnd, GWLP_USERDATA);\r
+       }\r
+};\r
+\r