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