Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
text.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
2#ifndef INKSCAPE_LIVEPATHEFFECT_PARAMETER_TEXT_H
3#define INKSCAPE_LIVEPATHEFFECT_PARAMETER_TEXT_H
4
5/*
6 * Inkscape::LivePathEffectParameters
7 *
8 * Authors:
9 * Maximilian Albert
10 * Johan Engelen
11 *
12 * Copyright (C) Maximilian Albert 2008 <maximilian.albert@gmail.com>
13 *
14 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
15 */
16
17#include <glib.h>
18
21
22namespace Inkscape {
23
24class CanvasItemText;
25
26namespace LivePathEffect {
27
28class TextParam : public Parameter {
29public:
30 TextParam( const Glib::ustring& label,
31 const Glib::ustring& tip,
32 const Glib::ustring& key,
34 Effect* effect,
35 const Glib::ustring default_value = "");
36 ~TextParam() override;
37
38 Gtk::Widget * param_newWidget() override;
39
40 bool param_readSVGValue(const gchar * strvalue) override;
41 Glib::ustring param_getSVGValue() const override;
42 Glib::ustring param_getDefaultSVGValue() const override;
43
44 void param_setValue(Glib::ustring newvalue);
47 void param_set_default() override;
48 void param_update_default(const gchar * default_value) override;
49 void setPos(Geom::Point pos);
51 const double t, const double length, bool use_curvature = false);
52 void setAnchor(double x_value, double y_value);
53
54 const Glib::ustring get_value() const { return value; };
55 ParamType paramType() const override { return ParamType::TEXT; };
56
57private:
58 TextParam(const TextParam&) = delete;
59 TextParam& operator=(const TextParam&) = delete;
60 double anchor_x;
61 double anchor_y;
62 Glib::ustring value;
63 Glib::ustring defvalue;
65};
66
67/*
68 * This parameter does not display a widget in the LPE dialog; LPEs can use it to display on-canvas
69 * text that should not be settable by the user. Note that since no widget is provided, the
70 * parameter must be initialized differently than usual (only with a pointer to the parent effect;
71 * no label, no tooltip, etc.).
72 */
74public:
76 TextParam("", "", "", nullptr, effect) {}
77
78 Gtk::Widget * param_newWidget() override { return nullptr; }
79};
80
81} //namespace LivePathEffect
82
83} //namespace Inkscape
84
85#endif
86
87/*
88 Local Variables:
89 mode:c++
90 c-file-style:"stroustrup"
91 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
92 indent-tabs-mode:nil
93 fill-column:99
94 End:
95*/
96// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
std::unique_ptr< T, CanvasItemUnlinkDeleter > CanvasItemPtr
Smart pointer used to hold CanvasItems, like std::unique_ptr.
Adaptor that creates 2D functions from 1D ones.
Definition d2.h:55
Function defined as discrete pieces.
Definition piecewise.h:71
Two-dimensional point that doubles as a vector.
Definition point.h:66
Gtk::Widget * param_newWidget() override
Definition text.h:78
TextParam & operator=(const TextParam &)=delete
Gtk::Widget * param_newWidget() override
Definition text.cpp:127
void setPosAndAnchor(const Geom::Piecewise< Geom::D2< Geom::SBasis > > &pwd2, const double t, const double length, bool use_curvature=false)
Definition text.cpp:72
void param_setValue(Glib::ustring newvalue)
Definition text.cpp:144
CanvasItemPtr< CanvasItemText > canvas_text
Definition text.h:64
Glib::ustring param_getDefaultSVGValue() const override
Definition text.cpp:113
const Glib::ustring get_value() const
Definition text.h:54
void param_set_default() override
Definition text.cpp:45
bool param_readSVGValue(const gchar *strvalue) override
Definition text.cpp:100
void param_update_default(const gchar *default_value) override
Definition text.cpp:51
TextParam(const TextParam &)=delete
Glib::ustring param_getSVGValue() const override
Definition text.cpp:107
void setTextParam(Inkscape::UI::Widget::RegisteredText *rsu)
Definition text.cpp:119
ParamType paramType() const override
Definition text.h:55
void setAnchor(double x_value, double y_value)
Definition text.cpp:90
void setPos(Geom::Point pos)
Definition text.cpp:64
Glib::ustring label
Coord length(LineSegment const &seg)
Helper class to stream background task notifications as a series of messages.
static cairo_user_data_key_t key