OSDN Git Service

Linked with static version of CRT/MFC.
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / Settings / SettingsPropPage.h
1 // TortoiseSVN - a Windows shell extension for easy version control\r
2 \r
3 // Copyright (C) 2007-2008 - TortoiseSVN\r
4 \r
5 // This program is free software; you can redistribute it and/or\r
6 // modify it under the terms of the GNU General Public License\r
7 // as published by the Free Software Foundation; either version 2\r
8 // of the License, or (at your option) any later version.\r
9 \r
10 // This program is distributed in the hope that it will be useful,\r
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of\r
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
13 // GNU General Public License for more details.\r
14 \r
15 // You should have received a copy of the GNU General Public License\r
16 // along with this program; if not, write to the Free Software Foundation,\r
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\r
18 //\r
19 #pragma once\r
20 \r
21 /**\r
22  * \ingroup TortoiseProc\r
23  * Base class for all the settings property pages\r
24  */\r
25 class ISettingsPropPage : public CPropertyPage\r
26 {\r
27         DECLARE_DYNAMIC(ISettingsPropPage)\r
28 public:\r
29         // simple construction\r
30         ISettingsPropPage();\r
31         explicit ISettingsPropPage(UINT nIDTemplate, UINT nIDCaption = 0, DWORD dwSize = sizeof(PROPSHEETPAGE));\r
32         explicit ISettingsPropPage(LPCTSTR lpszTemplateName, UINT nIDCaption = 0, DWORD dwSize = sizeof(PROPSHEETPAGE));\r
33 \r
34         // extended construction\r
35         ISettingsPropPage(UINT nIDTemplate, UINT nIDCaption, \r
36                 UINT nIDHeaderTitle, UINT nIDHeaderSubTitle = 0, DWORD dwSize = sizeof(PROPSHEETPAGE));\r
37         ISettingsPropPage(LPCTSTR lpszTemplateName, UINT nIDCaption, \r
38                 UINT nIDHeaderTitle, UINT nIDHeaderSubTitle = 0, DWORD dwSize = sizeof(PROPSHEETPAGE));\r
39 \r
40         virtual ~ISettingsPropPage();\r
41 \r
42         enum SettingsRestart\r
43         {\r
44                 Restart_None = 0,\r
45                 Restart_System = 1,\r
46                 Restart_Cache = 2\r
47         };\r
48 \r
49         /**\r
50          * Returns the icon ID\r
51          */\r
52         virtual UINT GetIconID() = 0;\r
53 \r
54         /**\r
55          * Returns the restart code\r
56          */\r
57         virtual SettingsRestart GetRestart() {return m_restart;}\r
58 \r
59 protected:\r
60 \r
61         SettingsRestart m_restart;\r
62 \r
63     /**\r
64      * Utility method:\r
65      * Store the current value of a BOOL, DWORD or CString into the\r
66      * respective CRegDWORD etc. and check for success.\r
67      */\r
68 \r
69     template<class T, class Reg>\r
70     void Store (const T& value, Reg& registryKey)\r
71     {\r
72         registryKey = value;\r
73             if (registryKey.LastError != ERROR_SUCCESS)\r
74                     CMessageBox::Show (m_hWnd, registryKey.getErrorString(), _T("TortoiseSVN"), MB_ICONERROR);\r
75     }\r
76 };\r