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