diff options
| author | Jon A. Cruz <jon@joncruz.org> | 2007-04-05 00:35:22 +0000 |
|---|---|---|
| committer | joncruz <joncruz@users.sourceforge.net> | 2007-04-05 00:35:22 +0000 |
| commit | ca9ce0558e2ddcc300f6d88ff9082ad47f6a53ef (patch) | |
| tree | a4f4bf01f56b79b878cf4d5a183e8a7a24288fbc /src/helper/unit-tracker.h | |
| parent | removed the software-only licenses which are not legally clear for content/ar... (diff) | |
| download | inkscape-ca9ce0558e2ddcc300f6d88ff9082ad47f6a53ef.tar.gz inkscape-ca9ce0558e2ddcc300f6d88ff9082ad47f6a53ef.zip | |
Replacing old multifunction widget with separate widget & model
(bzr r2820)
Diffstat (limited to 'src/helper/unit-tracker.h')
| -rw-r--r-- | src/helper/unit-tracker.h | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/src/helper/unit-tracker.h b/src/helper/unit-tracker.h new file mode 100644 index 000000000..1832430b3 --- /dev/null +++ b/src/helper/unit-tracker.h @@ -0,0 +1,75 @@ +/* + * Inkscape::UnitTracker - Simple mediator to synchronize changes to a set + * of possible units + * + * Authors: + * Jon A. Cruz <jon@joncruz.org> + * + * Copyright (C) 2007 Jon A. Cruz + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#ifndef SEEN_INKSCAPE_UNIT_TRACKER_H +#define SEEN_INKSCAPE_UNIT_TRACKER_H + +#include <map> + +#include <gtk/gtkaction.h> + +#include "helper/units.h" + +namespace Inkscape { + +class UnitTracker +{ +public: + UnitTracker( guint bases = (SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE) ); + ~UnitTracker(); + + void setBase( guint bases ); // SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE + void addUnit( SPUnitId id, gint index ); + + bool isUpdating() const; + + void setActiveUnit( SPUnit const *unit ); + SPUnit const* getActiveUnit() const; + + void addAdjustment( GtkAdjustment* adj ); + void setFullVal( GtkAdjustment* adj, gdouble val ); + + GtkAction* createAction( gchar const* name, gchar const* label, gchar const* tooltip ); + +private: + static void _unitChangedCB( GtkAction* action, gpointer data ); + static void _actionFinalizedCB( gpointer data, GObject *where_the_object_was ); + static void _adjustmentFinalizedCB( gpointer data, GObject *where_the_object_was ); + void _setActive( gint index ); + void _fixupAdjustments( SPUnit const* oldUnit, SPUnit const *newUnit ); + void _actionFinalized( GObject *where_the_object_was ); + void _adjustmentFinalized( GObject *where_the_object_was ); + + gint _active; + bool _isUpdating; + SPUnit* _activeUnit; + GtkListStore* _store; + GSList* _unitList; + GSList* _actionList; + GSList* _adjList; + std::map <GtkAdjustment*, gdouble> _priorValues; +}; + +} + +#endif // SEEN_INKSCAPE_UNIT_TRACKER_H + +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : |
