]> git.saurik.com Git - wxWidgets.git/blame_incremental - interface/wx/dirdlg.h
Minor fixes to wxDateTime documentation.
[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_DEFAULT_STYLE (wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
10
11/**
12 @class wxDirDialog
13
14 This class represents the directory chooser dialog.
15
16 @beginStyleTable
17 @style{wxDD_DEFAULT_STYLE}
18 Equivalent to a combination of wxDEFAULT_DIALOG_STYLE and
19 wxRESIZE_BORDER (the last one is not used under wxWinCE).
20 @style{wxDD_DIR_MUST_EXIST}
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.
25 @style{wxDD_CHANGE_DIR}
26 Change the current working directory to the directory chosen by the
27 user.
28 @endStyleTable
29
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.
44
45 @library{wxcore}
46 @category{cmndlg}
47
48 @see @ref overview_cmndlg_dir, wxFileDialog
49*/
50class wxDirDialog : public wxDialog
51{
52public:
53 /**
54 Constructor. Use ShowModal() to show the dialog.
55
56 @param parent
57 Parent window.
58 @param message
59 Message to show on the dialog.
60 @param defaultPath
61 The default path, or the empty string.
62 @param style
63 The dialog style. See wxDirDialog
64 @param pos
65 Dialog position. Ignored under Windows.
66 @param size
67 Dialog size. Ignored under Windows.
68 @param name
69 The dialog name, not used.
70 */
71 wxDirDialog(wxWindow* parent,
72 const wxString& message = wxDirSelectorPromptStr,
73 const wxString& defaultPath = wxEmptyString,
74 long style = wxDD_DEFAULT_STYLE,
75 const wxPoint& pos = wxDefaultPosition,
76 const wxSize& size = wxDefaultSize,
77 const wxString& name = wxDirDialogNameStr);
78
79 /**
80 Destructor.
81 */
82 virtual ~wxDirDialog();
83
84 /**
85 Returns the message that will be displayed on the dialog.
86 */
87 virtual wxString GetMessage() const;
88
89 /**
90 Returns the default or user-selected path.
91 */
92 virtual wxString GetPath() const;
93
94 /**
95 Sets the message that will be displayed on the dialog.
96 */
97 virtual void SetMessage(const wxString& message);
98
99 /**
100 Sets the default path.
101 */
102 virtual void SetPath(const wxString& path);
103
104 /**
105 Shows the dialog, returning wxID_OK if the user pressed OK, and
106 wxID_CANCEL otherwise.
107 */
108 int ShowModal();
109};
110
111
112
113// ============================================================================
114// Global functions/macros
115// ============================================================================
116
117/** @addtogroup group_funcmacro_dialog */
118//@{
119
120/**
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
125 The application must check for an empty return value (if the user pressed
126 Cancel). For example:
127
128 @code
129 const wxString& dir = wxDirSelector("Choose a folder");
130 if ( !dir.empty() )
131 {
132 ...
133 }
134 @endcode
135
136 @header{wx/dirdlg.h}
137*/
138wxString wxDirSelector(const wxString& message = wxDirSelectorPromptStr,
139 const wxString& default_path = wxEmptyString,
140 long style = 0,
141 const wxPoint& pos = wxDefaultPosition,
142 wxWindow* parent = NULL);
143
144//@}
145