]> git.saurik.com Git - wxWidgets.git/blame_incremental - interface/wx/dirdlg.h
Make wxFindReplaceData accessors const.
[wxWidgets.git] / interface / wx / dirdlg.h
... / ...
CommitLineData
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_CHANGE_DIR 0x0100
10#define wxDD_DIR_MUST_EXIST 0x0200
11#define wxDD_NEW_DIR_BUTTON 0 // deprecated, on by default now,
12
13#define wxDD_DEFAULT_STYLE (wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
14
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
30/**
31 @class wxDirDialog
32
33 This class represents the directory chooser dialog.
34
35 @beginStyleTable
36 @style{wxDD_DEFAULT_STYLE}
37 Equivalent to a combination of wxDEFAULT_DIALOG_STYLE and
38 wxRESIZE_BORDER (the last one is not used under wxWinCE).
39 @style{wxDD_DIR_MUST_EXIST}
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.
44 @style{wxDD_CHANGE_DIR}
45 Change the current working directory to the directory chosen by the
46 user.
47 @endStyleTable
48
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.
63
64 @library{wxcore}
65 @category{cmndlg}
66
67 @see @ref overview_cmndlg_dir, wxFileDialog
68*/
69class wxDirDialog : public wxDialog
70{
71public:
72 /**
73 Constructor. Use ShowModal() to show the dialog.
74
75 @param parent
76 Parent window.
77 @param message
78 Message to show on the dialog.
79 @param defaultPath
80 The default path, or the empty string.
81 @param style
82 The dialog style. See wxDirDialog
83 @param pos
84 Dialog position. Ignored under Windows.
85 @param size
86 Dialog size. Ignored under Windows.
87 @param name
88 The dialog name, not used.
89 */
90 wxDirDialog(wxWindow* parent,
91 const wxString& message = wxDirSelectorPromptStr,
92 const wxString& defaultPath = wxEmptyString,
93 long style = wxDD_DEFAULT_STYLE,
94 const wxPoint& pos = wxDefaultPosition,
95 const wxSize& size = wxDefaultSize,
96 const wxString& name = wxDirDialogNameStr);
97
98 /**
99 Destructor.
100 */
101 virtual ~wxDirDialog();
102
103 /**
104 Returns the message that will be displayed on the dialog.
105 */
106 virtual wxString GetMessage() const;
107
108 /**
109 Returns the default or user-selected path.
110 */
111 virtual wxString GetPath() const;
112
113 /**
114 Sets the message that will be displayed on the dialog.
115 */
116 virtual void SetMessage(const wxString& message);
117
118 /**
119 Sets the default path.
120 */
121 virtual void SetPath(const wxString& path);
122
123 /**
124 Shows the dialog, returning wxID_OK if the user pressed OK, and
125 wxID_CANCEL otherwise.
126 */
127 int ShowModal();
128};
129
130
131
132// ============================================================================
133// Global functions/macros
134// ============================================================================
135
136/** @addtogroup group_funcmacro_dialog */
137//@{
138
139/**
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
144 The application must check for an empty return value (if the user pressed
145 Cancel). For example:
146
147 @code
148 const wxString& dir = wxDirSelector("Choose a folder");
149 if ( !dir.empty() )
150 {
151 ...
152 }
153 @endcode
154
155 @header{wx/dirdlg.h}
156*/
157wxString wxDirSelector(const wxString& message = wxDirSelectorPromptStr,
158 const wxString& default_path = wxEmptyString,
159 long style = 0,
160 const wxPoint& pos = wxDefaultPosition,
161 wxWindow* parent = NULL);
162
163//@}
164