xtd 0.2.0
Loading...
Searching...
No Matches
open_file_box.h
Go to the documentation of this file.
1
4#pragma once
6#include "open_file_dialog.h"
7#include <xtd/static>
8
10namespace xtd {
12 namespace forms {
30 public:
32
54 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);
62 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);
71 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);
80 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);
90 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);
101 static xtd::forms::dialog_result show(xtd::ustring& file_name, const xtd::ustring& title);
102
109 static xtd::forms::dialog_result show(xtd::ustring& file_name, const xtd::ustring& title, const open_file_box_options options);
116 static xtd::forms::dialog_result show(xtd::ustring& file_name, const xtd::ustring& title, const xtd::ustring& initial_directory);
124 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);
132 static xtd::forms::dialog_result show(xtd::ustring& file_name, const xtd::ustring& title, const xtd::ustring& initial_directory, const xtd::ustring& filter);
141 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);
147 static xtd::forms::dialog_result show(std::vector<xtd::ustring>& file_names, const xtd::forms::iwin32_window& owner, const xtd::ustring& title);
155 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);
163 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);
172 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);
181 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);
191 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);
197 static xtd::forms::dialog_result show(std::vector<xtd::ustring>& file_names, const xtd::ustring& title);
204 static xtd::forms::dialog_result show(std::vector<xtd::ustring>& file_names, const xtd::ustring& title, const open_file_box_options options);
211 static xtd::forms::dialog_result show(std::vector<xtd::ustring>& file_names, const xtd::ustring& title, const xtd::ustring& initial_directory);
219 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);
227 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);
236 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);
238
239 private:
240 template<const bool multiselect, typename output_t>
241 static xtd::forms::dialog_result show_open_file_box(output_t& output, const xtd::ustring& title, const xtd::ustring& initial_directory = "", const xtd::ustring& filter = "", const open_file_box_options options = open_file_box_options::none, const xtd::forms::iwin32_window* owner = nullptr) {
242 auto dialog = xtd::forms::open_file_dialog {};
243 dialog.multiselect(multiselect)
244 .title(title)
245 .initial_directory(initial_directory)
246 .filter(filter)
247 .check_file_exists((options & open_file_box_options::check_file_exists) == open_file_box_options::check_file_exists)
248 .dereference_link((options & open_file_box_options::dereference_link) == open_file_box_options::dereference_link)
249 .validate_names((options & open_file_box_options::validate_names) == open_file_box_options::validate_names)
250 .restore_directory((options & open_file_box_options::restore_directory) == open_file_box_options::restore_directory)
251 .auto_upgrade_enabled((options & open_file_box_options::enable_auto_upgrade) == open_file_box_options::enable_auto_upgrade)
252 .show_hidden_files((options & open_file_box_options::show_hidden_files) == open_file_box_options::show_hidden_files)
253 .show_help((options & open_file_box_options::show_help) == open_file_box_options::show_help)
254 .show_preview((options & open_file_box_options::show_preview) == open_file_box_options::show_preview)
255 .support_multi_dotted_extensions((options & open_file_box_options::support_multi_dotted_extensions) == open_file_box_options::support_multi_dotted_extensions);
256 if constexpr(!multiselect) dialog.file_name(output);
257 const auto res = owner ? dialog.show_sheet_dialog(*owner) : dialog.show_dialog();
258 if (res != dialog_result::ok) return res;
259 if constexpr(multiselect) output = dialog.file_names();
260 else output = dialog.file_name();
261 return res;
262 }
263 };
264 }
265}
Provides an interface to expose Win32 HWND handles.
Definition iwin32_window.h:21
Represents a common dialog box that displays a file selection dialog. This class cannot be inherited.
Definition open_file_box.h:29
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)
Displays a multiple file select dialog box in front of a specified window.
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)
Displays a select file dialog box in front of a specified window.
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)
Displays a select file dialog box.
static xtd::forms::dialog_result show(std::vector< xtd::ustring > &file_names, const xtd::forms::iwin32_window &owner, const xtd::ustring &title)
Displays a multiple file select dialog box in front of a specified window.
static xtd::forms::dialog_result show(xtd::ustring &file_name, const xtd::ustring &title)
Displays a select file dialog box.
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)
Displays a select file dialog box in front of a specified window.
static xtd::forms::dialog_result show(xtd::ustring &file_name, const xtd::forms::iwin32_window &owner, const xtd::ustring &title)
Displays a select file dialog box in front of a specified window.
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)
Displays a multiple file select dialog box in front of a specified window.
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)
Displays a multiple file select dialog box.
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)
Displays a multiple file select dialog box.
static xtd::forms::dialog_result show(std::vector< xtd::ustring > &file_names, const xtd::ustring &title)
Displays a multiple file select dialog box.
static xtd::forms::dialog_result show(xtd::ustring &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::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)
Displays a multiple file select dialog box in front of a specified window.
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)
Displays a select file dialog box in front of a specified window.
static xtd::forms::dialog_result show(xtd::ustring &file_name)
Displays a select file dialog box.
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)
Displays a multiple file select dialog box in front of a specified window.
static xtd::forms::dialog_result show(xtd::ustring &file_name, const xtd::ustring &title, const xtd::ustring &initial_directory, const xtd::ustring &filter)
Displays a select file dialog box.
static xtd::forms::dialog_result show(std::vector< xtd::ustring > &file_names, const xtd::ustring &title, const open_file_box_options options)
Displays a multiple file select dialog box.
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)
Displays a select file dialog box.
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)
Displays a multiple file select dialog box in front of a specified window.
static xtd::forms::dialog_result show(xtd::ustring &file_name, const xtd::ustring &title, const xtd::ustring &initial_directory)
Displays a select file dialog box.
static xtd::forms::dialog_result show(std::vector< xtd::ustring > &file_names, const xtd::ustring &title, const xtd::ustring &initial_directory)
Displays a multiple file select dialog box.
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)
Displays a select file dialog box in front of a specified window.
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)
Displays a multiple file select dialog box.
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)
Displays a select file dialog box in front of a specified window.
static xtd::forms::dialog_result show(xtd::ustring &file_name, const xtd::ustring &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.h:28
virtual bool multiselect() const noexcept
Gets a value indicating whether the dialog box allows multiple files to be selected.
Represents text as a sequence of UTF-8 code units.
Definition ustring.h:47
#define static_
This keyword is use to represent a static object. A static object can't be instantiated (constructors...
Definition static.h:37
#define forms_export_
Define shared library export.
Definition forms_export.h:13
open_file_box_options
Specifies options on a xtd::forms::open_file_box.
Definition open_file_box_options.h:20
dialog_result
Specifies identifiers to indicate the return value of a dialog box.
Definition dialog_result.h:41
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition xtd_about_box.h:12
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
Contains xtd::forms::open_file_box_options control.
Contains xtd::forms::open_file_dialog dialog.