]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/dirdlg.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxDirDialog
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
12 This class represents the directory chooser dialog.
15 @style{wxDD_DEFAULT_STYLE}
16 Equivalent to a combination of wxDEFAULT_DIALOG_STYLE and
17 wxRESIZE_BORDER (the last one is not used under wxWinCE).
18 @style{wxDD_DIR_MUST_EXIST}
19 The dialog will allow the user to choose only an existing folder.
20 When this style is not given, a "Create new directory" button is
21 added to the dialog (on Windows) or some other way is provided to
22 the user to type the name of a new folder.
23 @style{wxDD_CHANGE_DIR}
24 Change the current working directory to the directory chosen by the
28 Notice that @c wxRESIZE_BORDER has special side effect under recent (i.e.
29 later than Win9x) Windows where two different directory selection dialogs
30 are available and this style also implicitly selects the new version as the
31 old one always has fixed size. As the new version is almost always
32 preferable, it is recommended that @c wxRESIZE_BORDER style be always used.
33 This is the case if the dialog is created with the default style value but
34 if you need to use any additional styles you should still specify @c
35 wxDD_DEFAULT_STYLE unless you explicitly need to use the old dialog version
36 under Windows. E.g. do
38 wxDirDialog dlg(NULL, "Choose input directory", "",
39 wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST);
41 instead of just using @c wxDD_DIR_MUST_EXIST style alone.
46 @see @ref overview_cmndlg_dir, wxFileDialog
48 class wxDirDialog
: public wxDialog
52 Constructor. Use ShowModal() to show the dialog.
57 Message to show on the dialog.
59 The default path, or the empty string.
61 The dialog style. See wxDirDialog
63 Dialog position. Ignored under Windows.
65 Dialog size. Ignored under Windows.
67 The dialog name, not used.
69 wxDirDialog(wxWindow
* parent
,
70 const wxString
& message
= wxDirSelectorPromptStr
,
71 const wxString
& defaultPath
= wxEmptyString
,
72 long style
= wxDD_DEFAULT_STYLE
,
73 const wxPoint
& pos
= wxDefaultPosition
,
74 const wxSize
& size
= wxDefaultSize
,
75 const wxString
& name
= wxDirDialogNameStr
);
80 virtual ~wxDirDialog();
83 Returns the message that will be displayed on the dialog.
85 virtual wxString
GetMessage() const;
88 Returns the default or user-selected path.
90 virtual wxString
GetPath() const;
93 Sets the message that will be displayed on the dialog.
95 virtual void SetMessage(const wxString
& message
);
98 Sets the default path.
100 virtual void SetPath(const wxString
& path
);
103 Shows the dialog, returning wxID_OK if the user pressed OK, and
104 wxID_CANCEL otherwise.
111 // ============================================================================
112 // Global functions/macros
113 // ============================================================================
115 /** @ingroup group_funcmacro_dialog */
119 Pops up a directory selector dialog. The arguments have the same meaning
120 as those of wxDirDialog::wxDirDialog(). The message is displayed at the
121 top, and the default_path, if specified, is set as the initial selection.
123 The application must check for an empty return value (if the user pressed
124 Cancel). For example:
127 const wxString& dir = wxDirSelector("Choose a folder");
136 wxString
wxDirSelector(const wxString
& message
= wxDirSelectorPromptStr
,
137 const wxString
& default_path
= "",
139 const wxPoint
& pos
= wxDefaultPosition
,
140 wxWindow
* parent
= NULL
);