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