]>
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 | |
6126da35 VZ |
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. | |
bc85d676 | 42 | |
23324ae1 FM |
43 | @library{wxcore} |
44 | @category{cmndlg} | |
7c913512 | 45 | |
bc85d676 | 46 | @see @ref overview_cmndlg_dir, wxFileDialog |
23324ae1 FM |
47 | */ |
48 | class wxDirDialog : public wxDialog | |
49 | { | |
50 | public: | |
51 | /** | |
bc85d676 | 52 | Constructor. Use ShowModal() to show the dialog. |
3c4f71cc | 53 | |
7c913512 | 54 | @param parent |
4cc4bfaf | 55 | Parent window. |
7c913512 | 56 | @param message |
4cc4bfaf | 57 | Message to show on the dialog. |
7c913512 | 58 | @param defaultPath |
4cc4bfaf | 59 | The default path, or the empty string. |
7c913512 | 60 | @param style |
4cc4bfaf | 61 | The dialog style. See wxDirDialog |
7c913512 | 62 | @param pos |
4cc4bfaf | 63 | Dialog position. Ignored under Windows. |
7c913512 | 64 | @param size |
4cc4bfaf | 65 | Dialog size. Ignored under Windows. |
7c913512 | 66 | @param name |
4cc4bfaf | 67 | The dialog name, not used. |
23324ae1 FM |
68 | */ |
69 | wxDirDialog(wxWindow* parent, | |
408776d0 FM |
70 | const wxString& message = wxDirSelectorPromptStr, |
71 | const wxString& defaultPath = wxEmptyString, | |
23324ae1 FM |
72 | long style = wxDD_DEFAULT_STYLE, |
73 | const wxPoint& pos = wxDefaultPosition, | |
74 | const wxSize& size = wxDefaultSize, | |
408776d0 | 75 | const wxString& name = wxDirDialogNameStr); |
23324ae1 FM |
76 | |
77 | /** | |
78 | Destructor. | |
79 | */ | |
adaaa686 | 80 | virtual ~wxDirDialog(); |
23324ae1 FM |
81 | |
82 | /** | |
83 | Returns the message that will be displayed on the dialog. | |
84 | */ | |
adaaa686 | 85 | virtual wxString GetMessage() const; |
23324ae1 FM |
86 | |
87 | /** | |
88 | Returns the default or user-selected path. | |
89 | */ | |
adaaa686 | 90 | virtual wxString GetPath() const; |
23324ae1 FM |
91 | |
92 | /** | |
93 | Sets the message that will be displayed on the dialog. | |
94 | */ | |
adaaa686 | 95 | virtual void SetMessage(const wxString& message); |
23324ae1 FM |
96 | |
97 | /** | |
98 | Sets the default path. | |
99 | */ | |
adaaa686 | 100 | virtual void SetPath(const wxString& path); |
23324ae1 FM |
101 | |
102 | /** | |
bc85d676 BP |
103 | Shows the dialog, returning wxID_OK if the user pressed OK, and |
104 | wxID_CANCEL otherwise. | |
23324ae1 FM |
105 | */ |
106 | int ShowModal(); | |
107 | }; | |
108 | ||
109 | ||
e54c96f1 | 110 | |
23324ae1 FM |
111 | // ============================================================================ |
112 | // Global functions/macros | |
113 | // ============================================================================ | |
114 | ||
b21126db | 115 | /** @addtogroup group_funcmacro_dialog */ |
ba2874ff BP |
116 | //@{ |
117 | ||
23324ae1 | 118 | /** |
ba2874ff BP |
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 | ||
23324ae1 FM |
123 | The application must check for an empty return value (if the user pressed |
124 | Cancel). For example: | |
4cc4bfaf | 125 | |
23324ae1 FM |
126 | @code |
127 | const wxString& dir = wxDirSelector("Choose a folder"); | |
128 | if ( !dir.empty() ) | |
129 | { | |
ba2874ff | 130 | ... |
23324ae1 FM |
131 | } |
132 | @endcode | |
ba2874ff BP |
133 | |
134 | @header{wx/dirdlg.h} | |
23324ae1 FM |
135 | */ |
136 | wxString wxDirSelector(const wxString& message = wxDirSelectorPromptStr, | |
e9c3992c | 137 | const wxString& default_path = wxEmptyString, |
23324ae1 FM |
138 | long style = 0, |
139 | const wxPoint& pos = wxDefaultPosition, | |
4cc4bfaf | 140 | wxWindow* parent = NULL); |
23324ae1 | 141 | |
ba2874ff BP |
142 | //@} |
143 |