Code

93cdc94ee03a312983f4a47b08bdafbc0865397e
[inkscape.git] / src / live_effects / parameter / parameter.h
1 #ifndef INKSCAPE_LIVEPATHEFFECT_PARAMETER_H\r
2 #define INKSCAPE_LIVEPATHEFFECT_PARAMETER_H\r
3 \r
4 /*\r
5  * Inkscape::LivePathEffectParameters\r
6  *\r
7 * Copyright (C) Johan Engelen 2007 <j.b.c.engelen@utwente.nl>\r
8  *\r
9  * Released under GNU GPL, read the file 'COPYING' for more information\r
10  */\r
11 \r
12 #include <glibmm/ustring.h>\r
13 #include <2geom/point.h>\r
14 #include <2geom/path.h>\r
15 \r
16 #include "ui/widget/registry.h"\r
17 #include "ui/widget/registered-widget.h"\r
18 \r
19 namespace Gtk {\r
20     class Widget;\r
21 }\r
22 \r
23 namespace Inkscape {\r
24 \r
25 namespace LivePathEffect {\r
26 \r
27 class Effect;\r
28 \r
29 class Parameter {\r
30 public:\r
31     Parameter(  const Glib::ustring& label,\r
32                 const Glib::ustring& tip,\r
33                 const Glib::ustring& key,\r
34                 Inkscape::UI::Widget::Registry* wr,\r
35                 Effect* effect);\r
36     virtual ~Parameter() {};\r
37 \r
38     virtual bool param_readSVGValue(const gchar * strvalue) = 0;   // returns true if new value is valid / accepted.\r
39     virtual gchar * param_writeSVGValue() const = 0;\r
40 \r
41     // This returns pointer to the parameter's widget to be put in the live-effects dialog. Must also create the\r
42     // necessary widget if it does not exist yet.\r
43     virtual Gtk::Widget * param_getWidget() = 0;\r
44     virtual Glib::ustring * param_getTooltip() { return &param_tooltip; };\r
45 \r
46     Glib::ustring param_key;\r
47     Inkscape::UI::Widget::Registry * param_wr;\r
48     Glib::ustring param_label;\r
49 \r
50 protected:\r
51     Glib::ustring param_tooltip;\r
52 \r
53     Effect* param_effect;\r
54 \r
55 private:\r
56     Parameter(const Parameter&);\r
57     Parameter& operator=(const Parameter&);\r
58 };\r
59 \r
60 \r
61 class RealParam : public Parameter {\r
62 public:\r
63     RealParam(  const Glib::ustring& label,\r
64                 const Glib::ustring& tip,\r
65                 const Glib::ustring& key, \r
66                 Inkscape::UI::Widget::Registry* wr,\r
67                 Effect* effect,\r
68                 gdouble initial_value = 1.0);\r
69     ~RealParam();\r
70 \r
71     bool param_readSVGValue(const gchar * strvalue);\r
72     gchar * param_writeSVGValue() const;\r
73 \r
74     Gtk::Widget * param_getWidget();\r
75 \r
76     inline operator gdouble()\r
77         { return value; };\r
78 \r
79 private:\r
80     RealParam(const RealParam&);\r
81     RealParam& operator=(const RealParam&);\r
82 \r
83     gdouble value;\r
84     Inkscape::UI::Widget::RegisteredScalar * rsu;\r
85 };\r
86 \r
87 \r
88 } //namespace LivePathEffect\r
89 \r
90 } //namespace Inkscape\r
91 \r
92 #endif\r