OSDN Git Service

Change Dir Structure to be same as TortoiseSVN'
[tortoisegit/TortoiseGitJp.git] / src / Utils / MiscUI / BrowseFolder.h
1 // TortoiseSVN - a Windows shell extension for easy version control\r
2 \r
3 // Copyright (C) 2003-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 Utils\r
23  * A simple wrapper class for the SHBrowseForFolder API.\r
24  * Help-Link: ms-help://MS.VSCC/MS.MSDNVS/shellcc/platform/Shell/Functions/SHBrowseForFolder.htm\r
25  */\r
26 class CBrowseFolder\r
27 {\r
28 public:\r
29         enum retVal\r
30         {\r
31                 CANCEL = 0,             ///< the user has pressed cancel\r
32                 NOPATH,                 ///< no folder was selected\r
33                 OK                              ///< everything went just fine\r
34         };\r
35 public:\r
36         //constructor / deconstructor\r
37         CBrowseFolder(void);\r
38         ~CBrowseFolder(void);\r
39 public:\r
40         DWORD m_style;          ///< styles of the dialog.\r
41         /**\r
42          * Sets the info text of the dialog. Call this method before calling Show().\r
43          */\r
44         void SetInfo(LPCTSTR title);\r
45         /*\r
46          * Sets the text to show for the checkbox. If this method is not called,\r
47          * then no checkbox is added.\r
48          */\r
49         void SetCheckBoxText(LPCTSTR checktext);\r
50         void SetCheckBoxText2(LPCTSTR checktext);\r
51         /**\r
52          * Shows the Dialog. \r
53          * \param parent [in] window handle of the parent window.\r
54          * \param path [out] the path to the folder which the user has selected \r
55          * \return one of CANCEL, NOPATH or OK\r
56          */\r
57         CBrowseFolder::retVal Show(HWND parent, CString& path, const CString& sDefaultPath = CString());\r
58         CBrowseFolder::retVal Show(HWND parent, LPTSTR path, size_t pathlen, LPCTSTR szDefaultPath = NULL);\r
59 \r
60         /**\r
61          * If this is set to true, then the second checkbox gets disabled as soon as the first\r
62          * checkbox is checked. If the first checkbox is unchecked, then the second checkbox is enabled\r
63          * again.\r
64          */\r
65         void DisableCheckBox2WhenCheckbox1IsEnabled(bool bSet = true) {m_DisableCheckbox2WhenCheckbox1IsChecked = bSet;}\r
66 \r
67         static BOOL m_bCheck;           ///< state of the checkbox on closing the dialog\r
68         static BOOL m_bCheck2;\r
69         TCHAR m_title[200];\r
70 protected:\r
71         static void SetFont(HWND hwnd,LPTSTR FontName,int FontSize);\r
72 \r
73         static int CALLBACK BrowseCallBackProc(HWND  hwnd,UINT  uMsg,LPARAM  lParam,LPARAM  lpData);\r
74         static LRESULT APIENTRY CheckBoxSubclassProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam);\r
75         static LRESULT APIENTRY CheckBoxSubclassProc2(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam);\r
76                 \r
77         static WNDPROC CBProc;\r
78         static HWND checkbox;\r
79         static HWND checkbox2;\r
80         static HWND ListView;\r
81         static CString m_sDefaultPath;\r
82         TCHAR m_displayName[200];\r
83         LPITEMIDLIST m_root;\r
84         static TCHAR m_CheckText[200];\r
85         static TCHAR m_CheckText2[200];\r
86         static bool m_DisableCheckbox2WhenCheckbox1IsChecked;\r
87 };\r