Represent settings associate to the application. 
- Header
 #include <xtd/configuration/settings>
  
- Namespace
 - xtd 
 
- Library
 - xtd.core
 
- Examples
 - The following code example demonstrates the use of xtd::configuration::settings class with CMake setting commands.
 
• application_Settings.cpp : 
#include "../properties/settings.hpp"
#include <xtd/forms/application>
#include <xtd/forms/button>
#include <xtd/forms/color_picker>
#include <xtd/forms/form>
 
using namespace application_settings::properties;
 
auto main() -> int {
  auto main_form = form::create(settings::default_settings().text(), form_start_position::manual);
  
  auto back_color_picker = color_picker::create(main_form, main_form.back_color(), {10, 10}, {75, 25});
  back_color_picker.color_picker_changed += [&] {
    main_form.back_color(back_color_picker.color());
  };
  
  auto save_button = button::create(main_form, "&Save", {90, 10});
  save_button.click += [&] {
    settings::default_settings().size(main_form.client_size());
    settings::default_settings().location(main_form.location());
    settings::default_settings().back_color(main_form.back_color());
    settings::default_settings().save();
  };
  
  auto reload_button = button::create(main_form, "&Reload", {170, 10});
  reload_button.click += [&] {
    main_form.client_size(settings::default_settings().
size());
 
    main_form.location(settings::default_settings().
location());
 
    main_form.back_color(settings::default_settings().back_color());
    back_color_picker.color(settings::default_settings().back_color());
  };
  
  auto reset_button = button::create(main_form, "R&eset", {250, 10});
  reset_button.click += [&] {
    settings::default_settings().reset();
    reload_button.perform_click();
  };
  
  reload_button.perform_click();
  
  application::run(main_form);
}
size_t size
Represents a size of any object in bytes.
Definition size.hpp:23
 
 • properties/settings.cmake : 
setting_include(xtd/drawing/point)
setting_include(xtd/drawing/size)
setting_include(xtd/drawing/system_colors)
setting(back_color xtd::drawing::color USER "xtd::drawing::system_colors::control()")
setting(location xtd::drawing::point USER "{100, 50}")
setting(size xtd::drawing::size USER "{335, 45}")
setting(text xtd::string APPLICATION "\"Settings example\"")
 • The generated properties/settings.h : 
#pragma region xtd generated code
 
#pragma once
#include <xtd/drawing/point>
#include <xtd/drawing/size>
#include <xtd/drawing/system_colors>
#include <xtd/configuration/settings>
 
namespace application_settings::properties {
  
  
  
  public:
    
 
    
    
    
    
    
      if (load) reload();
    }
    
 
    
    
 
    
 
    
    
    
    xtd::drawing::color back_color() const noexcept {
return back_color_;}
 
    
    
      back_color_ = value;
      return *this;
    }
 
    
    
    
    
      location_ = value;
      return *this;
    }
 
    
    
    
    
      size_ = value;
      return *this;
    }
 
    
    
 
    
 
    
 
    
    
    
    void reload() noexcept {
      back_color_ = settings_.read("back_color", back_color_);
      location_ = settings_.read("location", location_);
      size_ = settings_.read("size", size_);
    }
 
    
    
    void reset() noexcept {
      settings_.reset();
    }
 
    
    
    void save() noexcept {
      settings_.
write(
"back_color", back_color_);
 
      settings_.write("location", location_);
      settings_.write("size", size_);
      settings_.save();
    }
    
 
    
 
    
    
    
    
    static settings& default_settings() noexcept {
 
      static auto default_settings = 
settings {};
 
      return default_settings;
    }
    
 
  private:
  };
}
 
#pragma endregion
Represents text as a sequence of character units.
Definition basic_string.hpp:79
 
Represent settings associate to the application.
Definition settings.hpp:174
 
void write(const xtd::string &key, const xtd::string &value)
Writes a specified value for specified key.
 
Represents an ARGB (alpha, red, green, blue) color.
Definition color.hpp:49
 
Represents an ordered pair of integer x- and y-coordinates that defines a point in a two-dimensional ...
Definition point.hpp:54
 
Stores an ordered pair of integers, which specify a height and width.
Definition size.hpp:31
 
static xtd::drawing::color control()
Gets a xtd::drawing::color structure that is the face color of a 3-D element.
 
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:42
 
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10
 
 The following code example demonstrates the use of xtd::configuration::settings class without CMake setting commands. 
#include <xtd/configuration/settings>
#include <xtd/forms/application>
#include <xtd/forms/button>
#include <xtd/forms/color_picker>
#include <xtd/forms/form>
 
 
auto main() -> int {
  auto main_form = form::create("Settings example", form_start_position::manual);
  
  auto back_color_picker = color_picker::create(main_form, main_form.back_color(), {10, 10}, {75, 25});
  back_color_picker.color_picker_changed += [&] {
    main_form.back_color(back_color_picker.color());
  };
  
  auto save_button = button::create(main_form, "&Save", {90, 10});
  save_button.click += [&] {
  };
  
  auto reload_button = button::create(main_form, "&Reload", {170, 10});
  reload_button.click += [&] {
    main_form.back_color(
settings.
read(
"back_color", main_form.back_color()));
 
    back_color_picker.color(main_form.back_color());
  };
  
  auto reset_button = button::create(main_form, "R&eset", {250, 10});
  reset_button.click += [&] {
    reload_button.perform_click();
  };
  
  reload_button.perform_click();
  
  application::run(main_form);
}
void save()
Save application settings.
 
xtd::string read(const xtd::string &key, const xtd::string &default_value)
Reads a value for specified key. If not found default value is used.
 
void reset()
Reset application settings.
 
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition brush.hpp:18
 
  - Examples
 - application_settings_without_cmake_setting_commands.cpp.