]>
Commit | Line | Data |
---|---|---|
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 | @note On Windows the new directory button is only available with recent | |
29 | versions of the common dialogs. | |
30 | ||
31 | @library{wxcore} | |
32 | @category{cmndlg} | |
33 | ||
34 | @see @ref overview_cmndlg_dir, wxFileDialog | |
35 | */ | |
36 | class wxDirDialog : public wxDialog | |
37 | { | |
38 | public: | |
39 | /** | |
40 | Constructor. Use ShowModal() to show the dialog. | |
41 | ||
42 | @param parent | |
43 | Parent window. | |
44 | @param message | |
45 | Message to show on the dialog. | |
46 | @param defaultPath | |
47 | The default path, or the empty string. | |
48 | @param style | |
49 | The dialog style. See wxDirDialog | |
50 | @param pos | |
51 | Dialog position. Ignored under Windows. | |
52 | @param size | |
53 | Dialog size. Ignored under Windows. | |
54 | @param name | |
55 | The dialog name, not used. | |
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 | */ | |
73 | wxString GetMessage() const; | |
74 | ||
75 | /** | |
76 | Returns the default or user-selected path. | |
77 | */ | |
78 | wxString GetPath() const; | |
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 | /** | |
91 | Shows the dialog, returning wxID_OK if the user pressed OK, and | |
92 | wxID_CANCEL otherwise. | |
93 | */ | |
94 | int ShowModal(); | |
95 | }; | |
96 | ||
97 | ||
98 | ||
99 | // ============================================================================ | |
100 | // Global functions/macros | |
101 | // ============================================================================ | |
102 | ||
103 | /** @ingroup group_funcmacro_dialog */ | |
104 | //@{ | |
105 | ||
106 | /** | |
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 | ||
111 | The application must check for an empty return value (if the user pressed | |
112 | Cancel). For example: | |
113 | ||
114 | @code | |
115 | const wxString& dir = wxDirSelector("Choose a folder"); | |
116 | if ( !dir.empty() ) | |
117 | { | |
118 | ... | |
119 | } | |
120 | @endcode | |
121 | ||
122 | @header{wx/dirdlg.h} | |
123 | */ | |
124 | wxString wxDirSelector(const wxString& message = wxDirSelectorPromptStr, | |
125 | const wxString& default_path = "", | |
126 | long style = 0, | |
127 | const wxPoint& pos = wxDefaultPosition, | |
128 | wxWindow* parent = NULL); | |
129 | ||
130 | //@} | |
131 |