xtd 1.0.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
41 [[nodiscard]] static auto show(xtd::string& file_name, const xtd::forms::iwin32_window& owner) -> xtd::forms::dialog_result;
48 [[nodiscard]] static auto show(xtd::string& file_name, const xtd::forms::iwin32_window& owner, const xtd::string& title) -> xtd::forms::dialog_result;
56 [[nodiscard]] static auto show(xtd::string& file_name, const xtd::forms::iwin32_window& owner, const xtd::string& title, const xtd::forms::open_file_box_options options) -> xtd::forms::dialog_result;
64 [[nodiscard]] static auto show(xtd::string& file_name, const xtd::forms::iwin32_window& owner, const xtd::string& title, const xtd::string& initial_directory) -> xtd::forms::dialog_result;
73 [[nodiscard]] static auto show(xtd::string& file_name, const xtd::forms::iwin32_window& owner, const xtd::string& title, const xtd::string& initial_directory, const xtd::forms::open_file_box_options options) -> xtd::forms::dialog_result;
82 [[nodiscard]] static auto show(xtd::string& file_name, const xtd::forms::iwin32_window& owner, const xtd::string& title, const xtd::string& initial_directory, const xtd::string& filter) -> xtd::forms::dialog_result;
92 [[nodiscard]] static auto 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 xtd::forms::open_file_box_options options) -> xtd::forms::dialog_result;
97 [[nodiscard]] static auto show(xtd::string& file_name) -> xtd::forms::dialog_result;
103 [[nodiscard]] static auto show(xtd::string& file_name, const xtd::string& title) -> xtd::forms::dialog_result;
104
111 [[nodiscard]] static auto show(xtd::string& file_name, const xtd::string& title, const xtd::forms::open_file_box_options options) -> xtd::forms::dialog_result;
118 [[nodiscard]] static auto show(xtd::string& file_name, const xtd::string& title, const xtd::string& initial_directory) -> xtd::forms::dialog_result;
126 [[nodiscard]] static auto show(xtd::string& file_name, const xtd::string& title, const xtd::string& initial_directory, const xtd::forms::open_file_box_options options) -> xtd::forms::dialog_result;
134 [[nodiscard]] static auto show(xtd::string& file_name, const xtd::string& title, const xtd::string& initial_directory, const xtd::string& filter) -> xtd::forms::dialog_result;
143 [[nodiscard]] static auto show(xtd::string& file_name, const xtd::string& title, const xtd::string& initial_directory, const xtd::string& filter, const xtd::forms::open_file_box_options options) -> xtd::forms::dialog_result;
149 [[nodiscard]] static auto show(xtd::array<xtd::string>& file_names, const xtd::forms::iwin32_window& owner, const xtd::string& title) -> xtd::forms::dialog_result;
157 [[nodiscard]] static auto show(xtd::array<xtd::string>& file_names, const xtd::forms::iwin32_window& owner, const xtd::string& title, const xtd::forms::open_file_box_options options) -> xtd::forms::dialog_result;
165 [[nodiscard]] static auto show(xtd::array<xtd::string>& file_names, const xtd::forms::iwin32_window& owner, const xtd::string& title, const xtd::string& initial_directory) -> xtd::forms::dialog_result;
174 [[nodiscard]] static auto show(xtd::array<xtd::string>& file_names, const xtd::forms::iwin32_window& owner, const xtd::string& title, const xtd::string& initial_directory, const xtd::forms::open_file_box_options options) -> xtd::forms::dialog_result;
183 [[nodiscard]] static auto 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) -> xtd::forms::dialog_result;
193 [[nodiscard]] static auto 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 xtd::forms::open_file_box_options options) -> xtd::forms::dialog_result;
199 [[nodiscard]] static auto show(xtd::array<xtd::string>& file_names, const xtd::string& title) -> xtd::forms::dialog_result;
206 [[nodiscard]] static auto show(xtd::array<xtd::string>& file_names, const xtd::string& title, const xtd::forms::open_file_box_options options) -> xtd::forms::dialog_result;
213 [[nodiscard]] static auto show(xtd::array<xtd::string>& file_names, const xtd::string& title, const xtd::string& initial_directory) -> xtd::forms::dialog_result;
221 [[nodiscard]] static auto show(xtd::array<xtd::string>& file_names, const xtd::string& title, const xtd::string& initial_directory, const xtd::forms::open_file_box_options options) -> xtd::forms::dialog_result;
229 [[nodiscard]] static auto show(xtd::array<xtd::string>& file_names, const xtd::string& title, const xtd::string& initial_directory, const xtd::string& filter) -> xtd::forms::dialog_result;
238 [[nodiscard]] static auto show(xtd::array<xtd::string>& file_names, const xtd::string& title, const xtd::string& initial_directory, const xtd::string& filter, const xtd::forms::open_file_box_options options) -> xtd::forms::dialog_result;
240
241 private:
242 template<const bool multiselect, typename output_t>
243 [[nodiscard]] static auto 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 xtd::forms::open_file_box_options options = xtd::forms::open_file_box_options::none, const xtd::forms::iwin32_window* owner = nullptr) -> xtd::forms::dialog_result {
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:64
static const basic_string empty_string
Definition basic_string.hpp:111
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 auto show(xtd::array< xtd::string > &file_names, const xtd::string &title) -> xtd::forms::dialog_result
Displays a multiple file select dialog box.
static auto show(xtd::string &file_name, const xtd::forms::iwin32_window &owner, const xtd::string &title, const xtd::string &initial_directory) -> xtd::forms::dialog_result
Displays a select file dialog box in front of a specified window.
static auto show(xtd::array< xtd::string > &file_names, const xtd::string &title, const xtd::string &initial_directory, const xtd::string &filter) -> xtd::forms::dialog_result
Displays a multiple file select dialog box.
static auto 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 xtd::forms::open_file_box_options options) -> xtd::forms::dialog_result
Displays a multiple file select dialog box in front of a specified window.
static auto 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 xtd::forms::open_file_box_options options) -> xtd::forms::dialog_result
Displays a select file dialog box in front of a specified window.
static auto show(xtd::array< xtd::string > &file_names, const xtd::string &title, const xtd::string &initial_directory) -> xtd::forms::dialog_result
Displays a multiple file select dialog box.
static auto show(xtd::array< xtd::string > &file_names, const xtd::string &title, const xtd::string &initial_directory, const xtd::forms::open_file_box_options options) -> xtd::forms::dialog_result
Displays a multiple file select dialog box.
static auto show(xtd::string &file_name, const xtd::forms::iwin32_window &owner, const xtd::string &title, const xtd::string &initial_directory, const xtd::string &filter) -> xtd::forms::dialog_result
Displays a select file dialog box in front of a specified window.
static auto show(xtd::array< xtd::string > &file_names, const xtd::forms::iwin32_window &owner, const xtd::string &title, const xtd::string &initial_directory) -> xtd::forms::dialog_result
Displays a multiple file select dialog box in front of a specified window.
static auto show(xtd::string &file_name, const xtd::string &title, const xtd::string &initial_directory) -> xtd::forms::dialog_result
Displays a select file dialog box.
static auto show(xtd::string &file_name, const xtd::string &title, const xtd::string &initial_directory, const xtd::string &filter) -> xtd::forms::dialog_result
Displays a select file dialog box.
static auto show(xtd::string &file_name, const xtd::string &title, const xtd::string &initial_directory, const xtd::string &filter, const xtd::forms::open_file_box_options options) -> xtd::forms::dialog_result
Displays a select file dialog box.
static auto show(xtd::array< xtd::string > &file_names, const xtd::forms::iwin32_window &owner, const xtd::string &title) -> xtd::forms::dialog_result
Displays a multiple file select dialog box in front of a specified window.
static auto show(xtd::string &file_name, const xtd::forms::iwin32_window &owner, const xtd::string &title) -> xtd::forms::dialog_result
Displays a select file dialog box in front of a specified window.
static auto show(xtd::array< xtd::string > &file_names, const xtd::string &title, const xtd::string &initial_directory, const xtd::string &filter, const xtd::forms::open_file_box_options options) -> xtd::forms::dialog_result
Displays a multiple file select dialog box.
static auto 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) -> xtd::forms::dialog_result
Displays a multiple file select dialog box in front of a specified window.
static auto show(xtd::array< xtd::string > &file_names, const xtd::string &title, const xtd::forms::open_file_box_options options) -> xtd::forms::dialog_result
Displays a multiple file select dialog box.
static auto show(xtd::string &file_name, const xtd::forms::iwin32_window &owner, const xtd::string &title, const xtd::forms::open_file_box_options options) -> xtd::forms::dialog_result
Displays a select file dialog box in front of a specified window.
static auto show(xtd::string &file_name, const xtd::string &title, const xtd::string &initial_directory, const xtd::forms::open_file_box_options options) -> xtd::forms::dialog_result
Displays a select file dialog box.
static auto show(xtd::string &file_name, const xtd::string &title) -> xtd::forms::dialog_result
Displays a select file dialog box.
static auto show(xtd::array< xtd::string > &file_names, const xtd::forms::iwin32_window &owner, const xtd::string &title, const xtd::string &initial_directory, const xtd::forms::open_file_box_options options) -> xtd::forms::dialog_result
Displays a multiple file select dialog box in front of a specified window.
static auto show(xtd::string &file_name, const xtd::forms::iwin32_window &owner) -> xtd::forms::dialog_result
Displays a select file dialog box in front of a specified window.
static auto show(xtd::array< xtd::string > &file_names, const xtd::forms::iwin32_window &owner, const xtd::string &title, const xtd::forms::open_file_box_options options) -> xtd::forms::dialog_result
Displays a multiple file select dialog box in front of a specified window.
static auto show(xtd::string &file_name, const xtd::string &title, const xtd::forms::open_file_box_options options) -> xtd::forms::dialog_result
Displays a select file dialog box.
static auto show(xtd::string &file_name, const xtd::forms::iwin32_window &owner, const xtd::string &title, const xtd::string &initial_directory, const xtd::forms::open_file_box_options options) -> xtd::forms::dialog_result
Displays a select file dialog box in front of a specified window.
static auto show(xtd::string &file_name) -> xtd::forms::dialog_result
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
auto multiselect() const noexcept -> bool
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:38
#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.