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