Code

better fix for lpe stack forking
[inkscape.git] / src / live_effects / parameter / text.h
1 #ifndef INKSCAPE_LIVEPATHEFFECT_PARAMETER_TEXT_H
2 #define INKSCAPE_LIVEPATHEFFECT_PARAMETER_TEXT_H
4 /*
5  * Inkscape::LivePathEffectParameters
6  *
7  * Authors:
8  *   Maximilian Albert
9  *   Johan Engelen
10  *
11  * Copyright (C) Maximilian Albert 2008 <maximilian.albert@gmail.com>
12  *
13  * Released under GNU GPL, read the file 'COPYING' for more information
14  */
16 #include <glib/gtypes.h>
18 #include "display/canvas-bpath.h"
19 #include "live_effects/parameter/parameter.h"
21 struct SPCanvasText;
23 namespace Inkscape {
25 namespace LivePathEffect {
27 class TextParam : public Parameter {
28 public:
29     TextParam( const Glib::ustring& label,
30                const Glib::ustring& tip,
31                const Glib::ustring& key,
32                Inkscape::UI::Widget::Registry* wr,
33                Effect* effect,
34                const Glib::ustring default_value = "");
35     virtual ~TextParam() {}
37     virtual Gtk::Widget * param_newWidget(Gtk::Tooltips * tooltips);
39     virtual bool param_readSVGValue(const gchar * strvalue);
40     virtual gchar * param_getSVGValue() const;
42     void param_setValue(const Glib::ustring newvalue);
43     virtual void param_set_default();
44     void setPos(Geom::Point pos);
45     void setPosAndAnchor(const Geom::Piecewise<Geom::D2<Geom::SBasis> > &pwd2,
46                          const double t, const double length, bool use_curvature = false);
47     void setAnchor(double x_value, double y_value);
49     const Glib::ustring get_value() { return defvalue; };
51 private:
52     TextParam(const TextParam&);
53     TextParam& operator=(const TextParam&);
54     double anchor_x;
55     double anchor_y;
57     Glib::ustring value;
58     Glib::ustring defvalue;
60     SPCanvasText *canvas_text;
61 };
63 /*
64  * This parameter does not display a widget in the LPE dialog; LPEs can use it to display on-canvas
65  * text that should not be settable by the user. Note that since no widget is provided, the
66  * parameter must be initialized differently than usual (only with a pointer to the parent effect;
67  * no label, no tooltip, etc.).
68  */
69 class TextParamInternal : public TextParam {
70 public:
71     TextParamInternal(Effect* effect) :
72         TextParam("", "", "", NULL, effect) {}
74     virtual Gtk::Widget * param_newWidget(Gtk::Tooltips * /*tooltips*/) { return NULL; }
75 };
77 } //namespace LivePathEffect
79 } //namespace Inkscape
81 #endif
83 /*
84   Local Variables:
85   mode:c++
86   c-file-style:"stroustrup"
87   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
88   indent-tabs-mode:nil
89   fill-column:99
90   End:
91 */
92 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :