summaryrefslogtreecommitdiffstats
path: root/src/knot-holder-entity.h
diff options
context:
space:
mode:
authorMaximilian Albert <maximilian.albert@gmail.com>2008-06-04 12:19:54 +0000
committercilix42 <cilix42@users.sourceforge.net>2008-06-04 12:19:54 +0000
commit88f4b0093529c35964c39b589a0b614ad231d02c (patch)
treec0c2cf46cdd788415efe2e15e398779b24607b8a /src/knot-holder-entity.h
parentAdded tool style for eraser. (diff)
downloadinkscape-88f4b0093529c35964c39b589a0b614ad231d02c.tar.gz
inkscape-88f4b0093529c35964c39b589a0b614ad231d02c.zip
C++ify knotholders
(bzr r5797)
Diffstat (limited to 'src/knot-holder-entity.h')
-rw-r--r--src/knot-holder-entity.h62
1 files changed, 59 insertions, 3 deletions
diff --git a/src/knot-holder-entity.h b/src/knot-holder-entity.h
index bbc0c5634..854182726 100644
--- a/src/knot-holder-entity.h
+++ b/src/knot-holder-entity.h
@@ -2,20 +2,23 @@
#define SEEN_KNOT_HOLDER_ENTITY_H
/** \file
- * SPKnotHolderEntity definition.
+ * KnotHolderEntity definition.
*
* Authors:
* Mitsuru Oka <oka326@parkcity.ne.jp>
+ * Maximilian Albert <maximilian.albert@gmail.com>
*
* Copyright (C) 1999-2001 Lauris Kaplinski
* Copyright (C) 2000-2001 Ximian, Inc.
* Copyright (C) 2001 Mitsuru Oka
* Copyright (C) 2004 Monash University
+ * Copyright (C) 2008 Maximilian Albert
*
* Released under GNU GPL
*/
#include <glib/gtypes.h>
+#include "knot.h"
struct SPItem;
struct SPKnot;
@@ -23,9 +26,39 @@ namespace NR {
class Point;
}
-/// SPKnotHolderEntity definition.
-struct SPKnotHolderEntity {
+class SPDesktop;
+class KnotHolder;
+
+typedef void (* SPKnotHolderSetFunc) (SPItem *item, NR::Point const &p, NR::Point const &origin, guint state);
+typedef NR::Point (* SPKnotHolderGetFunc) (SPItem *item);
+/* fixme: Think how to make callbacks most sensitive (Lauris) */
+typedef void (* SPKnotHolderReleasedFunc) (SPItem *item);
+
+class KnotHolderEntity {
+public:
+ KnotHolderEntity() {}
+ virtual ~KnotHolderEntity();
+ virtual void create(SPDesktop *desktop, SPItem *item, KnotHolder *parent, const gchar *tip = "",
+ SPKnotShapeType shape = SP_KNOT_SHAPE_DIAMOND,
+ SPKnotModeType mode = SP_KNOT_MODE_XOR,
+ guint32 color = 0xffffff00);
+
+ /* the get/set/click handlers are virtual functions; each handler class for a knot
+ should be derived from KnotHolderEntity and override these functions */
+ virtual void knot_set_func(NR::Point const &p, NR::Point const &origin, guint state);
+ virtual NR::Point knot_get_func();
+ virtual void knot_click_func(guint state);
+
+ void update_knot();
+
+//private:
SPKnot *knot;
+ SPItem *item;
+
+ KnotHolder *parent_holder;
+
+ int my_counter;
+ static int counter;
/** Connection to \a knot's "moved" signal. */
guint handler_id;
@@ -34,6 +67,10 @@ struct SPKnotHolderEntity {
/** Connection to \a knot's "ungrabbed" signal. */
guint _ungrab_handler_id;
+ sigc::connection _moved_connection;
+ sigc::connection _click_connection;
+ sigc::connection _ungrabbed_connection;
+
/**
* Called solely from knot_moved_handler.
*
@@ -51,6 +88,25 @@ struct SPKnotHolderEntity {
void (* knot_click) (SPItem *item, guint state);
};
+/* pattern manipulation */
+
+class PatternKnotHolderEntityXY : public KnotHolderEntity {
+public:
+ virtual NR::Point knot_get_func();
+ virtual void knot_set_func(NR::Point const &p, NR::Point const &origin, guint state);
+};
+
+class PatternKnotHolderEntityAngle : public KnotHolderEntity {
+public:
+ virtual NR::Point knot_get_func();
+ virtual void knot_set_func(NR::Point const &p, NR::Point const &origin, guint state);
+};
+
+class PatternKnotHolderEntityScale : public KnotHolderEntity {
+public:
+ virtual NR::Point knot_get_func();
+ virtual void knot_set_func(NR::Point const &p, NR::Point const &origin, guint state);
+};
#endif /* !SEEN_KNOT_HOLDER_ENTITY_H */