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