demonstrates the use of xtd::settings component without CMake setting commands.
#include <xtd/xtd>
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 +=
delegate_ {
main_form.back_color(back_color_picker.color());
};
auto save_button = button::create(main_form, "&Save", {90, 10});
settings.
write(
"size", main_form.client_size());
settings.
write(
"location", main_form.location());
settings.
write(
"back_color", main_form.back_color());
};
auto reload_button = button::create(main_form, "&Reload", {170, 10});
main_form.client_size(settings.
read(
"size", size {335, 45}));
main_form.location(settings.
read(
"location", point {100, 50}));
main_form.back_color(settings.
read(
"back_color", system_colors::control()));
back_color_picker.color(main_form.back_color());
};
auto reset_button = button::create(main_form, "R&eset", {250, 10});
reload_button.perform_click();
};
reload_button.perform_click();
application::run(main_form);
}
Represent settings associate to the application.
Definition settings.hpp:178
auto save() -> void
Save application settings.
auto reset() -> void
Reset application settings.
auto write(const xtd::string &key, const xtd::string &value) -> void
Writes a specified value for specified key.
auto read(const xtd::string &key, const xtd::string &default_value) -> xtd::string
Reads a value for specified key. If not found default value is used.
#define delegate_
The declaration of a delegate type is similar to a method signature. It has a return value and any nu...
Definition delegate.hpp:1018