[gtk/wip/ebassi/animations: 3/5] WIP: Add GtkPropertyAnimation



commit ab1efb48dce633d1600795499fca8a7eea8882f7
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Wed Jul 24 16:40:20 2019 +0100

    WIP: Add GtkPropertyAnimation
    
    A GtkAnimation subclass that interpolates a GObject property.

 gtk/gtkpropertyanimation.c | 49 +++++++++++++++++++++++++++++++++++++++++++
 gtk/gtkpropertyanimation.h | 52 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 101 insertions(+)
---
diff --git a/gtk/gtkpropertyanimation.c b/gtk/gtkpropertyanimation.c
new file mode 100644
index 0000000000..1eecc742de
--- /dev/null
+++ b/gtk/gtkpropertyanimation.c
@@ -0,0 +1,49 @@
+/* gtkpropertyanimation.c: An animation controlling a single property
+ *
+ * Copyright 2019  GNOME Foundation
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ *
+ * 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "gtkpropertyanimation.h"
+
+#include "gtktransitionprivate.h"
+
+enum
+{
+  INITIAL,
+  FINAL,
+  N_STATES
+};
+
+struct _GtkPropertyAnimation
+{
+  GtkTransition parent_instance;
+
+  GValue interval[N_STATES];
+};
+
+G_DEFINE_TYPE (GtkPropertyAnimation, gtk_property_animation, GTK_TYPE_ANIMATION)
+
+static void
+gtk_property_animation_class_init (GtkPropertyAnimationClass *klass)
+{
+}
+
+static void
+gtk_property_animation_init (GtkPropertyAnimation *self)
+{
+}
diff --git a/gtk/gtkpropertyanimation.h b/gtk/gtkpropertyanimation.h
new file mode 100644
index 0000000000..cee77ec4c0
--- /dev/null
+++ b/gtk/gtkpropertyanimation.h
@@ -0,0 +1,52 @@
+/* gtkpropertyanimation.h: An animation controlling a single object property
+ *
+ * Copyright 2019  GNOME Foundation
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ *
+ * 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#include <gtk/gtkanimation.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GtkPropertyAnimation:
+ *
+ * A animation that operates on a single property of a #GObject.
+ */
+GDK_AVAILABLE_IN_ALL
+G_DECLARE_FINAL_TYPE (GtkPropertyAnimation, gtk_property_animation, GTK, PROPERTY_ANIMATION, GtkAnimation)
+
+GDK_AVAILABLE_IN_ALL
+GtkAnimation *          gtk_property_animation_new             (const char           *property_name);
+
+/* Interval */
+GDK_AVAILABLE_IN_ALL
+void                    gtk_property_animation_set_from        (GtkPropertyAnimation *animation,
+                                                                 ...);
+GDK_AVAILABLE_IN_ALL
+void                    gtk_property_animation_set_from_value  (GtkPropertyAnimation *animation,
+                                                                 const GValue        *value);
+GDK_AVAILABLE_IN_ALL
+void                    gtk_property_animation_set_to          (GtkPropertyAnimation *animation,
+                                                                 ...);
+GDK_AVAILABLE_IN_ALL
+void                    gtk_property_animation_set_to_value    (GtkPropertyAnimation *animation,
+                                                                 const GValue         *value);
+
+G_END_DECLS


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