Code

two crashes while editing nodes (one of those is reported as bug 1453558).
[inkscape.git] / src / knotholder.h
1 #ifndef __SP_KNOTHOLDER_H__
2 #define __SP_KNOTHOLDER_H__
4 /*
5  * SPKnotHolder - Hold SPKnot list and manage signals
6  *
7  * Author:
8  *   Mitsuru Oka <oka326@parkcity.ne.jp>
9  *
10  * Copyright (C) 1999-2001 Lauris Kaplinski
11  * Copyright (C) 2000-2001 Ximian, Inc.
12  * Copyright (C) 2001 Mitsuru Oka
13  *
14  * Released under GNU GPL
15  *
16  */
18 #include <glib/gtypes.h>
19 #include "knot-enums.h"
20 #include "forward.h"
21 #include "libnr/nr-forward.h"
23 namespace Inkscape {
24 namespace XML {
25 class Node;
26 }
27 }
30 typedef void (* SPKnotHolderSetFunc) (SPItem *item, NR::Point const &p, NR::Point const &origin, guint state);
31 typedef NR::Point (* SPKnotHolderGetFunc) (SPItem *item);
32 /* fixme: Think how to make callbacks most sensitive (Lauris) */
33 typedef void (* SPKnotHolderReleasedFunc) (SPItem *item);
35 struct SPKnotHolder : GObject {
36     SPDesktop *desktop;
37     SPItem *item;
38     GSList *entity;
40     SPKnotHolderReleasedFunc released;
42     Inkscape::XML::Node *repr; ///< repr of the item, for setting and releasing listeners.
44     gboolean local_change; ///< if true, no need to recreate knotholder if repr was changed.
45 };
47 struct SPKnotHolderClass : GObjectClass {
48 };
50 /* fixme: As a temporary solution, if released is NULL knotholder flushes undo itself (Lauris) */
51 SPKnotHolder *sp_knot_holder_new(SPDesktop *desktop, SPItem *item, SPKnotHolderReleasedFunc relhandler);
53 void sp_knot_holder_destroy(SPKnotHolder *knots);
55 void sp_knot_holder_add(SPKnotHolder *knot_holder,
56                         SPKnotHolderSetFunc knot_set,
57                         SPKnotHolderGetFunc knot_get,
58                         void (* knot_click) (SPItem *item, guint state),
59                         gchar const *tip);
61 void sp_knot_holder_add_full(SPKnotHolder *knot_holder,
62                              SPKnotHolderSetFunc knot_set,
63                              SPKnotHolderGetFunc knot_get,
64                              void (* knot_click) (SPItem *item, guint state),
65                              SPKnotShapeType shape,
66                              SPKnotModeType mode,
67                              gchar const *tip);
69 GType sp_knot_holder_get_type();
71 #define SP_TYPE_KNOT_HOLDER      (sp_knot_holder_get_type())
73 #endif /* !__SP_KNOTHOLDER_H__ */
75 /*
76   Local Variables:
77   mode:c++
78   c-file-style:"stroustrup"
79   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
80   indent-tabs-mode:nil
81   fill-column:99
82   End:
83 */
84 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :