]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: dirdlg.h | |
e54c96f1 | 3 | // Purpose: interface of wxDirDialog |
23324ae1 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxDirDialog | |
11 | @wxheader{dirdlg.h} | |
7c913512 | 12 | |
23324ae1 | 13 | This class represents the directory chooser dialog. |
7c913512 | 14 | |
23324ae1 | 15 | @beginStyleTable |
8c6791e4 | 16 | @style{wxDD_DEFAULT_STYLE} |
23324ae1 FM |
17 | Equivalent to a combination of wxDEFAULT_DIALOG_STYLE and |
18 | wxRESIZE_BORDER (the last one is not used under wxWinCE). | |
8c6791e4 | 19 | @style{wxDD_DIR_MUST_EXIST} |
23324ae1 FM |
20 | The dialog will allow the user to choose only an existing folder. |
21 | When this style is not given, a "Create new directory" button is | |
22 | added to the dialog (on Windows) or some other way is provided to | |
23 | the user to type the name of a new folder. | |
8c6791e4 | 24 | @style{wxDD_CHANGE_DIR} |
23324ae1 FM |
25 | Change the current working directory to the directory chosen by the |
26 | user. | |
27 | @endStyleTable | |
7c913512 | 28 | |
bc85d676 BP |
29 | @note On Windows the new directory button is only available with recent |
30 | versions of the common dialogs. | |
31 | ||
23324ae1 FM |
32 | @library{wxcore} |
33 | @category{cmndlg} | |
7c913512 | 34 | |
bc85d676 | 35 | @see @ref overview_cmndlg_dir, wxFileDialog |
23324ae1 FM |
36 | */ |
37 | class wxDirDialog : public wxDialog | |
38 | { | |
39 | public: | |
40 | /** | |
bc85d676 | 41 | Constructor. Use ShowModal() to show the dialog. |
3c4f71cc | 42 | |
7c913512 | 43 | @param parent |
4cc4bfaf | 44 | Parent window. |
7c913512 | 45 | @param message |
4cc4bfaf | 46 | Message to show on the dialog. |
7c913512 | 47 | @param defaultPath |
4cc4bfaf | 48 | The default path, or the empty string. |
7c913512 | 49 | @param style |
4cc4bfaf | 50 | The dialog style. See wxDirDialog |
7c913512 | 51 | @param pos |
4cc4bfaf | 52 | Dialog position. Ignored under Windows. |
7c913512 | 53 | @param size |
4cc4bfaf | 54 | Dialog size. Ignored under Windows. |
7c913512 | 55 | @param name |
4cc4bfaf | 56 | The dialog name, not used. |
23324ae1 FM |
57 | */ |
58 | wxDirDialog(wxWindow* parent, | |
59 | const wxString& message = "Choose a directory", | |
60 | const wxString& defaultPath = "", | |
61 | long style = wxDD_DEFAULT_STYLE, | |
62 | const wxPoint& pos = wxDefaultPosition, | |
63 | const wxSize& size = wxDefaultSize, | |
64 | const wxString& name = "wxDirCtrl"); | |
65 | ||
66 | /** | |
67 | Destructor. | |
68 | */ | |
69 | ~wxDirDialog(); | |
70 | ||
71 | /** | |
72 | Returns the message that will be displayed on the dialog. | |
73 | */ | |
328f5751 | 74 | wxString GetMessage() const; |
23324ae1 FM |
75 | |
76 | /** | |
77 | Returns the default or user-selected path. | |
78 | */ | |
328f5751 | 79 | wxString GetPath() const; |
23324ae1 FM |
80 | |
81 | /** | |
82 | Sets the message that will be displayed on the dialog. | |
83 | */ | |
84 | void SetMessage(const wxString& message); | |
85 | ||
86 | /** | |
87 | Sets the default path. | |
88 | */ | |
89 | void SetPath(const wxString& path); | |
90 | ||
91 | /** | |
bc85d676 BP |
92 | Shows the dialog, returning wxID_OK if the user pressed OK, and |
93 | wxID_CANCEL otherwise. | |
23324ae1 FM |
94 | */ |
95 | int ShowModal(); | |
96 | }; | |
97 | ||
98 | ||
e54c96f1 | 99 | |
23324ae1 FM |
100 | // ============================================================================ |
101 | // Global functions/macros | |
102 | // ============================================================================ | |
103 | ||
ba2874ff BP |
104 | /** @ingroup group_funcmacro_dialog */ |
105 | //@{ | |
106 | ||
23324ae1 | 107 | /** |
ba2874ff BP |
108 | Pops up a directory selector dialog. The arguments have the same meaning |
109 | as those of wxDirDialog::wxDirDialog(). The message is displayed at the | |
110 | top, and the default_path, if specified, is set as the initial selection. | |
111 | ||
23324ae1 FM |
112 | The application must check for an empty return value (if the user pressed |
113 | Cancel). For example: | |
4cc4bfaf | 114 | |
23324ae1 FM |
115 | @code |
116 | const wxString& dir = wxDirSelector("Choose a folder"); | |
117 | if ( !dir.empty() ) | |
118 | { | |
ba2874ff | 119 | ... |
23324ae1 FM |
120 | } |
121 | @endcode | |
ba2874ff BP |
122 | |
123 | @header{wx/dirdlg.h} | |
23324ae1 FM |
124 | */ |
125 | wxString wxDirSelector(const wxString& message = wxDirSelectorPromptStr, | |
126 | const wxString& default_path = "", | |
127 | long style = 0, | |
128 | const wxPoint& pos = wxDefaultPosition, | |
4cc4bfaf | 129 | wxWindow* parent = NULL); |
23324ae1 | 130 | |
ba2874ff BP |
131 | //@} |
132 |