Doxygen docu fixes: list all parameters, fix parameter names in doxygen comments...
[TortoiseGit.git] / src / Utils / MiscUI / BrowseFolder.h
blob97bc890d05c57b849dc7162407452ab9af33d2a1
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2003-2008, 2010, 2013 - 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 on XP.
24 * On Vista and later, the IFileDialog is used with the FOS_PICKFOLDERS flag.
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 * \param sDefaultPath [in]
56 * \return one of CANCEL, NOPATH or OK
58 CBrowseFolder::retVal Show(HWND parent, CString& path, const CString& sDefaultPath = CString());
59 CBrowseFolder::retVal Show(HWND parent, LPTSTR path, size_t pathlen, LPCTSTR szDefaultPath = NULL);
61 /**
62 * If this is set to true, then the second checkbox gets disabled as soon as the first
63 * checkbox is checked. If the first checkbox is unchecked, then the second checkbox is enabled
64 * again.
66 void DisableCheckBox2WhenCheckbox1IsEnabled(bool bSet = true) {m_DisableCheckbox2WhenCheckbox1IsChecked = bSet;}
68 static BOOL m_bCheck; ///< state of the checkbox on closing the dialog
69 static BOOL m_bCheck2;
70 TCHAR m_title[200];
71 protected:
72 static void SetFont(HWND hwnd,LPTSTR FontName,int FontSize);
74 static int CALLBACK BrowseCallBackProc(HWND hwnd,UINT uMsg,LPARAM lParam,LPARAM lpData);
75 static LRESULT APIENTRY CheckBoxSubclassProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam);
76 static LRESULT APIENTRY CheckBoxSubclassProc2(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam);
78 static WNDPROC CBProc;
79 static HWND checkbox;
80 static HWND checkbox2;
81 static HWND ListView;
82 static CString m_sDefaultPath;
83 TCHAR m_displayName[200];
84 LPITEMIDLIST m_root;
85 static TCHAR m_CheckText[200];
86 static TCHAR m_CheckText2[200];
87 static bool m_DisableCheckbox2WhenCheckbox1IsChecked;