[gtk+/wip/events: 14/19] API: Add a pinch/pan/rotate gesture



commit 31179fe9cb0bcbd9570682048820429468704cfb
Author: Benjamin Otte <otte redhat com>
Date:   Sat Mar 10 17:38:12 2012 +0100

    API: Add a pinch/pan/rotate gesture
    
    For lack of a better name, it's called GtkPinchPanGesture. Suggest a
    better name and I'll change it.

 gtk/Makefile.am             |    4 +
 gtk/gtk.h                   |    2 +
 gtk/gtkpinchpangesture.c    |  306 +++++++++++++++++++++++++++++++++++++++++++
 gtk/gtkpinchpangesture.h    |   85 ++++++++++++
 gtk/gtkpinchpanrecognizer.c |   95 +++++++++++++
 gtk/gtkpinchpanrecognizer.h |   72 ++++++++++
 6 files changed, 564 insertions(+), 0 deletions(-)
---
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index 6d9e6f9..4c2de1b 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -288,6 +288,8 @@ gtk_public_h_sources = 		\
 	gtkpagesetup.h		\
 	gtkpaned.h		\
 	gtkpapersize.h		\
+	gtkpinchpangesture.h	\
+	gtkpinchpanrecognizer.h	\
 	gtkplug.h		\
 	gtkprintcontext.h	\
 	gtkprintoperation.h	\
@@ -717,6 +719,8 @@ gtk_base_c_sources = 		\
 	gtkpango.c		\
 	gtkpapersize.c		\
 	gtkpathbar.c		\
+	gtkpinchpangesture.c	\
+	gtkpinchpanrecognizer.c	\
 	gtkpressandhold.c	\
 	gtkprintcontext.c	\
 	gtkprintoperation.c	\
diff --git a/gtk/gtk.h b/gtk/gtk.h
index 62489e6..97f5fef 100644
--- a/gtk/gtk.h
+++ b/gtk/gtk.h
@@ -145,6 +145,8 @@
 #include <gtk/gtkpagesetup.h>
 #include <gtk/gtkpapersize.h>
 #include <gtk/gtkpaned.h>
+#include <gtk/gtkpinchpangesture.h>
+#include <gtk/gtkpinchpanrecognizer.h>
 #include <gtk/gtkprintcontext.h>
 #include <gtk/gtkprintoperation.h>
 #include <gtk/gtkprintoperationpreview.h>
diff --git a/gtk/gtkpinchpangesture.c b/gtk/gtkpinchpangesture.c
new file mode 100644
index 0000000..cf1ad46
--- /dev/null
+++ b/gtk/gtkpinchpangesture.c
@@ -0,0 +1,306 @@
+/*
+ * Copyright  2012 Red Hat Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authors: Benjamin Otte <otte gnome org>
+ */
+
+#include "config.h"
+
+#include "gtkpinchpangesture.h"
+
+#include "gtksequencetrackerprivate.h"
+#include "gtkpinchpanrecognizer.h"
+
+#include <math.h>
+
+/**
+ * SECTION:gtkpinchpangesture
+ * @Short_description: Gesture for pinch, pan and rotation
+ * @Title: GtkPinchPanGesture
+ * @See_also: #GtkPinchPanRecognizer
+ *
+ * The #GtkPinchPanGesture object is used to to track pinch, pan and rotation
+ * gestures. These are usually used to implement scrolling, zooming and rotation
+ * respectively on scrollable widgets.
+ *
+ * #GtkPinchPanGesture was added in GTK 3.6.
+ */
+
+
+enum {
+  PROP_0,
+};
+
+struct _GtkPinchPanGesturePrivate {
+  GtkSequenceTracker *sequence[2];
+  double              initial_distance;
+  double              initial_angle;
+};
+
+G_DEFINE_TYPE (GtkPinchPanGesture, gtk_pinch_pan_gesture, GTK_TYPE_EVENT_TRACKER)
+
+static void
+gtk_pinch_pan_gesture_set_property (GObject      *object,
+                                    guint         prop_id,
+                                    const GValue *value,
+                                    GParamSpec   *pspec)
+{
+  //GtkPinchPanGesture *gesture = GTK_PINCH_PAN_GESTURE (object);
+  //GtkPinchPanGesturePrivate *priv = gesture->priv;
+
+  switch (prop_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+static void
+gtk_pinch_pan_gesture_get_property (GObject    *object,
+                                    guint       prop_id,
+                                    GValue     *value,
+                                    GParamSpec *pspec)
+{
+  //GtkPinchPanGesture *gesture = GTK_PINCH_PAN_GESTURE (object);
+  //GtkPinchPanGesturePrivate *priv = gesture->priv;
+
+  switch (prop_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+static void
+gtk_pinch_pan_gesture_dispose (GObject *object)
+{
+  //GtkPinchPanGesture *gesture = GTK_PINCH_PAN_GESTURE (object);
+
+  G_OBJECT_CLASS (gtk_pinch_pan_gesture_parent_class)->dispose (object);
+}
+
+static void
+gtk_pinch_pan_gesture_class_init (GtkPinchPanGestureClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->dispose = gtk_pinch_pan_gesture_dispose;
+  object_class->set_property = gtk_pinch_pan_gesture_set_property;
+  object_class->get_property = gtk_pinch_pan_gesture_get_property;
+
+  g_type_class_add_private (object_class, sizeof (GtkPinchPanGesturePrivate));
+}
+
+static void
+gtk_pinch_pan_gesture_init (GtkPinchPanGesture *gesture)
+{
+  gesture->priv = G_TYPE_INSTANCE_GET_PRIVATE (gesture,
+                                               GTK_TYPE_PINCH_PAN_GESTURE,
+                                               GtkPinchPanGesturePrivate);
+}
+
+gboolean
+_gtk_pinch_pan_gesture_begin (GtkPinchPanGesture *gesture,
+                              GdkEvent           *event)
+{
+  GtkPinchPanGesturePrivate *priv = gesture->priv;
+
+  if (priv->sequence[1] != NULL)
+    return FALSE;
+
+  if (priv->sequence[0] == NULL)
+    priv->sequence[0] = _gtk_sequence_tracker_new (event);
+  else
+    priv->sequence[1] = _gtk_sequence_tracker_new (event);
+
+  if (priv->sequence[1])
+    {
+      double x, y;
+      _gtk_sequence_tracker_compute_distance (priv->sequence[0],
+                                              priv->sequence[1],
+                                              &x, &y);
+      priv->initial_distance = sqrt (x * x + y * y);
+      priv->initial_angle = atan2 (y, x);
+      gtk_event_tracker_start (GTK_EVENT_TRACKER (gesture));
+    }
+
+  return FALSE;
+}
+
+gboolean
+gtk_pinch_pan_gesture_update_for_event (GtkPinchPanGesture *gesture,
+                                        GdkEvent           *event)
+{
+  GtkPinchPanGesturePrivate *priv = gesture->priv;
+  gboolean result = FALSE;
+  guint i;
+
+  for (i = 0; i < 2; i++)
+    {
+      if (priv->sequence[i])
+        result |= _gtk_sequence_tracker_update (priv->sequence[i], event);
+    }
+  return result;
+}
+
+gboolean
+_gtk_pinch_pan_gesture_update (GtkPinchPanGesture *gesture,
+                               GdkEvent           *event)
+{
+  if (gtk_pinch_pan_gesture_update_for_event (gesture, event) &&
+      gtk_event_tracker_is_started (GTK_EVENT_TRACKER (gesture)))
+    gtk_event_tracker_update (GTK_EVENT_TRACKER (gesture));
+
+  return FALSE;
+}
+
+gboolean
+_gtk_pinch_pan_gesture_end (GtkPinchPanGesture *gesture,
+                            GdkEvent           *event)
+{
+  if (gtk_pinch_pan_gesture_update_for_event (gesture, event))
+    {
+      if (gesture->priv->sequence[1])
+        gtk_event_tracker_finish (GTK_EVENT_TRACKER (gesture));
+      else
+        gtk_event_tracker_cancel (GTK_EVENT_TRACKER (gesture));
+    }
+
+  return FALSE;
+}
+
+gboolean
+_gtk_pinch_pan_gesture_cancel (GtkPinchPanGesture *gesture,
+                               GdkEvent           *event)
+{
+  if (gtk_pinch_pan_gesture_update_for_event (gesture, event))
+    gtk_event_tracker_cancel (GTK_EVENT_TRACKER (gesture));
+
+  return FALSE;
+}
+
+void
+gtk_pinch_pan_gesture_get_offset (GtkPinchPanGesture *gesture,
+                              double          *x,
+                              double          *y)
+{
+  GtkPinchPanGesturePrivate *priv;
+
+  g_return_if_fail (GTK_IS_PINCH_PAN_GESTURE (gesture));
+  
+  priv = gesture->priv;
+
+  if (!gtk_event_tracker_is_started (GTK_EVENT_TRACKER (gesture)) ||
+      gtk_event_tracker_is_cancelled (GTK_EVENT_TRACKER (gesture)))
+    {
+      if (x)
+        *x = 0;
+      if (y)
+        *y = 0;
+
+      return;
+    }
+
+  if (x)
+    *x = (_gtk_sequence_tracker_get_x_offset (priv->sequence[0])
+          + _gtk_sequence_tracker_get_x_offset (priv->sequence[1])) / 2;
+  if (y)
+    *y = (_gtk_sequence_tracker_get_y_offset (priv->sequence[0])
+          + _gtk_sequence_tracker_get_y_offset (priv->sequence[1])) / 2;
+}
+
+double
+gtk_pinch_pan_gesture_get_x_offset (GtkPinchPanGesture *gesture)
+{
+  GtkPinchPanGesturePrivate *priv;
+
+  g_return_val_if_fail (GTK_IS_PINCH_PAN_GESTURE (gesture), 0.0);
+  
+  priv = gesture->priv;
+
+  if (!gtk_event_tracker_is_started (GTK_EVENT_TRACKER (gesture)) ||
+      gtk_event_tracker_is_cancelled (GTK_EVENT_TRACKER (gesture)))
+    return 0;
+
+  return (_gtk_sequence_tracker_get_x_offset (priv->sequence[0])
+          + _gtk_sequence_tracker_get_x_offset (priv->sequence[1])) / 2;
+}
+
+double
+gtk_pinch_pan_gesture_get_y_offset (GtkPinchPanGesture *gesture)
+{
+  GtkPinchPanGesturePrivate *priv;
+
+  g_return_val_if_fail (GTK_IS_PINCH_PAN_GESTURE (gesture), 0.0);
+  
+  priv = gesture->priv;
+
+  if (!gtk_event_tracker_is_started (GTK_EVENT_TRACKER (gesture)) ||
+      gtk_event_tracker_is_cancelled (GTK_EVENT_TRACKER (gesture)))
+    return 0;
+
+  return (_gtk_sequence_tracker_get_y_offset (priv->sequence[0])
+          + _gtk_sequence_tracker_get_y_offset (priv->sequence[1])) / 2;
+}
+
+double
+gtk_pinch_pan_gesture_get_rotation (GtkPinchPanGesture *gesture)
+{
+  GtkPinchPanGesturePrivate *priv;
+  double x, y, angle;
+
+  g_return_val_if_fail (GTK_IS_PINCH_PAN_GESTURE (gesture), 0.0);
+  
+  priv = gesture->priv;
+
+  if (!gtk_event_tracker_is_started (GTK_EVENT_TRACKER (gesture)) ||
+      gtk_event_tracker_is_cancelled (GTK_EVENT_TRACKER (gesture)))
+    return 0;
+
+  _gtk_sequence_tracker_compute_distance (priv->sequence[0],
+                                          priv->sequence[1],
+                                          &x, &y);
+  angle = atan2 (y, x);
+  angle -= priv->initial_angle;
+  angle *= 180 / G_PI;
+  angle = fmod (angle + 360, 360);
+  
+  return angle;
+}
+
+double
+gtk_pinch_pan_gesture_get_zoom (GtkPinchPanGesture *gesture)
+{
+  GtkPinchPanGesturePrivate *priv;
+  double x, y;
+
+  g_return_val_if_fail (GTK_IS_PINCH_PAN_GESTURE (gesture), 1.0);
+  
+  priv = gesture->priv;
+
+  if (!gtk_event_tracker_is_started (GTK_EVENT_TRACKER (gesture)) ||
+      gtk_event_tracker_is_cancelled (GTK_EVENT_TRACKER (gesture)))
+    return 1;
+
+  _gtk_sequence_tracker_compute_distance (priv->sequence[0],
+                                          priv->sequence[1],
+                                          &x, &y);
+  
+  return sqrt (x * x + y * y) / priv->initial_distance;
+}
diff --git a/gtk/gtkpinchpangesture.h b/gtk/gtkpinchpangesture.h
new file mode 100644
index 0000000..46a5764
--- /dev/null
+++ b/gtk/gtkpinchpangesture.h
@@ -0,0 +1,85 @@
+/*
+ * Copyright  2012 Red Hat Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authors: Benjamin Otte <otte gnome org>
+ */
+
+#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
+#error "Only <gtk/gtk.h> can be included directly."
+#endif
+
+#ifndef __GTK_PINCH_PAN_GESTURE_H__
+#define __GTK_PINCH_PAN_GESTURE_H__
+
+#include <gtk/gtkeventtracker.h>
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_PINCH_PAN_GESTURE           (gtk_pinch_pan_gesture_get_type ())
+#define GTK_PINCH_PAN_GESTURE(obj)           (G_TYPE_CHECK_INSTANCE_CAST (obj, GTK_TYPE_PINCH_PAN_GESTURE, GtkPinchPanGesture))
+#define GTK_PINCH_PAN_GESTURE_CLASS(cls)     (G_TYPE_CHECK_CLASS_CAST (cls, GTK_TYPE_PINCH_PAN_GESTURE, GtkPinchPanGestureClass))
+#define GTK_IS_PINCH_PAN_GESTURE(obj)        (G_TYPE_CHECK_INSTANCE_TYPE (obj, GTK_TYPE_PINCH_PAN_GESTURE))
+#define GTK_IS_PINCH_PAN_GESTURE_CLASS(obj)  (G_TYPE_CHECK_CLASS_TYPE (obj, GTK_TYPE_PINCH_PAN_GESTURE))
+#define GTK_PINCH_PAN_GESTURE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_PINCH_PAN_GESTURE, GtkPinchPanGestureClass))
+
+typedef struct _GtkPinchPanGesture           GtkPinchPanGesture;
+typedef struct _GtkPinchPanGestureClass      GtkPinchPanGestureClass;
+typedef struct _GtkPinchPanGesturePrivate    GtkPinchPanGesturePrivate;
+
+struct _GtkPinchPanGesture
+{
+  GtkEventTracker parent;
+
+  GtkPinchPanGesturePrivate *priv;
+};
+
+struct _GtkPinchPanGestureClass
+{
+  GtkEventTrackerClass parent_class;
+
+  /* Padding for future expansion */
+  void (*_gtk_reserved0) (void);
+  void (*_gtk_reserved1) (void);
+  void (*_gtk_reserved2) (void);
+  void (*_gtk_reserved3) (void);
+  void (*_gtk_reserved4) (void);
+  void (*_gtk_reserved5) (void);
+  void (*_gtk_reserved6) (void);
+  void (*_gtk_reserved7) (void);
+};
+
+GType                 gtk_pinch_pan_gesture_get_type      (void) G_GNUC_CONST;
+
+double                gtk_pinch_pan_gesture_get_rotation  (GtkPinchPanGesture   *gesture);
+double                gtk_pinch_pan_gesture_get_zoom      (GtkPinchPanGesture   *gesture);
+double                gtk_pinch_pan_gesture_get_x_offset  (GtkPinchPanGesture   *gesture);
+double                gtk_pinch_pan_gesture_get_y_offset  (GtkPinchPanGesture   *gesture);
+
+#include <gdk/gdk.h>
+
+gboolean              _gtk_pinch_pan_gesture_begin        (GtkPinchPanGesture   *gesture,
+                                                           GdkEvent             *event);
+gboolean              _gtk_pinch_pan_gesture_update       (GtkPinchPanGesture   *gesture,
+                                                           GdkEvent             *event);
+gboolean              _gtk_pinch_pan_gesture_end          (GtkPinchPanGesture   *gesture,
+                                                           GdkEvent             *event);
+gboolean              _gtk_pinch_pan_gesture_cancel       (GtkPinchPanGesture   *gesture,
+                                                           GdkEvent             *event);
+
+G_END_DECLS
+
+#endif /* __GTK_PINCH_PAN_GESTURE_H__ */
diff --git a/gtk/gtkpinchpanrecognizer.c b/gtk/gtkpinchpanrecognizer.c
new file mode 100644
index 0000000..bc841b8
--- /dev/null
+++ b/gtk/gtkpinchpanrecognizer.c
@@ -0,0 +1,95 @@
+/*
+ * Copyright  2012 Red Hat Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authors: Benjamin Otte <otte gnome org>
+ */
+
+#include "config.h"
+
+#include "gtkpinchpanrecognizer.h"
+
+#include "gtkpinchpangesture.h"
+
+/**
+ * SECTION:gtkpinch_panrecognizer
+ * @Short_description: Recognizes vertical and horizontal pinch_pan gestures
+ * @Title: GtkPinchPanRecognizer
+ * @See_also: #GtkPinchPanGesture
+ *
+ * #GtkPinchPanRecoginzer recognizes vertical and horizontal pinch_pan gestures.
+ *
+ * #GtkPinchPanRecognizer was added in GTK 3.6.
+ */
+
+G_DEFINE_TYPE (GtkPinchPanRecognizer, gtk_pinch_pan_recognizer, GTK_TYPE_EVENT_RECOGNIZER)
+
+static void
+gtk_pinch_pan_recognizer_recognize (GtkEventRecognizer *recognizer,
+                                GtkWidget          *widget,
+                                GdkEvent           *event)
+{
+  if (event->type == GDK_TOUCH_BEGIN)
+    gtk_event_recognizer_create_tracker (recognizer, widget, event);
+}
+
+static gboolean
+gtk_pinch_pan_recognizer_track (GtkEventRecognizer *recognizer,
+                            GtkEventTracker    *tracker,
+                            GdkEvent           *event)
+{
+  GtkPinchPanGesture *gesture = GTK_PINCH_PAN_GESTURE (tracker);
+
+  switch (event->type)
+    {
+    case GDK_TOUCH_BEGIN:
+      return _gtk_pinch_pan_gesture_begin (gesture, event);
+    case GDK_TOUCH_END:
+      return _gtk_pinch_pan_gesture_end (gesture, event);
+    case GDK_TOUCH_UPDATE:
+      return _gtk_pinch_pan_gesture_update (gesture, event);
+    case GDK_TOUCH_CANCEL:
+      return _gtk_pinch_pan_gesture_cancel (gesture, event);
+    default:
+      return FALSE;
+    }
+}
+
+static void
+gtk_pinch_pan_recognizer_class_init (GtkPinchPanRecognizerClass *klass)
+{
+  GtkEventRecognizerClass *recognizer_class = GTK_EVENT_RECOGNIZER_CLASS (klass);
+
+  recognizer_class->recognize = gtk_pinch_pan_recognizer_recognize;
+  recognizer_class->track = gtk_pinch_pan_recognizer_track;
+
+  gtk_event_recognizer_class_set_event_mask (recognizer_class,
+                                             GDK_TOUCH_MASK);
+  gtk_event_recognizer_class_set_tracker_type (recognizer_class,
+                                               GTK_TYPE_PINCH_PAN_GESTURE);
+}
+
+static void
+gtk_pinch_pan_recognizer_init (GtkPinchPanRecognizer *recognizer)
+{
+}
+
+GtkEventRecognizer *
+gtk_pinch_pan_recognizer_new (void)
+{
+  return g_object_new (GTK_TYPE_PINCH_PAN_RECOGNIZER, NULL);
+}
+
diff --git a/gtk/gtkpinchpanrecognizer.h b/gtk/gtkpinchpanrecognizer.h
new file mode 100644
index 0000000..d39e554
--- /dev/null
+++ b/gtk/gtkpinchpanrecognizer.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright  2012 Red Hat Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authors: Benjamin Otte <otte gnome org>
+ */
+
+#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
+#error "Only <gtk/gtk.h> can be included directly."
+#endif
+
+#ifndef __GTK_PINCH_PAN_RECOGNIZER_H__
+#define __GTK_PINCH_PAN_RECOGNIZER_H__
+
+#include <gtk/gtkeventrecognizer.h>
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_PINCH_PAN_RECOGNIZER           (gtk_pinch_pan_recognizer_get_type ())
+#define GTK_PINCH_PAN_RECOGNIZER(obj)           (G_TYPE_CHECK_INSTANCE_CAST (obj, GTK_TYPE_PINCH_PAN_RECOGNIZER, GtkPinchPanRecognizer))
+#define GTK_PINCH_PAN_RECOGNIZER_CLASS(cls)     (G_TYPE_CHECK_CLASS_CAST (cls, GTK_TYPE_PINCH_PAN_RECOGNIZER, GtkPinchPanRecognizerClass))
+#define GTK_IS_PINCH_PAN_RECOGNIZER(obj)        (G_TYPE_CHECK_INSTANCE_TYPE (obj, GTK_TYPE_PINCH_PAN_RECOGNIZER))
+#define GTK_IS_PINCH_PAN_RECOGNIZER_CLASS(obj)  (G_TYPE_CHECK_CLASS_TYPE (obj, GTK_TYPE_PINCH_PAN_RECOGNIZER))
+#define GTK_PINCH_PAN_RECOGNIZER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_PINCH_PAN_RECOGNIZER, GtkPinchPanRecognizerClass))
+
+typedef struct _GtkPinchPanRecognizer           GtkPinchPanRecognizer;
+typedef struct _GtkPinchPanRecognizerClass      GtkPinchPanRecognizerClass;
+typedef struct _GtkPinchPanRecognizerPrivate    GtkPinchPanRecognizerPrivate;
+
+struct _GtkPinchPanRecognizer
+{
+  GtkEventRecognizer parent;
+
+  GtkPinchPanRecognizerPrivate *priv;
+};
+
+struct _GtkPinchPanRecognizerClass
+{
+  GtkEventRecognizerClass parent_class;
+
+  /* Padding for future expansion */
+  void (*_gtk_reserved0) (void);
+  void (*_gtk_reserved1) (void);
+  void (*_gtk_reserved2) (void);
+  void (*_gtk_reserved3) (void);
+  void (*_gtk_reserved4) (void);
+  void (*_gtk_reserved5) (void);
+  void (*_gtk_reserved6) (void);
+  void (*_gtk_reserved7) (void);
+};
+
+GType                 gtk_pinch_pan_recognizer_get_type       (void) G_GNUC_CONST;
+
+GtkEventRecognizer *  gtk_pinch_pan_recognizer_new            (void);
+
+
+G_END_DECLS
+
+#endif /* __GTK_PINCH_PAN_RECOGNIZER_H__ */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]