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