/
open_file_box.h
265 lines (261 loc) · 29.8 KB
/
open_file_box.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
/// @file
/// @brief Contains xtd::forms::open_file_box control.
/// @copyright Copyright (c) 2024 Gammasoft. All rights reserved.
#pragma once
#include "open_file_box_options.h"
#include "open_file_dialog.h"
#include <xtd/static>
/// @brief The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
namespace xtd {
/// @brief The xtd::forms namespace contains classes for creating Windows-based applications that take full advantage of the rich user interface features available in the Microsoft Windows operating system, Apple macOS and Linux like Ubuntu operating system.
namespace forms {
/// @brief Represents a common dialog box that displays a file selection dialog. This class cannot be inherited.
/// @par Header
/// @code #include <xtd/forms/open_file_box> @endcode
/// @par Namespace
/// xtd::forms
/// @par Library
/// xtd.forms
/// @ingroup xtd_forms dialogs
/// @par Appearance
/// | | Windows | macOS | Gnome |
/// | ----- | -------------------------------------------- | -------------------------------------------- | -------------------------------------------- |
/// | Light | @image html dialog_open_file_dialog_w.png | @image html dialog_open_file_dialog_m.png | @image html dialog_open_file_dialog_g.png |
/// | Dark | @image html dialog_open_file_dialog_wd.png | @image html dialog_open_file_dialog_md.png | @image html dialog_open_file_dialog_gd.png |
/// @par Examples
/// The following code example demonstrates the use of xtd::forms::open_file_box dialog.
/// @include open_file_box.cpp
class forms_export_ open_file_box final static_ {
public:
/// @name Public Static Methods
/// @{
/// @brief Displays a select file dialog box in front of a specified window.
/// @param file_name An output xtd::ustring that will store the selected file name.
/// @param owner An xtd::forms::iwin32_window that represents the owner window of the file dialog box.
/// @return xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
/// @remarks If xtd::forms::dialog_result is xtd::forms::dialog_result::ok, the output file_name parameter will contain the selected file path, otherwise it will be ignored.
static xtd::forms::dialog_result show(xtd::ustring& file_name, const xtd::forms::iwin32_window& owner);
/// @brief Displays a select file dialog box in front of a specified window.
/// @param file_name An output xtd::ustring that will store the selected file name.
/// @param owner An xtd::forms::iwin32_window that represents the owner window of the file dialog box.
/// @param title An xtd::ustring that specifies the caption title of the file dialog box.
/// @return xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
/// @remarks If xtd::forms::dialog_result is xtd::forms::dialog_result::ok, the output file_name parameter will contain the selected file path, otherwise it will be ignored.
static xtd::forms::dialog_result show(xtd::ustring& file_name, const xtd::forms::iwin32_window& owner, const xtd::ustring& title);
/// @brief Displays a select file dialog box in front of a specified window.
/// @param file_name An output xtd::ustring that will store the selected file name.
/// @param owner An xtd::forms::iwin32_window that represents the owner window of the file dialog box.
/// @param title An xtd::ustring that specifies the caption title of the file dialog box.
/// @param options A bitwise combination of enum xtd::forms::open_file_box_options to specify additional options to the file dialog box
/// @return xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
/// @remarks If xtd::forms::dialog_result is xtd::forms::dialog_result::ok, the output file_name parameter will contain the selected file path, otherwise it will be ignored.
static xtd::forms::dialog_result show(xtd::ustring& file_name, const xtd::forms::iwin32_window& owner, const xtd::ustring& title, const open_file_box_options options);
/// @brief Displays a select file dialog box in front of a specified window.
/// @param file_name An output xtd::ustring that will store the selected file name.
/// @param owner An xtd::forms::iwin32_window that represents the owner window of the file dialog box.
/// @param title An xtd::ustring that specifies the caption title of the file dialog box.
/// @param initial_directory An xtd::ustring that specifies the initial directory displayed by the file dialog box
/// @return xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
/// @remarks If xtd::forms::dialog_result is xtd::forms::dialog_result::ok, the output file_name parameter will contain the selected file path, otherwise it will be ignored.
static xtd::forms::dialog_result show(xtd::ustring& file_name, const xtd::forms::iwin32_window& owner, const xtd::ustring& title, const xtd::ustring& initial_directory);
/// @brief Displays a select file dialog box in front of a specified window.
/// @param file_name An output xtd::ustring that will store the selected file name.
/// @param owner An xtd::forms::iwin32_window that represents the owner window of the file dialog box.
/// @param title An xtd::ustring that specifies the caption title of the file dialog box.
/// @param initial_directory An xtd::ustring that specifies the initial directory displayed by the file dialog box
/// @param options A bitwise combination of enum xtd::forms::open_file_box_options to specify additional options to the file dialog box
/// @return xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
/// @remarks If xtd::forms::dialog_result is xtd::forms::dialog_result::ok, the output file_name parameter will contain the selected file path, otherwise it will be ignored.
static xtd::forms::dialog_result show(xtd::ustring& file_name, const xtd::forms::iwin32_window& owner, const xtd::ustring& title, const xtd::ustring& initial_directory, const open_file_box_options options);
/// @brief Displays a select file dialog box in front of a specified window.
/// @param file_name An output xtd::ustring that will store the selected file name.
/// @param owner An xtd::forms::iwin32_window that represents the owner window of the file dialog box.
/// @param title An xtd::ustring that specifies the caption title of the file dialog box.
/// @param initial_directory An xtd::ustring that specifies the initial directory displayed by the file dialog box
/// @param filter An xtd::ustring that specifies the file name filter string, which determines the choices that appear in the "Save as file type" or "Files of type" box in the dialog box, separated by vertical bar | for example: @verbatim (*.txt)|*.txt|All files (*.*)|*.* @endverbatim
/// @return xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
/// @remarks If xtd::forms::dialog_result is xtd::forms::dialog_result::ok, the output file_name parameter will contain the selected file path, otherwise it will be ignored.
static xtd::forms::dialog_result show(xtd::ustring& file_name, const xtd::forms::iwin32_window& owner, const xtd::ustring& title, const xtd::ustring& initial_directory, const xtd::ustring& filter);
/// @brief Displays a select file dialog box in front of a specified window.
/// @param file_name An output xtd::ustring that will store the selected file name.
/// @param owner An xtd::forms::iwin32_window that represents the owner window of the file dialog box.
/// @param title An xtd::ustring that specifies the caption title of the file dialog box.
/// @param initial_directory An xtd::ustring that specifies the initial directory displayed by the file dialog box
/// @param filter An xtd::ustring that specifies the file name filter string, which determines the choices that appear in the "Save as file type" or "Files of type" box in the dialog box, separated by vertical bar | for example: @verbatim (*.txt)|*.txt|All files (*.*)|*.* @endverbatim
/// @param options A bitwise combination of enum xtd::forms::open_file_box_options to specify additional options to the file dialog box
/// @return xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
/// @remarks If xtd::forms::dialog_result is xtd::forms::dialog_result::ok, the output file_name parameter will contain the selected file path, otherwise it will be ignored.
static xtd::forms::dialog_result show(xtd::ustring& file_name, const xtd::forms::iwin32_window& owner, const xtd::ustring& title, const xtd::ustring& initial_directory, const xtd::ustring& filter, const open_file_box_options options);
/// @brief Displays a select file dialog box.
/// @param file_name An output xtd::ustring that will store the selected file name.
/// @return xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
/// @remarks If xtd::forms::dialog_result is xtd::forms::dialog_result::ok, the output file_name parameter will contain the selected file path, otherwise it will be ignored.
static xtd::forms::dialog_result show(xtd::ustring& file_name);
/// @brief Displays a select file dialog box.
/// @param file_name An output xtd::ustring that will store the selected file name.
/// @param title An xtd::ustring that specifies the caption title of the file dialog box.
/// @return xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
/// @remarks If xtd::forms::dialog_result is xtd::forms::dialog_result::ok, the output file_name parameter will contain the selected file path, otherwise it will be ignored.
static xtd::forms::dialog_result show(xtd::ustring& file_name, const xtd::ustring& title);
/// @brief Displays a select file dialog box.
/// @param file_name An output xtd::ustring that will store the selected file name.
/// @param title An xtd::ustring that specifies the caption title of the file dialog box.
/// @param options A bitwise combination of enum xtd::forms::open_file_box_options to specify additional options to the file dialog box
/// @return xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
/// @remarks If xtd::forms::dialog_result is ok, the output file_name parameter will contain the selected file path, otherwise it will be ignored.
static xtd::forms::dialog_result show(xtd::ustring& file_name, const xtd::ustring& title, const open_file_box_options options);
/// @brief Displays a select file dialog box.
/// @param file_name An output xtd::ustring that will store the selected file name.
/// @param title An xtd::ustring that specifies the caption title of the file dialog box.
/// @param initial_directory An xtd::ustring that specifies the initial directory displayed by the file dialog box
/// @return xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
/// @remarks If xtd::forms::dialog_result is xtd::forms::dialog_result::ok, the output file_name parameter will contain the selected file path, otherwise it will be ignored.
static xtd::forms::dialog_result show(xtd::ustring& file_name, const xtd::ustring& title, const xtd::ustring& initial_directory);
/// @brief Displays a select file dialog box.
/// @param file_name An output xtd::ustring that will store the selected file name.
/// @param title An xtd::ustring that specifies the caption title of the file dialog box.
/// @param initial_directory An xtd::ustring that specifies the initial directory displayed by the file dialog box
/// @param options A bitwise combination of enum xtd::forms::open_file_box_options to specify additional options to the file dialog box
/// @return xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
/// @remarks If xtd::forms::dialog_result is xtd::forms::dialog_result::ok, the output file_name parameter will contain the selected file path, otherwise it will be ignored.
static xtd::forms::dialog_result show(xtd::ustring& file_name, const xtd::ustring& title, const xtd::ustring& initial_directory, const open_file_box_options options);
/// @brief Displays a select file dialog box.
/// @param file_name An output xtd::ustring that will store the selected file name.
/// @param title An xtd::ustring that specifies the caption title of the file dialog box.
/// @param initial_directory An xtd::ustring that specifies the initial directory displayed by the file dialog box
/// @param filter An xtd::ustring that specifies the file name filter string, which determines the choices that appear in the "Save as file type" or "Files of type" box in the dialog box, separated by vertical bar | for example: @verbatim (*.txt)|*.txt|All files (*.*)|*.* @endverbatim
/// @return xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
/// @remarks If xtd::forms::dialog_result is xtd::forms::dialog_result::ok, the output file_name parameter will contain the selected file path, otherwise it will be ignored.
static xtd::forms::dialog_result show(xtd::ustring& file_name, const xtd::ustring& title, const xtd::ustring& initial_directory, const xtd::ustring& filter);
/// @brief Displays a select file dialog box.
/// @param file_name An output xtd::ustring that will store the selected file name.
/// @param title An xtd::ustring that specifies the caption title of the file dialog box.
/// @param initial_directory An xtd::ustring that specifies the initial directory displayed by the file dialog box
/// @param filter An xtd::ustring that specifies the file name filter string, which determines the choices that appear in the "Save as file type" or "Files of type" box in the dialog box, separated by vertical bar | for example: @verbatim (*.txt)|*.txt|All files (*.*)|*.* @endverbatim
/// @param options A bitwise combination of enum xtd::forms::open_file_box_options to specify additional options to the file dialog box
/// @return xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
/// @remarks If xtd::forms::dialog_result is xtd::forms::dialog_result::ok, the output file_name parameter will contain the selected file path, otherwise it will be ignored.
static xtd::forms::dialog_result show(xtd::ustring& file_name, const xtd::ustring& title, const xtd::ustring& initial_directory, const xtd::ustring& filter, const open_file_box_options options);
/// @brief Displays a multiple file select dialog box in front of a specified window.
/// @param file_names An output std::vector <xtd::ustring> that will store the selected file names.
/// @param owner An xtd::forms::iwin32_window that represents the owner window of the file dialog box.
/// @return xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
/// @remarks If xtd::forms::dialog_result is xtd::forms::dialog_result::ok, the output file_names parameter will contain the selected file paths, otherwise it will be ignored.
static xtd::forms::dialog_result show(std::vector<xtd::ustring>& file_names, const xtd::forms::iwin32_window& owner, const xtd::ustring& title);
/// @brief Displays a multiple file select dialog box in front of a specified window.
/// @param file_names An output std::vector <xtd::ustring> that will store the selected file names.
/// @param owner An xtd::forms::iwin32_window that represents the owner window of the file dialog box.
/// @param title An xtd::ustring that specifies the caption title of the file dialog box.
/// @param options A bitwise combination of enum xtd::forms::open_file_box_options to specify additional options to the file dialog box
/// @return xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
/// @remarks If xtd::forms::dialog_result is xtd::forms::dialog_result::ok, the output file_names parameter will contain the selected file paths, otherwise it will be ignored.
static xtd::forms::dialog_result show(std::vector<xtd::ustring>& file_names, const xtd::forms::iwin32_window& owner, const xtd::ustring& title, const open_file_box_options options);
/// @brief Displays a multiple file select dialog box in front of a specified window.
/// @param file_names An output std::vector <xtd::ustring> that will store the selected file names.
/// @param owner An xtd::forms::iwin32_window that represents the owner window of the file dialog box.
/// @param title An xtd::ustring that specifies the caption title of the file dialog box.
/// @param initial_directory An xtd::ustring that specifies the initial directory displayed by the file dialog box
/// @return xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
/// @remarks If xtd::forms::dialog_result is xtd::forms::dialog_result::ok, the output file_names parameter will contain the selected file paths, otherwise it will be ignored.
static xtd::forms::dialog_result show(std::vector<xtd::ustring>& file_names, const xtd::forms::iwin32_window& owner, const xtd::ustring& title, const xtd::ustring& initial_directory);
/// @brief Displays a multiple file select dialog box in front of a specified window.
/// @param file_names An output std::vector <xtd::ustring> that will store the selected file names.
/// @param owner An xtd::forms::iwin32_window that represents the owner window of the file dialog box.
/// @param title An xtd::ustring that specifies the caption title of the file dialog box.
/// @param initial_directory An xtd::ustring that specifies the initial directory displayed by the file dialog box
/// @param options A bitwise combination of enum xtd::forms::open_file_box_options to specify additional options to the file dialog box
/// @return xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
/// @remarks If xtd::forms::dialog_result is xtd::forms::dialog_result::ok, the output file_names parameter will contain the selected file paths, otherwise it will be ignored.
static xtd::forms::dialog_result show(std::vector<xtd::ustring>& file_names, const xtd::forms::iwin32_window& owner, const xtd::ustring& title, const xtd::ustring& initial_directory, const open_file_box_options options);
/// @brief Displays a multiple file select dialog box in front of a specified window.
/// @param file_names An output std::vector <xtd::ustring> that will store the selected file names.
/// @param owner An xtd::forms::iwin32_window that represents the owner window of the file dialog box.
/// @param title An xtd::ustring that specifies the caption title of the file dialog box.
/// @param initial_directory An xtd::ustring that specifies the initial directory displayed by the file dialog box
/// @param filter An xtd::ustring that specifies the file name filter string, which determines the choices that appear in the "Save as file type" or "Files of type" box in the dialog box, separated by vertical bar | for example: @verbatim (*.txt)|*.txt|All files (*.*)|*.* @endverbatim
/// @return xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
/// @remarks If xtd::forms::dialog_result is ok, the output file_names parameter will contain the selected file paths, otherwise it will be ignored.
static xtd::forms::dialog_result show(std::vector<xtd::ustring>& file_names, const xtd::forms::iwin32_window& owner, const xtd::ustring& title, const xtd::ustring& initial_directory, const xtd::ustring& filter);
/// @brief Displays a multiple file select dialog box in front of a specified window.
/// @param file_names An output std::vector <xtd::ustring> that will store the selected file names.
/// @param owner An xtd::forms::iwin32_window that represents the owner window of the file dialog box.
/// @param title An xtd::ustring that specifies the caption title of the file dialog box.
/// @param initial_directory An xtd::ustring that specifies the initial directory displayed by the file dialog box
/// @param filter An xtd::ustring that specifies the file name filter string, which determines the choices that appear in the "Save as file type" or "Files of type" box in the dialog box, separated by vertical bar | for example: @verbatim (*.txt)|*.txt|All files (*.*)|*.* @endverbatim
/// @param options A bitwise combination of enum xtd::forms::open_file_box_options to specify additional options to the file dialog box
/// @return xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
/// @remarks If xtd::forms::dialog_result is xtd::forms::dialog_result::ok, the output file_names parameter will contain the selected file paths, otherwise it will be ignored.
static xtd::forms::dialog_result show(std::vector<xtd::ustring>& file_names, const xtd::forms::iwin32_window& owner, const xtd::ustring& title, const xtd::ustring& initial_directory, const xtd::ustring& filter, const open_file_box_options options);
/// @brief Displays a multiple file select dialog box.
/// @param file_names An output std::vector <xtd::ustring> that will store the selected file names.
/// @param title An xtd::ustring that specifies the caption title of the file dialog box.
/// @return xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
/// @remarks If xtd::forms::dialog_result is xtd::forms::dialog_result::ok, the output file_names parameter will contain the selected file paths, otherwise it will be ignored.
static xtd::forms::dialog_result show(std::vector<xtd::ustring>& file_names, const xtd::ustring& title);
/// @brief Displays a multiple file select dialog box.
/// @param file_names An output std::vector <xtd::ustring> that will store the selected file names.
/// @param title An xtd::ustring that specifies the caption title of the file dialog box.
/// @param options A bitwise combination of enum xtd::forms::open_file_box_options to specify additional options to the file dialog box
/// @return xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
/// @remarks If xtd::forms::dialog_result is xtd::forms::dialog_result::ok, the output file_names parameter will contain the selected file paths, otherwise it will be ignored.
static xtd::forms::dialog_result show(std::vector<xtd::ustring>& file_names, const xtd::ustring& title, const open_file_box_options options);
/// @brief Displays a multiple file select dialog box.
/// @param file_names An output std::vector <xtd::ustring> that will store the selected file names.
/// @param title An xtd::ustring that specifies the caption title of the file dialog box.
/// @param initial_directory An xtd::ustring that specifies the initial directory displayed by the file dialog box
/// @return xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
/// @remarks If xtd::forms::dialog_result is xtd::forms::dialog_result::ok, the output file_names parameter will contain the selected file paths, otherwise it will be ignored.
static xtd::forms::dialog_result show(std::vector<xtd::ustring>& file_names, const xtd::ustring& title, const xtd::ustring& initial_directory);
/// @brief Displays a multiple file select dialog box.
/// @param file_names An output std::vector <xtd::ustring> that will store the selected file names.
/// @param title An xtd::ustring that specifies the caption title of the file dialog box.
/// @param initial_directory An xtd::ustring that specifies the initial directory displayed by the file dialog box
/// @param options A bitwise combination of enum xtd::forms::open_file_box_options to specify additional options to the file dialog box
/// @return xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
/// @remarks If xtd::forms::dialog_result is ok, the output file_names parameter will contain the selected file paths, otherwise it will be ignored.
static xtd::forms::dialog_result show(std::vector<xtd::ustring>& file_names, const xtd::ustring& title, const xtd::ustring& initial_directory, const open_file_box_options options);
/// @brief Displays a multiple file select dialog box.
/// @param file_names An output std::vector <xtd::ustring> that will store the selected file names.
/// @param title An xtd::ustring that specifies the caption title of the file dialog box.
/// @param initial_directory An xtd::ustring that specifies the initial directory displayed by the file dialog box
/// @param filter An xtd::ustring that specifies the file name filter string, which determines the choices that appear in the "Save as file type" or "Files of type" box in the dialog box, separated by vertical bar | for example: @verbatim (*.txt)|*.txt|All files (*.*)|*.* @endverbatim
/// @return xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
/// @remarks If xtd::forms::dialog_result is ok, the output file_names parameter will contain the selected file paths, otherwise it will be ignored.
static xtd::forms::dialog_result show(std::vector<xtd::ustring>& file_names, const xtd::ustring& title, const xtd::ustring& initial_directory, const xtd::ustring& filter);
/// @brief Displays a multiple file select dialog box.
/// @param file_names An output std::vector <xtd::ustring> that will store the selected file names.
/// @param title An xtd::ustring that specifies the caption title of the file dialog box.
/// @param initial_directory An xtd::ustring that specifies the initial directory displayed by the file dialog box
/// @param filter An xtd::ustring that specifies the file name filter string, which determines the choices that appear in the "Save as file type" or "Files of type" box in the dialog box, separated by vertical bar | for example: @verbatim (*.txt)|*.txt|All files (*.*)|*.* @endverbatim
/// @param options A bitwise combination of enum xtd::forms::open_file_box_options to specify additional options to the file dialog box
/// @return xtd::forms::dialog_result::ok if the user clicks OK in the dialog box; otherwise, xtd::forms::dialog_result::cancel.
/// @remarks If xtd::forms::dialog_result is xtd::forms::dialog_result::ok, the output file_names parameter will contain the selected file paths, otherwise it will be ignored.
static xtd::forms::dialog_result show(std::vector<xtd::ustring>& file_names, const xtd::ustring& title, const xtd::ustring& initial_directory, const xtd::ustring& filter, const open_file_box_options options);
/// @}
private:
template<const bool multiselect, typename output_t>
static xtd::forms::dialog_result show_open_file_box(output_t& output, const xtd::ustring& title, const xtd::ustring& initial_directory = xtd::ustring::empty_string, const xtd::ustring& filter = xtd::ustring::empty_string, const open_file_box_options options = open_file_box_options::none, const xtd::forms::iwin32_window* owner = nullptr) {
auto dialog = xtd::forms::open_file_dialog {};
dialog.multiselect(multiselect)
.title(title)
.initial_directory(initial_directory)
.filter(filter)
.check_file_exists((options & open_file_box_options::check_file_exists) == open_file_box_options::check_file_exists)
.dereference_link((options & open_file_box_options::dereference_link) == open_file_box_options::dereference_link)
.validate_names((options & open_file_box_options::validate_names) == open_file_box_options::validate_names)
.restore_directory((options & open_file_box_options::restore_directory) == open_file_box_options::restore_directory)
.auto_upgrade_enabled((options & open_file_box_options::enable_auto_upgrade) == open_file_box_options::enable_auto_upgrade)
.show_hidden_files((options & open_file_box_options::show_hidden_files) == open_file_box_options::show_hidden_files)
.show_help((options & open_file_box_options::show_help) == open_file_box_options::show_help)
.show_preview((options & open_file_box_options::show_preview) == open_file_box_options::show_preview)
.support_multi_dotted_extensions((options & open_file_box_options::support_multi_dotted_extensions) == open_file_box_options::support_multi_dotted_extensions);
if constexpr(!multiselect) dialog.file_name(output);
const auto res = owner ? dialog.show_sheet_dialog(*owner) : dialog.show_dialog();
if (res != dialog_result::ok) return res;
if constexpr(multiselect) output = dialog.file_names();
else output = dialog.file_name();
return res;
}
};
}
}