xtd - Reference Guide  0.1.1
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 {
23  public:
29  folder_browser_dialog() = default;
30 
33  bool auto_upgrade_enable() const {return get_option(BIF_USENEWUI);}
38  set_option(BIF_USENEWUI, value);
39  return *this;
40  }
41 
45  const xtd::ustring& description() const {return description_;}
51  description_ = value;
52  return *this;
53  }
54 
58  environment::special_folder root_folder() const {return root_folder_;}
64  root_folder_ = value;
65  return *this;
66  }
71  const xtd::ustring& selected_path() const {return selected_path_;}
78  selected_path_ = value;
79  return *this;
80  }
81 
85  bool show_new_folder_button() const {return !get_option(BIF_NONEWFOLDERBUTTON);}
90  set_option(BIF_NONEWFOLDERBUTTON, !value);
91  return *this;
92  }
93 
95  void reset() override;
96 
97  protected:
101  bool run_dialog(intptr_t owner) override;
102 
105  void run_sheet(intptr_t owner) override;
106 
107  private:
108  bool get_option(size_t flag) const {return (options_ & flag) == flag;}
109  void set_option(size_t flag, bool value) {options_ = value ? options_ | flag : options_ & ~flag;}
110 
111  xtd::ustring description_;
113  xtd::ustring selected_path_;
114  size_t options_ = BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE;
115  };
116  }
117 }
special_folder
Specifies enumerated constants used to retrieve directory paths to system special folders.
Definition: environment.h:92
@ desktop
The logical Desktop rather than the physical file system location.
Specifies the base class used for displaying dialog boxes on the screen.
Definition: common_dialog.h:31
Prompts the user to select a folder. This class cannot be inherited.
Definition: folder_browser_dialog.h:22
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:89
void run_sheet(intptr_t owner) override
When overridden in a derived class, specifies a common dialog box.
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:85
bool run_dialog(intptr_t owner) override
When overridden in a derived class, specifies a common dialog box.
const xtd::ustring & selected_path() const
Gets the path selected by the user.
Definition: folder_browser_dialog.h:71
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:50
folder_browser_dialog & selected_path(const xtd::ustring &value)
Sets the path selected by the user.
Definition: folder_browser_dialog.h:77
const xtd::ustring & description() const
Gets the descriptive text displayed above the tree view control in the dialog box.
Definition: folder_browser_dialog.h:45
void reset() override
Resets all options to their default values, the last selected color to black, and the custom colors t...
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:33
folder_browser_dialog & root_folder(environment::special_folder value)
Sets the root folder where the browsing starts from.
Definition: folder_browser_dialog.h:63
folder_browser_dialog()=default
Initializes a new instance of the folder_browser_dialog class.
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:37
environment::special_folder root_folder() const
Gets the root folder where the browsing starts from.
Definition: folder_browser_dialog.h:58
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:48
Contains xtd::forms::common_dialog class.
Contains xtd::environment class.
#define forms_export_
Define shared library export.
Definition: forms_export.h:13
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17