diff options
| author | John Smith <john.smith7545@yahoo.com> | 2012-05-08 05:21:59 +0000 |
|---|---|---|
| committer | John Smith <removethis.john.q.public@bigmail.com> | 2012-05-08 05:21:59 +0000 |
| commit | 7572ee2641532716d219a9a11f03e87511ed0bab (patch) | |
| tree | 72c9ccfe5b54a179a32ddbf4cae9ee07f34ce90b /src/widgets/toolbox.h | |
| parent | Fixing to use explicit enum types instead of generic guint & bool. (diff) | |
| download | inkscape-7572ee2641532716d219a9a11f03e87511ed0bab.tar.gz inkscape-7572ee2641532716d219a9a11f03e87511ed0bab.zip | |
Fix for 986446 : Refactor toolbox into tool specific files
(bzr r11346)
Diffstat (limited to 'src/widgets/toolbox.h')
| -rw-r--r-- | src/widgets/toolbox.h | 58 |
1 files changed, 56 insertions, 2 deletions
diff --git a/src/widgets/toolbox.h b/src/widgets/toolbox.h index bb2edf964..d520d393d 100644 --- a/src/widgets/toolbox.h +++ b/src/widgets/toolbox.h @@ -18,6 +18,9 @@ #include "icon-size.h" #include "../ege-adjustment-action.h" +#include "../preferences.h" + +#define TOOLBAR_SLIDER_HINT "full" class SPDesktop; class SPEventContext; @@ -51,14 +54,65 @@ private: ToolboxFactory(); }; +/** + * A simple mediator class that keeps UI controls matched to the preference values they set. + */ +class PrefPusher : public Inkscape::Preferences::Observer +{ +public: + /** + * 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. + * + * @param act the widget to synchronize preference with. + * @param path the path to the preference the widget is synchronized with. + * @param callback function to invoke when changes are pushed. + * @param cbData data to be passed on to the callback function. + */ + PrefPusher( GtkToggleAction *act, Glib::ustring const &path, void (*callback)(GObject*) = 0, GObject *cbData = 0 ); + + /** + * Destructor that unregisters the preference callback. + */ + virtual ~PrefPusher(); + + /** + * Callback method invoked when the preference setting changes. + */ + virtual void notify(Inkscape::Preferences::Entry const &new_val); + + +private: + /** + * Callback hook invoked when the widget changes. + * + * @param act the toggle action widget that was changed. + * @param self the PrefPusher instance the callback was registered to. + */ + static void toggleCB( GtkToggleAction *act, PrefPusher *self ); + + /** + * Method to handle the widget change. + */ + void handleToggled(); + + GtkToggleAction *act; + void (*callback)(GObject*); + GObject *cbData; + bool freeze; +}; + + } // namespace UI } // namespace Inkscape // utility -// TODO remove this: -void sp_toolbox_add_label(GtkWidget *tbl, gchar const *title, bool wide = true); +void delete_prefspusher(GObject * /*obj*/, Inkscape::UI::PrefPusher *watcher ); +void purge_repr_listener( GObject* /*obj*/, GObject* tbl ); +void delete_connection(GObject * /*obj*/, sigc::connection *connection); EgeAdjustmentAction * create_adjustment_action( gchar const *name, gchar const *label, gchar const *shortLabel, gchar const *tooltip, |
