1
#ifndef SEEN_KNOT_HOLDER_ENTITY_H
2
#define SEEN_KNOT_HOLDER_ENTITY_H
5
* KnotHolderEntity definition.
8
* Mitsuru Oka <oka326@parkcity.ne.jp>
9
* Maximilian Albert <maximilian.albert@gmail.com>
11
* Copyright (C) 1999-2001 Lauris Kaplinski
12
* Copyright (C) 2000-2001 Ximian, Inc.
13
* Copyright (C) 2001 Mitsuru Oka
14
* Copyright (C) 2004 Monash University
15
* Copyright (C) 2008 Maximilian Albert
17
* Released under GNU GPL
20
#include <glib/gtypes.h>
22
#include <2geom/forward.h>
31
typedef void (* SPKnotHolderSetFunc) (SPItem *item, Geom::Point const &p, Geom::Point const &origin, guint state);
32
typedef Geom::Point (* SPKnotHolderGetFunc) (SPItem *item);
33
/* fixme: Think how to make callbacks most sensitive (Lauris) */
34
typedef void (* SPKnotHolderReleasedFunc) (SPItem *item);
36
class KnotHolderEntity {
39
virtual ~KnotHolderEntity();
40
virtual void create(SPDesktop *desktop, SPItem *item, KnotHolder *parent, const gchar *tip = "",
41
SPKnotShapeType shape = SP_KNOT_SHAPE_DIAMOND,
42
SPKnotModeType mode = SP_KNOT_MODE_XOR,
43
guint32 color = 0xffffff00);
45
/* derived classes used for LPE knotholder handles use this to indicate that they
46
must not be deleted when a knotholder is destroyed */
47
// TODO: it would be nice to ditch this but then we need to dynamically create instances of different
48
// KnotHolderEntity classes in Effect::addKnotHolderEntities. How to do this???
49
virtual bool isDeletable() { return true; }
51
/* the get/set/click handlers are virtual functions; each handler class for a knot
52
should be derived from KnotHolderEntity and override these functions */
53
virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state) = 0;
54
virtual Geom::Point knot_get() = 0;
55
virtual void knot_click(guint /*state*/) {}
60
Geom::Point snap_knot_position(Geom::Point const &p);
61
Geom::Point snap_knot_position_constrained(Geom::Point const &p, Inkscape::Snapper::ConstraintLine const &constraint);
67
KnotHolder *parent_holder;
72
/** Connection to \a knot's "moved" signal. */
74
/** Connection to \a knot's "clicked" signal. */
75
guint _click_handler_id;
76
/** Connection to \a knot's "ungrabbed" signal. */
77
guint _ungrab_handler_id;
79
sigc::connection _moved_connection;
80
sigc::connection _click_connection;
81
sigc::connection _ungrabbed_connection;
84
// derived KnotHolderEntity class for LPEs
85
class LPEKnotHolderEntity : public KnotHolderEntity {
86
virtual bool isDeletable() { return false; }
89
/* pattern manipulation */
91
class PatternKnotHolderEntityXY : public KnotHolderEntity {
93
virtual Geom::Point knot_get();
94
virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state);
97
class PatternKnotHolderEntityAngle : public KnotHolderEntity {
99
virtual Geom::Point knot_get();
100
virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state);
103
class PatternKnotHolderEntityScale : public KnotHolderEntity {
105
virtual Geom::Point knot_get();
106
virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state);
109
#endif /* !SEEN_KNOT_HOLDER_ENTITY_H */
114
c-file-style:"stroustrup"
115
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
120
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :