s/""/wxEmptyString
[wxWidgets.git] / interface / wx / dirdlg.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: dirdlg.h
3 // Purpose: interface of wxDirDialog
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @class wxDirDialog
11
12 This class represents the directory chooser dialog.
13
14 @beginStyleTable
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
25 user.
26 @endStyleTable
27
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
37 @code
38 wxDirDialog dlg(NULL, "Choose input directory", "",
39 wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST);
40 @endcode
41 instead of just using @c wxDD_DIR_MUST_EXIST style alone.
42
43 @library{wxcore}
44 @category{cmndlg}
45
46 @see @ref overview_cmndlg_dir, wxFileDialog
47 */
48 class wxDirDialog : public wxDialog
49 {
50 public:
51 /**
52 Constructor. Use ShowModal() to show the dialog.
53
54 @param parent
55 Parent window.
56 @param message
57 Message to show on the dialog.
58 @param defaultPath
59 The default path, or the empty string.
60 @param style
61 The dialog style. See wxDirDialog
62 @param pos
63 Dialog position. Ignored under Windows.
64 @param size
65 Dialog size. Ignored under Windows.
66 @param name
67 The dialog name, not used.
68 */
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);
76
77 /**
78 Destructor.
79 */
80 virtual ~wxDirDialog();
81
82 /**
83 Returns the message that will be displayed on the dialog.
84 */
85 virtual wxString GetMessage() const;
86
87 /**
88 Returns the default or user-selected path.
89 */
90 virtual wxString GetPath() const;
91
92 /**
93 Sets the message that will be displayed on the dialog.
94 */
95 virtual void SetMessage(const wxString& message);
96
97 /**
98 Sets the default path.
99 */
100 virtual void SetPath(const wxString& path);
101
102 /**
103 Shows the dialog, returning wxID_OK if the user pressed OK, and
104 wxID_CANCEL otherwise.
105 */
106 int ShowModal();
107 };
108
109
110
111 // ============================================================================
112 // Global functions/macros
113 // ============================================================================
114
115 /** @addtogroup group_funcmacro_dialog */
116 //@{
117
118 /**
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.
122
123 The application must check for an empty return value (if the user pressed
124 Cancel). For example:
125
126 @code
127 const wxString& dir = wxDirSelector("Choose a folder");
128 if ( !dir.empty() )
129 {
130 ...
131 }
132 @endcode
133
134 @header{wx/dirdlg.h}
135 */
136 wxString wxDirSelector(const wxString& message = wxDirSelectorPromptStr,
137 const wxString& default_path = wxEmptyString,
138 long style = 0,
139 const wxPoint& pos = wxDefaultPosition,
140 wxWindow* parent = NULL);
141
142 //@}
143