]> git.saurik.com Git - wxWidgets.git/blob - interface/dirdlg.h
ca177ae5647c0f716728520f751f03ebb252a863
[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 @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 wxID_CANCEL
92 otherwise.
93 */
94 int ShowModal();
95 };
96
97
98 // ============================================================================
99 // Global functions/macros
100 // ============================================================================
101
102 /**
103 Pops up a directory selector dialog. The arguments have the same meaning as
104 those of wxDirDialog::wxDirDialog(). The message is displayed at the top,
105 and the default_path, if specified, is set as the initial selection.
106 The application must check for an empty return value (if the user pressed
107 Cancel). For example:
108
109 @code
110 const wxString& dir = wxDirSelector("Choose a folder");
111 if ( !dir.empty() )
112 {
113 ...
114 }
115 @endcode
116 */
117 wxString wxDirSelector(const wxString& message = wxDirSelectorPromptStr,
118 const wxString& default_path = "",
119 long style = 0,
120 const wxPoint& pos = wxDefaultPosition,
121 wxWindow* parent = NULL);
122