[cluttermm] Added Model and ModelIter.



commit d2c36377003782753d23dd6a1dee25b18de6798f
Author: Ian Martin <martin_id vodafone co nz>
Date:   Thu Apr 10 11:57:48 2014 +0200

    Added Model and ModelIter.
    
    This is based on a patch here:
    https://bugzilla.gnome.org/show_bug.cgi?id=725125#c5

 clutter/cluttermm.h           |    2 +
 clutter/src/filelist.am       |    2 +
 clutter/src/model-iter.ccg    |   24 ++++++++++++
 clutter/src/model-iter.hg     |   54 +++++++++++++++++++++++++++
 clutter/src/model.ccg         |   23 +++++++++++
 clutter/src/model.hg          |   82 +++++++++++++++++++++++++++++++++++++++++
 codegen/m4/convert_clutter.m4 |    5 ++
 7 files changed, 192 insertions(+), 0 deletions(-)
---
diff --git a/clutter/cluttermm.h b/clutter/cluttermm.h
index 60cc407..2899590 100644
--- a/clutter/cluttermm.h
+++ b/clutter/cluttermm.h
@@ -101,6 +101,8 @@
 #include <cluttermm/layoutmeta.h>
 #include <cluttermm/main.h>
 #include <cluttermm/media.h>
+#include <cluttermm/model.h>
+#include <cluttermm/model-iter.h>
 #include <cluttermm/offscreen-effect.h>
 #include <cluttermm/page-turn-effect.h>
 #include <cluttermm/path.h>
diff --git a/clutter/src/filelist.am b/clutter/src/filelist.am
index 2bf4854..f31035e 100644
--- a/clutter/src/filelist.am
+++ b/clutter/src/filelist.am
@@ -57,6 +57,8 @@ files_hg =                    \
        layoutmeta.hg           \
        layout-manager.hg       \
        media.hg                \
+       model.hg \
+       model-iter.hg \
        offscreen-effect.hg \
        page-turn-effect.hg \
        path.hg                 \
