xtd 0.2.0
Loading...
Searching...
No Matches
open_file_box.hpp
Go to the documentation of this file.
1
4#pragma once
7#include <xtd/static>
8
10namespace xtd {
12 namespace forms {
32 public:
34
48 static xtd::forms::dialog_result show(xtd::string& file_name, const xtd::forms::iwin32_window& owner, const xtd::string& title);
56 static xtd::forms::dialog_result show(xtd::string& file_name, const xtd::forms::iwin32_window& owner, const xtd::string& title, const open_file_box_options options);
64 static xtd::forms::dialog_result show(xtd::string& file_name, const xtd::forms::iwin32_window& owner, const xtd::string& title, const xtd::string& initial_directory);
73 static xtd::forms::dialog_result show(xtd::string& file_name, const xtd::forms::iwin32_window& owner, const xtd::string& title, const xtd::string& initial_directory, const open_file_box_options options);
82 static xtd::forms::dialog_result show(xtd::string& file_name, const xtd::forms::iwin32_window& owner, const xtd::string& title, const xtd::string& initial_directory, const xtd::string& filter);
92 static xtd::forms::dialog_result show(xtd::string& file_name, const xtd::forms::iwin32_window& owner, const xtd::string& title, const xtd::string& initial_directory, const xtd::string& filter, const open_file_box_options options);
103 static xtd::forms::dialog_result show(xtd::string& file_name, const xtd::string& title);
104
111 static xtd::forms::dialog_result show(xtd::string& file_name, const xtd::string& title, const open_file_box_options options);
118 static xtd::forms::dialog_result show(xtd::string& file_name, const xtd::string& title, const xtd::string& initial_directory);
126 static xtd::forms::dialog_result show(xtd::string& file_name, const xtd::string& title, const xtd::string& initial_directory, const open_file_box_options options);
134 static xtd::forms::dialog_result show(xtd::string& file_name, const xtd::string& title, const xtd::string& initial_directory, const xtd::string& filter);
143 static xtd::forms::dialog_result show(xtd::string& file_name, const xtd::string& title, const xtd::string& initial_directory, const xtd::string& filter, const open_file_box_options options);
149 static xtd::forms::dialog_result show(std::vector<xtd::string>& file_names, const xtd::forms::iwin32_window& owner, const xtd::string& title);
157 static xtd::forms::dialog_result show(std::vector<xtd::string>& file_names, const xtd::forms::iwin32_window& owner, const xtd::string& title, const open_file_box_options options);
165 static xtd::forms::dialog_result show(std::vector<xtd::string>& file_names, const xtd::forms::iwin32_window& owner, const xtd::string& title, const xtd::string& initial_directory);
174 static xtd::forms::dialog_result show(std::vector<xtd::string>& file_names, const xtd::forms::iwin32_window& owner, const xtd::string& title, const xtd::string& initial_directory, const open_file_box_options options);
183 static xtd::forms::dialog_result show(std::vector<xtd::string>& file_names, const xtd::forms::iwin32_window& owner, const xtd::string& title, const xtd::string& initial_directory, const xtd::string& filter);
193 static xtd::forms::dialog_result show(std::vector<xtd::string>& file_names, const xtd::forms::iwin32_window& owner, const xtd::string& title, const xtd::string& initial_directory, const xtd::string& filter, const open_file_box_options options);
199 static xtd::forms::dialog_result show(std::vector<xtd::string>& file_names, const xtd::string& title);
206 static xtd::forms::dialog_result show(std::vector<xtd::string>& file_names, const xtd::string& title, const open_file_box_options options);
213 static xtd::forms::dialog_result show(std::vector<xtd::string>& file_names, const xtd::string& title, const xtd::string& initial_directory);
221 static xtd::forms::dialog_result show(std::vector<xtd::string>& file_names, const xtd::string& title, const xtd::string& initial_directory, const open_file_box_options options);
229 static xtd::forms::dialog_result show(std::vector<xtd::string>& file_names, const xtd::string& title, const xtd::string& initial_directory, const xtd::string& filter);
238 static xtd::forms::dialog_result show(std::vector<xtd::string>& file_names, const xtd::string& title, const xtd::string& initial_directory, const xtd::string& filter, const open_file_box_options options);
240
241 private:
242 template<const bool multiselect, typename output_t>
243 static xtd::forms::dialog_result show_open_file_box(output_t& output, const xtd::string& title, const xtd::string& initial_directory = xtd::string::empty_string, const xtd::string& filter = xtd::string::empty_string, const open_file_box_options options = open_file_box_options::none, const xtd::forms::iwin32_window* owner = nullptr) {
244 auto dialog = xtd::forms::open_file_dialog {};
245 dialog.multiselect(multiselect)
246 .title(title)
247 .initial_directory(initial_directory)
248 .filter(filter)
249 .check_file_exists((options & open_file_box_options::check_file_exists) == open_file_box_options::check_file_exists)
250 .dereference_link((options & open_file_box_options::dereference_link) == open_file_box_options::dereference_link)
251 .validate_names((options & open_file_box_options::validate_names) == open_file_box_options::validate_names)
252 .restore_directory((options & open_file_box_options::restore_directory) == open_file_box_options::restore_directory)
253 .auto_upgrade_enabled((options & open_file_box_options::enable_auto_upgrade) == open_file_box_options::enable_auto_upgrade)
254 .show_hidden_files((options & open_file_box_options::show_hidden_files) == open_file_box_options::show_hidden_files)
255 .show_help((options & open_file_box_options::show_help) == open_file_box_options::show_help)
256 .show_preview((options & open_file_box_options::show_preview) == open_file_box_options::show_preview)
257 .support_multi_dotted_extensions((options & open_file_box_options::support_multi_dotted_extensions) == open_file_box_options::support_multi_dotted_extensions);
258 if constexpr(!multiselect) dialog.file_name(output);
259 const auto res = owner ? dialog.show_sheet_dialog(*owner) : dialog.show_dialog();
260 if (res != dialog_result::ok) return res;
261 if constexpr(multiselect) output = dialog.file_names();
262 else output = dialog.file_name();
263 return res;
264 }
265 };
266 }
267}
Represents text as a sequence of character units.
Definition basic_string.hpp:79
static const basic_string empty_string
Represents the empty basic_string.
Definition basic_string.hpp:124
Provides an interface to expose Win32 HWND handles.
Definition iwin32_window.hpp:23
Represents a common dialog box that displays a file selection dialog. This class cannot be inherited.
Definition open_file_box.hpp:31
static xtd::forms::dialog_result show(xtd::string &file_name, const xtd::forms::iwin32_window &owner, const xtd::string &title, const open_file_box_options options)
Displays a select file dialog box in front of a specified window.
static xtd::forms::dialog_result show(std::vector< xtd::string > &file_names, const xtd::string &title, const xtd::string &initial_directory, const xtd::string &filter, const open_file_box_options options)
Displays a multiple file select dialog box.
static xtd::forms::dialog_result show(std::vector< xtd::string > &file_names, const xtd::string &title, const xtd::string &initial_directory)
Displays a multiple file select dialog box.
static xtd::forms::dialog_result show(xtd::string &file_name, const xtd::string &title, const xtd::string &initial_directory)
Displays a select file dialog box.
static xtd::forms::dialog_result show(std::vector< xtd::string > &file_names, const xtd::forms::iwin32_window &owner, const xtd::string &title)
Displays a multiple file select dialog box in front of a specified window.
static xtd::forms::dialog_result show(xtd::string &file_name, const xtd::forms::iwin32_window &owner, const xtd::string &title, const xtd::string &initial_directory, const xtd::string &filter, const open_file_box_options options)
Displays a select file dialog box in front of a specified window.
static xtd::forms::dialog_result show(std::vector< xtd::string > &file_names, const xtd::forms::iwin32_window &owner, const xtd::string &title, const xtd::string &initial_directory, const xtd::string &filter)
Displays a multiple file select dialog box in front of a specified window.
static xtd::forms::dialog_result show(std::vector< xtd::string > &file_names, const xtd::string &title, const xtd::string &initial_directory, const xtd::string &filter)
Displays a multiple file select dialog box.
static xtd::forms::dialog_result show(std::vector< xtd::string > &file_names, const xtd::forms::iwin32_window &owner, const xtd::string &title, const xtd::string &initial_directory)
Displays a multiple file select dialog box in front of a specified window.
static xtd::forms::dialog_result show(xtd::string &file_name, const xtd::string &title)
Displays a select file dialog box.
static xtd::forms::dialog_result show(xtd::string &file_name)
Displays a select file dialog box.
static xtd::forms::dialog_result show(std::vector< xtd::string > &file_names, const xtd::string &title, const xtd::string &initial_directory, const open_file_box_options options)
Displays a multiple file select dialog box.
static xtd::forms::dialog_result show(xtd::string &file_name, const xtd::forms::iwin32_window &owner, const xtd::string &title)
Displays a select file dialog box in front of a specified window.
static xtd::forms::dialog_result show(xtd::string &file_name, const xtd::string &title, const xtd::string &initial_directory, const xtd::string &filter, const open_file_box_options options)
Displays a select file dialog box.
static xtd::forms::dialog_result show(xtd::string &file_name, const xtd::string &title, const xtd::string &initial_directory, const xtd::string &filter)
Displays a select file dialog box.
static xtd::forms::dialog_result show(xtd::string &file_name, const xtd::forms::iwin32_window &owner, const xtd::string &title, const xtd::string &initial_directory, const open_file_box_options options)
Displays a select file dialog box in front of a specified window.
static xtd::forms::dialog_result show(std::vector< xtd::string > &file_names, const xtd::string &title, const open_file_box_options options)
Displays a multiple file select dialog box.
static xtd::forms::dialog_result show(xtd::string &file_name, const xtd::string &title, const xtd::string &initial_directory, const open_file_box_options options)
Displays a select file dialog box.
static xtd::forms::dialog_result show(xtd::string &file_name, const xtd::forms::iwin32_window &owner, const xtd::string &title, const xtd::string &initial_directory, const xtd::string &filter)
Displays a select file dialog box in front of a specified window.
static xtd::forms::dialog_result show(std::vector< xtd::string > &file_names, const xtd::forms::iwin32_window &owner, const xtd::string &title, const xtd::string &initial_directory, const open_file_box_options options)
Displays a multiple file select dialog box in front of a specified window.
static xtd::forms::dialog_result show(xtd::string &file_name, const xtd::forms::iwin32_window &owner, const xtd::string &title, const xtd::string &initial_directory)
Displays a select file dialog box in front of a specified window.
static xtd::forms::dialog_result show(std::vector< xtd::string > &file_names, const xtd::forms::iwin32_window &owner, const xtd::string &title, const xtd::string &initial_directory, const xtd::string &filter, const open_file_box_options options)
Displays a multiple file select dialog box in front of a specified window.
static xtd::forms::dialog_result show(std::vector< xtd::string > &file_names, const xtd::string &title)
Displays a multiple file select dialog box.
static xtd::forms::dialog_result show(xtd::string &file_name, const xtd::forms::iwin32_window &owner)
Displays a select file dialog box in front of a specified window.
static xtd::forms::dialog_result show(std::vector< xtd::string > &file_names, const xtd::forms::iwin32_window &owner, const xtd::string &title, const open_file_box_options options)
Displays a multiple file select dialog box in front of a specified window.
static xtd::forms::dialog_result show(xtd::string &file_name, const xtd::string &title, const open_file_box_options options)
Displays a select file dialog box.
Displays a standard dialog box that prompts the user to open a file. This class cannot be inherited.
Definition open_file_dialog.hpp:30
virtual bool multiselect() const noexcept
Gets a value indicating whether the dialog box allows multiple files to be selected.
#define static_
This keyword is use to represent a static object. A static object can't be instantiated (constructors...
Definition static.hpp:37
#define forms_export_
Define shared library export.
Definition forms_export.hpp:13
open_file_box_options
Specifies options on a xtd::forms::open_file_box.
Definition open_file_box_options.hpp:22
dialog_result
Specifies identifiers to indicate the return value of a dialog box.
Definition dialog_result.hpp:43
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition xtd_about_box.hpp:12
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10
Contains xtd::forms::open_file_box_options control.
Contains xtd::forms::open_file_dialog dialog.