Code

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