1 #ifndef SEEN_SP_SVG_LENGTH_H
2 #define SEEN_SP_SVG_LENGTH_H
4 /**
5 * \file src/svg/svg-length.h
6 * \brief SVG length type
7 */
8 /*
9 * Authors:
10 * Lauris Kaplinski <lauris@kaplinski.com>
11 * Carl Hetherington <inkscape@carlh.net>
12 *
13 * Copyright (C) 1999-2002 Lauris Kaplinski
14 * Copyright (C) 2000-2001 Ximian, Inc.
15 *
16 * Released under GNU GPL, read the file 'COPYING' for more information
17 */
19 #include <glib/gtypes.h>
21 class SVGLength
22 {
23 public:
25 enum Unit {
26 NONE,
27 PX,
28 PT,
29 PC,
30 MM,
31 CM,
32 INCH,
33 FOOT,
34 EM,
35 EX,
36 PERCENT,
37 LAST_UNIT = PERCENT
38 };
40 bool _set;
41 Unit unit;
42 float value;
43 float computed;
45 float operator=(float v) {
46 _set = true;
47 unit = NONE;
48 value = computed = v;
49 return v;
50 }
52 bool read(gchar const *str);
53 void readOrUnset(gchar const *str, Unit u = NONE, float v = 0, float c = 0);
54 bool readAbsolute(gchar const *str);
55 void set(Unit u, float v, float c);
56 void unset(Unit u = NONE, float v = 0, float c = 0);
57 void update(double em, double ex, double scale);
58 };
60 #endif // SEEN_SP_SVG_LENGTH_H
62 /*
63 Local Variables:
64 mode:c++
65 c-file-style:"stroustrup"
66 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
67 indent-tabs-mode:nil
68 fill-column:99
69 End:
70 */
71 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :