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.
open_file_dialog.h
Go to the documentation of this file.
1 #pragma once
5 #include <xtd/io/file.h>
6 #include "file_dialog.h"
7 
9 namespace xtd {
11  namespace forms {
21  class forms_export_ open_file_dialog final : public file_dialog {
22  public:
24  open_file_dialog() = default;
25 
28  std::ifstream open_file() const {return io::file::open_read(xtd::ustring(file_name_));}
29 
33  virtual bool multiselect() const {return get_option(OFN_ALLOWMULTISELECT);}
38  virtual open_file_dialog& multiselect(bool value) {
39  set_option(OFN_ALLOWMULTISELECT, value);
40  return *this;
41  }
42 
43  private:
44  bool run_file_dialog(intptr_t hwnd_owner) override;
45  void run_file_sheet(intptr_t owner) override;
46  };
47  }
48 }
Displays a dialog box from which the user can select a file.
Definition: file_dialog.h:41
virtual bool multiselect() const
Gets a value indicating whether the dialog box allows multiple files to be selected.
Definition: open_file_dialog.h:33
Contains xtd::forms::file_dialog dialog.
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
Contains xtd::io::file class.
static std::ifstream open_read(const xtd::ustring &path)
Opens an existing file for reading.
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:48
std::ifstream open_file() const
Opens the file with read only permission selected by the user.
Definition: open_file_dialog.h:28
virtual open_file_dialog & multiselect(bool value)
Sets a value indicating whether the dialog box allows multiple files to be selected.
Definition: open_file_dialog.h:38
Displays a standard dialog box that prompts the user to open a file. This class cannot be inherited...
Definition: open_file_dialog.h:21
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13