gnomemm r1734 - in goocanvasmm/trunk: . examples/table goocanvas/src tests tests/child_properties



Author: murrayc
Date: Wed Oct  8 16:40:19 2008
New Revision: 1734
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1734&view=rev

Log:
2008-10-08  Murray Cumming  <murrayc murrayc com>

* Makefile.am:
* configure.in:
* tests/Makefile.am:
* tests/child_properties/: Added a test
for get_child_property().

Added:
   goocanvasmm/trunk/tests/
   goocanvasmm/trunk/tests/Makefile.am
   goocanvasmm/trunk/tests/child_properties/
   goocanvasmm/trunk/tests/child_properties/Makefile.am
   goocanvasmm/trunk/tests/child_properties/main.cc
Modified:
   goocanvasmm/trunk/ChangeLog
   goocanvasmm/trunk/Makefile.am
   goocanvasmm/trunk/configure.in
   goocanvasmm/trunk/examples/table/main.cc
   goocanvasmm/trunk/goocanvas/src/item.hg

Modified: goocanvasmm/trunk/Makefile.am
==============================================================================
--- goocanvasmm/trunk/Makefile.am	(original)
+++ goocanvasmm/trunk/Makefile.am	Wed Oct  8 16:40:19 2008
@@ -1,4 +1,4 @@
-SUBDIRS		= tools goocanvas docs examples
+SUBDIRS		= tools goocanvas docs tests examples
 DIST_SUBDIRS	= $(SUBDIRS) scripts
 
 EXTRA_DIST	=  \

Modified: goocanvasmm/trunk/configure.in
==============================================================================
--- goocanvasmm/trunk/configure.in	(original)
+++ goocanvasmm/trunk/configure.in	Wed Oct  8 16:40:19 2008
@@ -181,5 +181,8 @@
     examples/text/Makefile
     examples/table/Makefile
     examples/tablemodel/Makefile
+
+  tests/Makefile
+    tests/child_properties/Makefile
 ])
 :

Modified: goocanvasmm/trunk/examples/table/main.cc
==============================================================================
--- goocanvasmm/trunk/examples/table/main.cc	(original)
+++ goocanvasmm/trunk/examples/table/main.cc	Wed Oct  8 16:40:19 2008
@@ -21,11 +21,13 @@
 int
 main(int argc, char* argv[])
 {
-  Gtk::Main app(&argc, &argv) ;
-  Goocanvas::init("goocanvasmm Simple Example", "0.1", argc, argv) ;
+  Gtk::Main app(&argc, &argv);
+  Goocanvas::init("goocanvasmm Simple Example", "0.1", argc, argv);
 
-  ExampleWindow sw ;
-  Gtk::Main::run(sw) ;
+  ExampleWindow sw;
+  Gtk::Main::run(sw);
+
+  return 0;
 }
 
 

Modified: goocanvasmm/trunk/goocanvas/src/item.hg
==============================================================================
--- goocanvasmm/trunk/goocanvas/src/item.hg	(original)
+++ goocanvasmm/trunk/goocanvas/src/item.hg	Wed Oct  8 16:40:19 2008
@@ -41,11 +41,6 @@
 
 public:
 
-  _IGNORE(goo_canvas_item_get_child_properties)
-  _IGNORE(goo_canvas_item_set_child_properties)
-  _IGNORE(goo_canvas_item_get_child_properties_valist)
-  _IGNORE(goo_canvas_item_set_child_properties_valist)
-
   _WRAP_METHOD(Canvas* get_canvas(), goo_canvas_item_get_canvas)
   _WRAP_METHOD(const Canvas* get_canvas() const, goo_canvas_item_get_canvas, constversion)
   // TODO: should this be passed by reference instead of by pointer?
@@ -69,8 +64,11 @@
   _WRAP_METHOD(int find_child(const Glib::RefPtr<Item>& child), goo_canvas_item_find_child)
   _WRAP_METHOD(void add_child(const Glib::RefPtr<Item>& child, int pos), goo_canvas_item_add_child)
   void add_child(const Glib::RefPtr<Item>& child);
+
   _WRAP_METHOD(void get_child_property(const Glib::RefPtr<Item>& child, const Glib::ustring& property_name, Glib::ValueBase& value) const, goo_canvas_item_get_child_property)
   _WRAP_METHOD(void set_child_property(const Glib::RefPtr<Item>& child, const Glib::ustring& property_name, const Glib::ValueBase& value), goo_canvas_item_set_child_property)
+  _IGNORE(goo_canvas_item_get_child_properties_valist)
+  _IGNORE(goo_canvas_item_set_child_properties_valist)
 
   _WRAP_METHOD(void move_child(int old_position, int new_position), goo_canvas_item_move_child)
   _WRAP_METHOD(void remove_child(int child_num), goo_canvas_item_remove_child)
@@ -233,5 +231,23 @@
   _WRAP_VFUNC(void set_model(const Glib::RefPtr<ItemModel>& model), set_model)
 };
 
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+
+/* TODO:
+//The parameter name is "the_property_name" to avoid a warning because there is a method with the "property_name" name.
+template <class PropertyType>
+void Item::get_child_property(const Glib::ustring& the_property_name, PropertyType& value) const
+{
+  Glib::Value<PropertyType> property_value;
+  property_value.init(Glib::Value<PropertyType>::value_type());
+
+  this->get_child_property_value(the_property_name, property_value);
+
+  value = property_value.get();
+}
+*/
+
+#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+
 } //namespace Goocanvas
 

Added: goocanvasmm/trunk/tests/Makefile.am
==============================================================================
--- (empty file)
+++ goocanvasmm/trunk/tests/Makefile.am	Wed Oct  8 16:40:19 2008
@@ -0,0 +1,2 @@
+SUBDIRS = child_properties
+

Added: goocanvasmm/trunk/tests/child_properties/Makefile.am
==============================================================================
--- (empty file)
+++ goocanvasmm/trunk/tests/child_properties/Makefile.am	Wed Oct  8 16:40:19 2008
@@ -0,0 +1,5 @@
+include $(top_srcdir)/examples/Makefile.am_fragment
+
+noinst_PROGRAMS = test
+test_SOURCES = main.cc
+

Added: goocanvasmm/trunk/tests/child_properties/main.cc
==============================================================================
--- (empty file)
+++ goocanvasmm/trunk/tests/child_properties/main.cc	Wed Oct  8 16:40:19 2008
@@ -0,0 +1,42 @@
+/* Copyright (C) 2008 The goocanvasmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <gtkmm.h>
+#include <goocanvasmm.h>
+#include <iostream>
+
+int
+main(int argc, char* argv[])
+{
+  Gtk::Main app(&argc, &argv) ;
+  Goocanvas::init("goocanvasmm Simple Example", "0.1", argc, argv);
+
+  Glib::RefPtr<Goocanvas::Table> table = Goocanvas::Table::create();
+
+  //Add a child to the table:
+  Glib::RefPtr<Goocanvas::Text> child = Goocanvas::Text::create("test");
+  table->attach(child, 2, 3, 5, 6, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);
+
+  //Examine the child property:
+  Glib::Value<int> column_value;
+  column_value.init(Glib::Value<int>::value_type());
+  table->get_child_property(child, "column", column_value);
+
+  std::cout << "Column: " << column_value.get() << std::endl;
+
+  return 0;
+}



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