Inkscape
Vector Graphics Editor
|
A simple mediator class that sets the state of a Gtk::ToggleButton when a preference is changed. More...
#include <simple-pref-pusher.h>
Public Member Functions | |
SimplePrefPusher (Gtk::ToggleButton *btn, Glib::ustring const &path) | |
Constructor for a boolean value that syncs to the supplied path. | |
~SimplePrefPusher () override | |
Destructor that unregisters the preference callback. | |
void | notify (Inkscape::Preferences::Entry const &new_val) override |
Callback method invoked when the preference setting changes. | |
![]() | |
Observer (Glib::ustring path) | |
Constructor. | |
virtual | ~Observer () |
Private Attributes | |
Gtk::ToggleButton * | _btn |
bool | freeze |
Additional Inherited Members | |
![]() | |
Glib::ustring const | observed_path |
Path which the observer watches. | |
A simple mediator class that sets the state of a Gtk::ToggleButton when a preference is changed.
Unlike the PrefPusher class, this does not provide the reverse process, so you still need to write your own handler for the "toggled" signal on the ToggleButton.
Definition at line 20 of file simple-pref-pusher.h.
Inkscape::UI::SimplePrefPusher::SimplePrefPusher | ( | Gtk::ToggleButton * | btn, |
Glib::ustring const & | path | ||
) |
Constructor for a boolean value that syncs to the supplied path.
Initializes the widget to the current preference stored state and registers callbacks for widget changes and preference changes.
act | the widget to synchronize preference with. |
path | the path to the preference the widget is synchronized with. |
callback | function to invoke when changes are pushed. |
cbData | data to be passed on to the callback function. |
Definition at line 9 of file simple-pref-pusher.cpp.
References _btn, Inkscape::Preferences::addObserver(), freeze, Inkscape::Preferences::get(), and Inkscape::Preferences::Observer::observed_path.
|
override |
Destructor that unregisters the preference callback.
Definition at line 21 of file simple-pref-pusher.cpp.
References Inkscape::Preferences::get(), and Inkscape::Preferences::removeObserver().
|
overridevirtual |
Callback method invoked when the preference setting changes.
Implements Inkscape::Preferences::Observer.
Definition at line 27 of file simple-pref-pusher.cpp.
References _btn, freeze, and Inkscape::Preferences::Entry::getBool().
|
private |
Definition at line 47 of file simple-pref-pusher.h.
Referenced by notify(), and SimplePrefPusher().
|
private |
Definition at line 48 of file simple-pref-pusher.h.
Referenced by notify(), and SimplePrefPusher().