xtd 0.2.0
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);
165 static xtd::forms::dialog_result show(xtd::array<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(xtd::array<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(xtd::array<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(xtd::array<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);
213 static xtd::forms::dialog_result show(xtd::array<xtd::string>& file_names, const xtd::string& title, const xtd::string& initial_directory);
221 static xtd::forms::dialog_result show(xtd::array<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(xtd::array<xtd::string>& file_names, const xtd::string& title, const xtd::string& initial_directory, const xtd::string& filter);
238 static xtd::forms::dialog_result show(xtd::array<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, class 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)
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}
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:61
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(xtd::array< 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::array< 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(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(xtd::array< 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(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(xtd::array< 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(xtd::array< 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)
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(xtd::array< 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::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::array< 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, 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(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(xtd::array< 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::array< 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)
Displays a select file dialog box in front of a specified window.
static xtd::forms::dialog_result show(xtd::array< 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(xtd::string &file_name, const xtd::string &title, const open_file_box_options options)
Displays a select file dialog box.
static xtd::forms::dialog_result show(xtd::array< 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(xtd::array< 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.
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
xtd::basic_string< char > string
Represents text as a sequence of UTF-8 code units.
Definition __string_definitions.hpp:43
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
@ validate_names
Whether the dialog box accepts only valid file names.
Definition open_file_box_options.hpp:30
@ enable_auto_upgrade
Whether this xtd::forms::file_dialog instance should automatically upgrade appearance and behavior wh...
Definition open_file_box_options.hpp:34
@ none
No options.
Definition open_file_box_options.hpp:24
@ dereference_link
Whether the dialog box returns the location of the file referenced by the shortcut (....
Definition open_file_box_options.hpp:28
@ show_hidden_files
Whether hidden files are displayed in the file dialog box.
Definition open_file_box_options.hpp:36
@ check_file_exists
Whether the dialog box displays a warning if the user specifies a file name that does not exist.
Definition open_file_box_options.hpp:26
@ restore_directory
Whether the dialog box restores the directory to the previously selected directory before closing.
Definition open_file_box_options.hpp:32
@ show_preview
Whether preview file is displayed in the file dialog box.
Definition open_file_box_options.hpp:40
@ support_multi_dotted_extensions
Whether the dialog box supports displaying and saving files that have multiple file name extensions.
Definition open_file_box_options.hpp:42
@ show_help
Whether the Help button is displayed in the file dialog box.
Definition open_file_box_options.hpp:38
@ ok
The dialog box return value is OK (usually sent from a button labeled OK).
Definition dialog_result.hpp:47
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition texts.hpp:219
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
Contains xtd::forms::open_file_box_options control.
Contains xtd::forms::open_file_dialog dialog.