]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/dirdlg.h
Interface fix for Phoenix
[wxWidgets.git] / interface / wx / dirdlg.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: dirdlg.h
3 // Purpose: interface of wxDirDialog
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
8
9 #define wxDD_DEFAULT_STYLE (wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
10
11 /**
12 Initial folder for generic directory dialog.
13 */
14 const char wxDirDialogDefaultFolderStr[] = "/";
15
16 /**
17 Default message for directory selector dialog.
18 */
19 const char wxDirSelectorPromptStr[] = "Select a directory";
20
21 /**
22 Default name for directory selector dialog.
23 */
24 const char wxDirDialogNameStr[] = "wxDirCtrl";
25
26 /**
27 @class wxDirDialog
28
29 This class represents the directory chooser dialog.
30
31 @beginStyleTable
32 @style{wxDD_DEFAULT_STYLE}
33 Equivalent to a combination of wxDEFAULT_DIALOG_STYLE and
34 wxRESIZE_BORDER (the last one is not used under wxWinCE).
35 @style{wxDD_DIR_MUST_EXIST}
36 The dialog will allow the user to choose only an existing folder.
37 When this style is not given, a "Create new directory" button is
38 added to the dialog (on Windows) or some other way is provided to
39 the user to type the name of a new folder.
40 @style{wxDD_CHANGE_DIR}
41 Change the current working directory to the directory chosen by the
42 user.
43 @endStyleTable
44
45 Notice that @c wxRESIZE_BORDER has special side effect under recent (i.e.
46 later than Win9x) Windows where two different directory selection dialogs
47 are available and this style also implicitly selects the new version as the
48 old one always has fixed size. As the new version is almost always
49 preferable, it is recommended that @c wxRESIZE_BORDER style be always used.
50 This is the case if the dialog is created with the default style value but
51 if you need to use any additional styles you should still specify @c
52 wxDD_DEFAULT_STYLE unless you explicitly need to use the old dialog version
53 under Windows. E.g. do
54 @code
55 wxDirDialog dlg(NULL, "Choose input directory", "",
56 wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST);
57 @endcode
58 instead of just using @c wxDD_DIR_MUST_EXIST style alone.
59
60 @library{wxcore}
61 @category{cmndlg}
62
63 @see @ref overview_cmndlg_dir, wxFileDialog
64 */
65 class wxDirDialog : public wxDialog
66 {
67 public:
68 /**
69 Constructor. Use ShowModal() to show the dialog.
70
71 @param parent
72 Parent window.
73 @param message
74 Message to show on the dialog.
75 @param defaultPath
76 The default path, or the empty string.
77 @param style
78 The dialog style. See wxDirDialog
79 @param pos
80 Dialog position. Ignored under Windows.
81 @param size
82 Dialog size. Ignored under Windows.
83 @param name
84 The dialog name, not used.
85 */
86 wxDirDialog(wxWindow* parent,
87 const wxString& message = wxDirSelectorPromptStr,
88 const wxString& defaultPath = wxEmptyString,
89 long style = wxDD_DEFAULT_STYLE,
90 const wxPoint& pos = wxDefaultPosition,
91 const wxSize& size = wxDefaultSize,
92 const wxString& name = wxDirDialogNameStr);
93
94 /**
95 Destructor.
96 */
97 virtual ~wxDirDialog();
98
99 /**
100 Returns the message that will be displayed on the dialog.
101 */
102 virtual wxString GetMessage() const;
103
104 /**
105 Returns the default or user-selected path.
106 */
107 virtual wxString GetPath() const;
108
109 /**
110 Sets the message that will be displayed on the dialog.
111 */
112 virtual void SetMessage(const wxString& message);
113
114 /**
115 Sets the default path.
116 */
117 virtual void SetPath(const wxString& path);
118
119 /**
120 Shows the dialog, returning wxID_OK if the user pressed OK, and
121 wxID_CANCEL otherwise.
122 */
123 int ShowModal();
124 };
125
126
127
128 // ============================================================================
129 // Global functions/macros
130 // ============================================================================
131
132 /** @addtogroup group_funcmacro_dialog */
133 //@{
134
135 /**
136 Pops up a directory selector dialog. The arguments have the same meaning
137 as those of wxDirDialog::wxDirDialog(). The message is displayed at the
138 top, and the default_path, if specified, is set as the initial selection.
139
140 The application must check for an empty return value (if the user pressed
141 Cancel). For example:
142
143 @code
144 const wxString& dir = wxDirSelector("Choose a folder");
145 if ( !dir.empty() )
146 {
147 ...
148 }
149 @endcode
150
151 @header{wx/dirdlg.h}
152 */
153 wxString wxDirSelector(const wxString& message = wxDirSelectorPromptStr,
154 const wxString& default_path = wxEmptyString,
155 long style = 0,
156 const wxPoint& pos = wxDefaultPosition,
157 wxWindow* parent = NULL);
158
159 //@}
160