]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/dirdlg.h
Document wxHelpSearchMode enum and its values.
[wxWidgets.git] / interface / wx / dirdlg.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: dirdlg.h
e54c96f1 3// Purpose: interface of wxDirDialog
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
526954c5 6// Licence: wxWindows licence
23324ae1
FM
7/////////////////////////////////////////////////////////////////////////////
8
50e55c13
RD
9#define wxDD_DEFAULT_STYLE (wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
10
0b59366f
VZ
11/**
12 Initial folder for generic directory dialog.
13*/
14const char wxDirDialogDefaultFolderStr[] = "/";
15
16/**
17 Default message for directory selector dialog.
18*/
19const char wxDirSelectorPromptStr[] = "Select a directory";
20
21/**
22 Default name for directory selector dialog.
23*/
24const char wxDirDialogNameStr[] = "wxDirCtrl";
25
23324ae1
FM
26/**
27 @class wxDirDialog
7c913512 28
23324ae1 29 This class represents the directory chooser dialog.
7c913512 30
23324ae1 31 @beginStyleTable
8c6791e4 32 @style{wxDD_DEFAULT_STYLE}
23324ae1
FM
33 Equivalent to a combination of wxDEFAULT_DIALOG_STYLE and
34 wxRESIZE_BORDER (the last one is not used under wxWinCE).
8c6791e4 35 @style{wxDD_DIR_MUST_EXIST}
23324ae1
FM
36 The dialog will allow the user to choose only an existing folder.
37 When this style is not given, a "Create new directory" button is
38 added to the dialog (on Windows) or some other way is provided to
39 the user to type the name of a new folder.
8c6791e4 40 @style{wxDD_CHANGE_DIR}
23324ae1
FM
41 Change the current working directory to the directory chosen by the
42 user.
43 @endStyleTable
7c913512 44
6126da35
VZ
45 Notice that @c wxRESIZE_BORDER has special side effect under recent (i.e.
46 later than Win9x) Windows where two different directory selection dialogs
47 are available and this style also implicitly selects the new version as the
48 old one always has fixed size. As the new version is almost always
49 preferable, it is recommended that @c wxRESIZE_BORDER style be always used.
50 This is the case if the dialog is created with the default style value but
51 if you need to use any additional styles you should still specify @c
52 wxDD_DEFAULT_STYLE unless you explicitly need to use the old dialog version
53 under Windows. E.g. do
54 @code
55 wxDirDialog dlg(NULL, "Choose input directory", "",
56 wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST);
57 @endcode
58 instead of just using @c wxDD_DIR_MUST_EXIST style alone.
bc85d676 59
23324ae1
FM
60 @library{wxcore}
61 @category{cmndlg}
7c913512 62
bc85d676 63 @see @ref overview_cmndlg_dir, wxFileDialog
23324ae1
FM
64*/
65class wxDirDialog : public wxDialog
66{
67public:
68 /**
bc85d676 69 Constructor. Use ShowModal() to show the dialog.
3c4f71cc 70
7c913512 71 @param parent
4cc4bfaf 72 Parent window.
7c913512 73 @param message
4cc4bfaf 74 Message to show on the dialog.
7c913512 75 @param defaultPath
4cc4bfaf 76 The default path, or the empty string.
7c913512 77 @param style
4cc4bfaf 78 The dialog style. See wxDirDialog
7c913512 79 @param pos
4cc4bfaf 80 Dialog position. Ignored under Windows.
7c913512 81 @param size
4cc4bfaf 82 Dialog size. Ignored under Windows.
7c913512 83 @param name
4cc4bfaf 84 The dialog name, not used.
23324ae1
FM
85 */
86 wxDirDialog(wxWindow* parent,
408776d0
FM
87 const wxString& message = wxDirSelectorPromptStr,
88 const wxString& defaultPath = wxEmptyString,
23324ae1
FM
89 long style = wxDD_DEFAULT_STYLE,
90 const wxPoint& pos = wxDefaultPosition,
91 const wxSize& size = wxDefaultSize,
408776d0 92 const wxString& name = wxDirDialogNameStr);
23324ae1
FM
93
94 /**
95 Destructor.
96 */
adaaa686 97 virtual ~wxDirDialog();
23324ae1
FM
98
99 /**
100 Returns the message that will be displayed on the dialog.
101 */
adaaa686 102 virtual wxString GetMessage() const;
23324ae1
FM
103
104 /**
105 Returns the default or user-selected path.
106 */
adaaa686 107 virtual wxString GetPath() const;
23324ae1
FM
108
109 /**
110 Sets the message that will be displayed on the dialog.
111 */
adaaa686 112 virtual void SetMessage(const wxString& message);
23324ae1
FM
113
114 /**
115 Sets the default path.
116 */
adaaa686 117 virtual void SetPath(const wxString& path);
23324ae1
FM
118
119 /**
bc85d676
BP
120 Shows the dialog, returning wxID_OK if the user pressed OK, and
121 wxID_CANCEL otherwise.
23324ae1
FM
122 */
123 int ShowModal();
124};
125
126
e54c96f1 127
23324ae1
FM
128// ============================================================================
129// Global functions/macros
130// ============================================================================
131
b21126db 132/** @addtogroup group_funcmacro_dialog */
ba2874ff
BP
133//@{
134
23324ae1 135/**
ba2874ff
BP
136 Pops up a directory selector dialog. The arguments have the same meaning
137 as those of wxDirDialog::wxDirDialog(). The message is displayed at the
138 top, and the default_path, if specified, is set as the initial selection.
139
23324ae1
FM
140 The application must check for an empty return value (if the user pressed
141 Cancel). For example:
4cc4bfaf 142
23324ae1
FM
143 @code
144 const wxString& dir = wxDirSelector("Choose a folder");
145 if ( !dir.empty() )
146 {
ba2874ff 147 ...
23324ae1
FM
148 }
149 @endcode
ba2874ff
BP
150
151 @header{wx/dirdlg.h}
23324ae1
FM
152*/
153wxString wxDirSelector(const wxString& message = wxDirSelectorPromptStr,
e9c3992c 154 const wxString& default_path = wxEmptyString,
23324ae1
FM
155 long style = 0,
156 const wxPoint& pos = wxDefaultPosition,
4cc4bfaf 157 wxWindow* parent = NULL);
23324ae1 158
ba2874ff
BP
159//@}
160