Code

Split SPCanvasItem and SPCanvasGroup to individual .h files. Removed forward header.
[inkscape.git] / src / sp-shape.h
1 #ifndef SEEN_SP_SHAPE_H
2 #define SEEN_SP_SHAPE_H
4 /*
5  * Base class for shapes, including <path> element
6  *
7  * Author:
8  *   Lauris Kaplinski <lauris@kaplinski.com>
9  *   Abhishek Sharma
10  *   Jon A. Cruz <jon@joncruz.org>
11  *
12  * Copyright (C) 1999-2002 Lauris Kaplinski
13  * Copyright (C) 2000-2001 Ximian, Inc.
14  * Copyright (C) 2008 Johan Engelen
15  *
16  * Released under GNU GPL, read the file 'COPYING' for more information
17  */
19 #include "sp-lpe-item.h"
20 #include "sp-marker-loc.h"
21 #include <2geom/forward.h>
23 #include <sigc++/connection.h>
25 #define SP_TYPE_SHAPE (SPShape::getType ())
26 #define SP_SHAPE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_SHAPE, SPShape))
27 #define SP_SHAPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SP_TYPE_SHAPE, SPShapeClass))
28 #define SP_IS_SHAPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_SHAPE))
29 #define SP_IS_SHAPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_SHAPE))
31 #define SP_SHAPE_WRITE_PATH (1 << 2)
33 struct SPDesktop;
35 class SPShape : public SPLPEItem {
36 public:
37     SPCurve *curve;
39     SPObject *marker[SP_MARKER_LOC_QTY];
40     sigc::connection release_connect [SP_MARKER_LOC_QTY];
41     sigc::connection modified_connect [SP_MARKER_LOC_QTY];
42         
43     static GType getType (void);
44     void setShape ();
45     SPCurve * getCurve ();
46     void setCurve (SPCurve *curve, unsigned int owner);
47     void setCurveInsync (SPCurve *curve, unsigned int owner);
48     int hasMarkers () const;
49     int numberOfMarkers (int type);
51 private:
52     static void sp_shape_init (SPShape *shape);
53     static void sp_shape_finalize (GObject *object);
55     static void sp_shape_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr);
56     static void sp_shape_release (SPObject *object);
58     static void sp_shape_set(SPObject *object, unsigned key, gchar const *value);
59     static void sp_shape_update (SPObject *object, SPCtx *ctx, unsigned int flags);
60     static void sp_shape_modified (SPObject *object, unsigned int flags);
61     static Inkscape::XML::Node *sp_shape_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
63     static void sp_shape_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const &transform, unsigned const flags);
64     static NRArenaItem *sp_shape_show (SPItem *item, NRArena *arena, unsigned int key, unsigned int flags);
65     static void sp_shape_hide (SPItem *item, unsigned int key);
66     static void sp_shape_snappoints (SPItem const *item, std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs);
68     static void sp_shape_update_marker_view (SPShape *shape, NRArenaItem *ai);
72     friend class SPShapeClass;  
73 };
75 class SPShapeClass {
76 public:
77     SPLPEItemClass item_class;
79     /* Build bpath from extra shape attributes */
80     void (* set_shape) (SPShape *shape);
82 private:
83     static SPLPEItemClass *parent_class;
84     static void sp_shape_class_init (SPShapeClass *klass);
86     friend class SPShape;
87 };
89 void sp_shape_set_marker (SPObject *object, unsigned int key, const gchar *value);
91 Geom::Matrix sp_shape_marker_get_transform(Geom::Curve const & c1, Geom::Curve const & c2);
92 Geom::Matrix sp_shape_marker_get_transform_at_start(Geom::Curve const & c);
93 Geom::Matrix sp_shape_marker_get_transform_at_end(Geom::Curve const & c);
95 #endif // SEEN_SP_SHAPE_H
97 /*
98   Local Variables:
99   mode:c++
100   c-file-style:"stroustrup"
101   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
102   indent-tabs-mode:nil
103   fill-column:99
104   End:
105 */
106 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :