xtd - Reference Guide  0.2.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
save_file_box.h
Go to the documentation of this file.
1 #pragma once
5 #include <xtd/static.h>
6 #include "save_file_dialog.h"
8 
10 namespace xtd {
12  namespace forms {
22  class save_file_box final static_{
23  public:
30  static xtd::forms::dialog_result show(xtd::ustring& file_name, const xtd::forms::iwin32_window& owner, const xtd::ustring& title) { return show_save_file_box(file_name, title, "", "", save_file_box_options::none, &owner); }
31 
39  static xtd::forms::dialog_result show(xtd::ustring& file_name, const xtd::forms::iwin32_window& owner, const xtd::ustring& title, const save_file_box_options options) { return show_save_file_box(file_name, title, "", "", options, &owner); }
40 
48  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) { return show_save_file_box(file_name, title, initial_directory, "", save_file_box_options::none, &owner); }
49 
58  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 save_file_box_options options) { return show_save_file_box(file_name, title, initial_directory, "", options, &owner); }
59 
68  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) { return show_save_file_box(file_name, title, initial_directory, filter, save_file_box_options::none, &owner); }
69 
79  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 save_file_box_options options) { return show_save_file_box(file_name, title, initial_directory, filter, options, &owner); }
80 
86  static xtd::forms::dialog_result show(xtd::ustring& file_name, const xtd::ustring& title) { return show_save_file_box(file_name, title, "", "", save_file_box_options::none, nullptr); }
87 
94  static xtd::forms::dialog_result show(xtd::ustring& file_name, const xtd::ustring& title, const save_file_box_options options) { return show_save_file_box(file_name, title, "", "", options, nullptr); }
95 
102  static xtd::forms::dialog_result show(xtd::ustring& file_name, const xtd::ustring& title, const xtd::ustring& initial_directory) { return show_save_file_box(file_name, title, initial_directory, "", save_file_box_options::none, nullptr); }
103 
111  static xtd::forms::dialog_result show(xtd::ustring& file_name, const xtd::ustring& title, const xtd::ustring& initial_directory, const save_file_box_options options) { return show_save_file_box(file_name, title, initial_directory, "", options, nullptr); }
112 
120  static xtd::forms::dialog_result show(xtd::ustring& file_name, const xtd::ustring& title, const xtd::ustring& initial_directory, const xtd::ustring& filter) { return show_save_file_box(file_name, title, initial_directory, filter, save_file_box_options::none, nullptr); }
121 
130  static xtd::forms::dialog_result show(xtd::ustring& file_name, const xtd::ustring& title, const xtd::ustring& initial_directory, const xtd::ustring& filter, const save_file_box_options options) { return show_save_file_box(file_name, title, initial_directory, filter, options, nullptr); }
131 
132  private:
133  static xtd::forms::dialog_result show_save_file_box(xtd::ustring& output, const xtd::ustring& title, const xtd::ustring& initial_directory = "", const xtd::ustring& filter = "", const save_file_box_options options = save_file_box_options::none, const iwin32_window* owner = nullptr) {
135  dialog.title(title)
136  .initial_directory(initial_directory)
137  .file_name(output)
138  .filter(filter)
139  .check_file_exists(options & save_file_box_options::check_file_exists)
140  .dereference_link(options & save_file_box_options::dereference_link)
141  .validate_names(options & save_file_box_options::validate_names)
142  .restore_directory(options & save_file_box_options::restore_directory)
143  .auto_upgrade_enabled(options & save_file_box_options::enable_auto_upgrade)
144  .show_hidden_files(options & save_file_box_options::show_hidden_files)
145  .show_help(options & save_file_box_options::show_help)
146  .show_preview(options & save_file_box_options::show_preview)
147  .support_multi_dotted_extensions(options & save_file_box_options::support_multi_dotted_extensions);
148  const auto res = owner ? dialog.show_sheet_dialog(*owner) : dialog.show_dialog();
149  if (res == dialog_result::ok) {
150  output = dialog.file_name();
151  }
152  return res;
153  }
154  };
155  }
156 }
Contains xtd::static_object class.
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 save file dialog box.
Definition: save_file_box.h:120
Whether preview file is displayed in the file dialog box.
dialog_result
Specifies identifiers to indicate the return value of a dialog box.
Definition: dialog_result.h:39
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 save_file_box_options options)
Displays a save file dialog box in front of a specified window.
Definition: save_file_box.h:58
#define static_
This keyword is use to represent a static object. A static object can&#39;t be instantiated (constructors...
Definition: static.h:38
Contains xtd::forms::save_file_box_options control.
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 save_file_box_options options)
Displays a save file dialog box in front of a specified window.
Definition: save_file_box.h:79
Whether this xtd::forms::file_dialog instance should automatically upgrade appearance and behavior wh...
Whether the dialog box displays a warning if the user specifies a file name that does not exist...
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
Represents a common dialog box that displays a file save dialog to the user to select a location for ...
Definition: save_file_box.h:22
Whether the dialog box supports displaying and saving files that have multiple file name extensions...
save_file_box_options
Specifies options on a xtd::forms::save_file_box.
Definition: save_file_box_options.h:18
Whether the dialog box returns the location of the file referenced by the shortcut (...
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:48
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 save file dialog box in front of a specified window.
Definition: save_file_box.h:48
Prompts the user to select a location for saving a file. This class cannot be inherited.
Definition: save_file_dialog.h:21
Whether the Help button is displayed in the file dialog box.
Whether the dialog box accepts only valid file names.
Provides an interface to expose Win32 HWND handles.
Definition: iwin32_window.h:19
static xtd::forms::dialog_result show(xtd::ustring &file_name, const xtd::forms::iwin32_window &owner, const xtd::ustring &title)
Displays a save file dialog box in front of a specified window.
Definition: save_file_box.h:30
Whether the dialog box restores the directory to the previously selected directory before closing...
static xtd::forms::dialog_result show(xtd::ustring &file_name, const xtd::ustring &title, const xtd::ustring &initial_directory)
Displays a save file dialog box.
Definition: save_file_box.h:102
static xtd::forms::dialog_result show(xtd::ustring &file_name, const xtd::ustring &title)
Displays a save file dialog box.
Definition: save_file_box.h:86
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 save file dialog box in front of a specified window.
Definition: save_file_box.h:68
Whether hidden files are displayed in the file dialog box.
static xtd::forms::dialog_result show(xtd::ustring &file_name, const xtd::ustring &title, const save_file_box_options options)
Displays a select file dialog box.
Definition: save_file_box.h:94
static xtd::forms::dialog_result show(xtd::ustring &file_name, const xtd::ustring &title, const xtd::ustring &initial_directory, const save_file_box_options options)
Displays a save file dialog box.
Definition: save_file_box.h:111
static xtd::forms::dialog_result show(xtd::ustring &file_name, const xtd::forms::iwin32_window &owner, const xtd::ustring &title, const save_file_box_options options)
Displays a save file dialog box in front of a specified window.
Definition: save_file_box.h:39
virtual const xtd::ustring & title() const
Gets the file dialog box title.
Definition: file_dialog.h:270
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
static xtd::forms::dialog_result show(xtd::ustring &file_name, const xtd::ustring &title, const xtd::ustring &initial_directory, const xtd::ustring &filter, const save_file_box_options options)
Displays a save file dialog box.
Definition: save_file_box.h:130
The dialog box return value is OK (usually sent from a button labeled OK).
Contains xtd::forms::save_file_dialog dialog.