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.
folder_browser_dialog.h
Go to the documentation of this file.
1 #pragma once
5 #include <xtd/environment.h>
6 #include <xtd/forms/browser_info_flags.h>
7 #include "common_dialog.h"
8 
10 namespace xtd {
12  namespace forms {
22  class forms_export_ folder_browser_dialog final : public common_dialog {
23  public:
25 
32  folder_browser_dialog() = default;
34 
36 
40  bool auto_upgrade_enable() const {return get_option(BIF_USENEWUI);}
45  set_option(BIF_USENEWUI, value);
46  return *this;
47  }
48 
52  const xtd::ustring& description() const {return description_;}
58  description_ = value;
59  return *this;
60  }
61 
65  environment::special_folder root_folder() const {return root_folder_;}
71  root_folder_ = value;
72  return *this;
73  }
78  const xtd::ustring& selected_path() const {return selected_path_;}
85  selected_path_ = value;
86  return *this;
87  }
88 
92  bool show_new_folder_button() const {return !get_option(BIF_NONEWFOLDERBUTTON);}
97  set_option(BIF_NONEWFOLDERBUTTON, !value);
98  return *this;
99  }
101 
103 
106  void reset() override;
108 
109  protected:
111 
116  bool run_dialog(intptr_t owner) override;
117 
120  void run_sheet(intptr_t owner) override;
122 
123  private:
124  bool get_option(size_t flag) const {return (options_ & flag) == flag;}
125  void set_option(size_t flag, bool value) {options_ = value ? options_ | flag : options_ & ~flag;}
126 
127  xtd::ustring description_;
129  xtd::ustring selected_path_;
130  size_t options_ = BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE;
131  };
132  }
133 }
folder_browser_dialog & description(const xtd::ustring &value)
Sets the descriptive text displayed above the tree view control in the dialog box.
Definition: folder_browser_dialog.h:57
const xtd::ustring & description() const
Gets the descriptive text displayed above the tree view control in the dialog box.
Definition: folder_browser_dialog.h:52
special_folder
Specifies enumerated constants used to retrieve directory paths to system special folders...
Definition: environment.h:93
folder_browser_dialog & root_folder(environment::special_folder value)
Sets the root folder where the browsing starts from.
Definition: folder_browser_dialog.h:70
Contains xtd::forms::common_dialog class.
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:48
Prompts the user to select a folder. This class cannot be inherited.
Definition: folder_browser_dialog.h:22
folder_browser_dialog & auto_upgrade_enable(bool value)
Sets a value that indicates whether the dialog will be automatically upgraded to enable new features...
Definition: folder_browser_dialog.h:44
folder_browser_dialog & show_new_folder_button(bool value)
Sets a value indicating whether the New Folder button appears in the folder browser dialog box...
Definition: folder_browser_dialog.h:96
environment::special_folder root_folder() const
Gets the root folder where the browsing starts from.
Definition: folder_browser_dialog.h:65
bool show_new_folder_button() const
Gets a value indicating whether the New Folder button appears in the folder browser dialog box...
Definition: folder_browser_dialog.h:92
Contains xtd::environment class.
The logical Desktop rather than the physical file system location.
bool auto_upgrade_enable() const
Gets a value that indicates whether the dialog will be automatically upgraded to enable new features...
Definition: folder_browser_dialog.h:40
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
const xtd::ustring & selected_path() const
Gets the path selected by the user.
Definition: folder_browser_dialog.h:78
Specifies the base class used for displaying dialog boxes on the screen.
Definition: common_dialog.h:31
folder_browser_dialog & selected_path(const xtd::ustring &value)
Sets the path selected by the user.
Definition: folder_browser_dialog.h:84