diff --git a/clutter/src/model-iter.ccg b/clutter/src/model-iter.ccg
new file mode 100644
index 0000000..c0fe33b
--- /dev/null
+++ b/clutter/src/model-iter.ccg
@@ -0,0 +1,24 @@
+/* Copyright (C) 2014 The cluttermm Development Team
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <clutter/clutter.h>
+#include <cluttermm/model.h>
+
+namespace Clutter
+{
+
+} //namespace Clutter
diff --git a/clutter/src/model-iter.hg b/clutter/src/model-iter.hg
new file mode 100644
index 0000000..4bf8a78
--- /dev/null
+++ b/clutter/src/model-iter.hg
@@ -0,0 +1,54 @@
+/* Copyright (C) 2014 The cluttermm Development Team
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <glibmm/object.h>
+
+_DEFS(cluttermm,clutter)
+_PINCLUDE(glibmm/private/object_p.h)
+
+namespace Clutter
+{
+
+class Model;
+
+class ModelIter: public Glib::Object
+{
+  _CLASS_GOBJECT(ModelIter, ClutterModelIter, CLUTTER_MODEL_ITER, Glib::Object, GObject)
+  _DERIVES_INITIALLY_UNOWNED()
+
+protected:
+  _CTOR_DEFAULT()
+
+public:
+  //_WRAP_CREATE()
+  //_WRAP_METHOD(void get_valist(va_list args), clutter_model_iter_get_valist)
+
+  _WRAP_METHOD(void get_value(guint column, const Glib::ValueBase& value), clutter_model_iter_get_value)
+  _WRAP_METHOD(void set_valist(va_list args),  clutter_model_iter_set_valist)
+  _WRAP_METHOD(void set_value(guint column, const Glib::ValueBase& value), clutter_model_iter_set_value)
+  _WRAP_METHOD(bool is_first() const, clutter_model_iter_is_first)
+  _WRAP_METHOD(bool is_last() const, clutter_model_iter_is_last)
+  _WRAP_METHOD(Glib::RefPtr<ModelIter> next(), clutter_model_iter_next, refreturn)
+  _WRAP_METHOD(Glib::RefPtr<ModelIter> prev(), clutter_model_iter_prev, refreturn)
+  _WRAP_METHOD(Glib::RefPtr<Model> get_model(), clutter_model_iter_get_model, refreturn)
+  _WRAP_METHOD(guint get_row() const, clutter_model_iter_get_row)
+
+   _WRAP_PROPERTY("model", Glib::RefPtr<Model>)
+   _WRAP_PROPERTY("row", int)
+};
+
+} // namespace Clutter
diff --git a/clutter/src/model.ccg b/clutter/src/model.ccg
new file mode 100644
index 0000000..66c2098
--- /dev/null
+++ b/clutter/src/model.ccg
@@ -0,0 +1,23 @@
+/* Copyright (C) 2014 The cluttermm Development Team
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <clutter/clutter.h>
+
+namespace Clutter
+{
+
+} //namespace Clutter
diff --git a/clutter/src/model.hg b/clutter/src/model.hg
new file mode 100644
index 0000000..e6ef67d
--- /dev/null
+++ b/clutter/src/model.hg
@@ -0,0 +1,82 @@
+/* Copyright (C) 2014 The cluttermm Development Team
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <glibmm/object.h>
+#include <cluttermm/model-iter.h>
+
+_DEFS(cluttermm,clutter)
+_PINCLUDE(glibmm/private/object_p.h)
+
+namespace Clutter
+{
+
+//TODO: Write a version of the large description from here: 
http://clutter-project.org/docs/clutter/stable/ClutterModel.html#ClutterModel.description
+class Model : public Glib::Object
+{
+  _CLASS_GOBJECT(Model, ClutterModel, CLUTTER_MODEL, Glib::Object, GObject)
+
+protected:
+  _CTOR_DEFAULT()
+
+public:
+  //There is no create() because this is an abstract base class.
+  //_WRAP_CREATE()
+
+  //_WRAP_METHOD(GType get_type(), clutter_model_get_type)
+  //TODO: _WRAP_METHOD(void set_types(guint n_columns, GType* types), clutter_model_set_types)
+
+  _IGNORE(clutter_model_append, clutter_model_prepend, clutter_model_insert)
+  // TODO IM: Template these to get rid of the GValues:
+
+  //TODO: Value is a templated type and the n_columns parameter is superfluous:
+  //_WRAP_METHOD(void append(int n_columns, const std::vector<int>& columns, const std::vector<Glib::Value>& 
values), clutter_model_appendv)
+  //_WRAP_METHOD(void prepend(int n_columns, const std::vector<int>&  columns, std::vector<Glib::Value>  
values), clutter_model_prependv)
+  //_WRAP_METHOD(void insert(int row, int n_columns, const std::vector<int>&  columns, const 
std::vector<GLib::Value>& values), clutter_model_insertv)
+
+  //TODO: Rename ths to insert_value() and add a templated insert()?
+  _WRAP_METHOD(void insert(guint row, guint column, const Glib::ValueBase& value), 
clutter_model_insert_value)
+
+  _WRAP_METHOD(void remove(guint row), clutter_model_remove)
+  _WRAP_METHOD(guint get_n_rows() const, clutter_model_get_n_rows)
+  _WRAP_METHOD(guint get_n_columns() const, clutter_model_get_n_columns)
+  _WRAP_METHOD(Glib::ustring get_column_name(guint column) const,  clutter_model_get_column_name)
+  _WRAP_METHOD(GType get_column_type(guint column) const, clutter_model_get_column_type)
+  //~ _WRAP_METHOD(Glib::RefPtr<ModelIter> get_first_iter(), clutter_model_get_first_iter )
+  //~ _WRAP_METHOD(Glib::RefPtr<ModelIter> get_last_iter(), clutter_model_get_last_iter )
+  //~ _WRAP_METHOD(Glib::RefPtr<ModelIter> get_iter_at_row(guint row), clutter_model_get_iter_at_row )
+
+
+#m4 _CONVERSION(`ClutterModelIter*', `const Glib::RefPtr<ModelIter>&', `Glib::wrap(($3), true)')
+  _WRAP_SIGNAL(void row_added(const Glib::RefPtr<ModelIter>& iter), "row_added")
+  _WRAP_SIGNAL(void row_removed(const Glib::RefPtr<ModelIter>& iter), "row_removed")
+  _WRAP_SIGNAL(void row_changed(const Glib::RefPtr<ModelIter>& iter), "row_changed")
+
+  _WRAP_SIGNAL(void sort_changed(), "sort_changed")
+  _WRAP_SIGNAL(void filter_changed(), "filter_changed")
+
+
+  _WRAP_VFUNC(guint get_n_rows() const, get_n_rows)
+  _WRAP_VFUNC(guint get_n_columns() const, get_n_columns)
+  _WRAP_VFUNC(Glib::ustring get_column_name(guint column) const, get_column_name)
+  _WRAP_VFUNC(GType get_column_type(guint column) const, get_column_type)
+  _WRAP_VFUNC(Glib::RefPtr<ModelIter> insert_row(guint index_), insert_row)
+  _WRAP_VFUNC(void remove_row(guint row), remove_row)
+  _WRAP_VFUNC(Glib::RefPtr<ModelIter> get_iter_at_row(guint row), get_iter_at_row)
+  //TODO? _WRAP_VFUNC(void resort(ClutterModelSortFunc func, Glib::Pointer data), resort)
+};
+
+} // namespace Clutter
diff --git a/codegen/m4/convert_clutter.m4 b/codegen/m4/convert_clutter.m4
index df138a0..469d6c8 100644
--- a/codegen/m4/convert_clutter.m4
+++ b/codegen/m4/convert_clutter.m4
@@ -96,6 +96,11 @@ _CONVERSION(`ClutterLayoutMeta*',`Glib::RefPtr<const LayoutMeta>',`Glib::wrap($3
 
 _CONVERSION(`const Margin&',`const ClutterMargin*',`($3).gobj()')
 
+_CONVERSION(`ClutterModel*', `Glib::RefPtr<Model>', `Glib::wrap($3)')
+
+_CONVERSION(`ClutterModelIter*', `Glib::RefPtr<ModelIter>', `Glib::wrap($3)')
+_CONVERSION(`const Glib::RefPtr<ModelIter>&', `ClutterModelIter*',__CONVERT_REFPTR_TO_P)
+
 _CONVERSION(`Padding&',`ClutterPadding*',`&($3)')
 _CONVERSION(`const Padding&',`const ClutterPadding*',`&($3)')
 _CONVERSION(`ClutterPadding*',`Padding&',`*($3)')


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