1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2003-2008, 2010 - 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.
23 * A simple wrapper class for the SHBrowseForFolder API on XP.
24 * On Vista and later, the IFileDialog is used with the FOS_PICKFOLDERS flag.
31 CANCEL
= 0, ///< the user has pressed cancel
32 NOPATH
, ///< no folder was selected
33 OK
///< everything went just fine
36 //constructor / deconstructor
40 DWORD m_style
; ///< styles of the dialog.
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
);
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
);
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
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
;
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
;
79 static HWND checkbox2
;
81 static CString m_sDefaultPath
;
82 TCHAR m_displayName
[200];
84 static TCHAR m_CheckText
[200];
85 static TCHAR m_CheckText2
[200];
86 static bool m_DisableCheckbox2WhenCheckbox1IsChecked
;