Inkscape
Vector Graphics Editor
|
Proxy object providing a "live value" interface. More...
#include <preferences.h>
Proxy object providing a "live value" interface.
A Pref<T> tracks a preference value. For the most part it behaves just like a T. For example
auto mybool = Pref<bool>("/path/to/mybool");
can be used as a bool. The only difference is that it updates whenever the preference updates, and allows you to perform an action when it does. For example,
mybool.action = [&] { std::cout << mybool << std::endl; };
will cause the new value to be printed after each subsequent change. Pref<T> can be temporarily disabled with a call to
mybool.set_enabled(false);
during which time it will revert to its default value and ignore further updates until re-enabled again.
Definition at line 803 of file preferences.h.