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