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