Code

New unit parameter for LPEs which lpe-ruler now uses
[inkscape.git] / src / live_effects / parameter / unit.h
1 #ifndef INKSCAPE_LIVEPATHEFFECT_PARAMETER_UNIT_H
2 #define INKSCAPE_LIVEPATHEFFECT_PARAMETER_UNIT_H
4 /*
5  * Inkscape::LivePathEffectParameters
6  *
7 * Copyright (C) Maximilian Albert 2008 <maximilian.albert@gmail.com>
8  *
9  * Released under GNU GPL, read the file 'COPYING' for more information
10  */
12 #include "live_effects/parameter/parameter.h"
13 #include <helper/units.h>
15 namespace Inkscape {
17 namespace LivePathEffect {
19 class UnitParam : public Parameter {
20 public:
21     UnitParam(const Glib::ustring& label,
22                   const Glib::ustring& tip,
23                   const Glib::ustring& key, 
24                   Inkscape::UI::Widget::Registry* wr,
25                   Effect* effect,
26                   SPUnitId default_value = SP_UNIT_PX);
27     virtual ~UnitParam();
29     virtual bool param_readSVGValue(const gchar * strvalue);
30     virtual gchar * param_getSVGValue() const;
31     virtual void param_set_default();
32     void param_set_value(SPUnit const *val);
33     const gchar *get_abbreviation();
35     virtual Gtk::Widget * param_newWidget(Gtk::Tooltips * tooltips);
37     operator SPUnit const *() { return unit; }
39 private:
40     SPUnit const *unit;
41     SPUnit const *defunit;
43     UnitParam(const UnitParam&);
44     UnitParam& operator=(const UnitParam&);
45 };
47 } //namespace LivePathEffect
49 } //namespace Inkscape
51 #endif