gnomemm r1742 - in goocanvasmm/trunk: . goocanvas/src tests/child_properties
- From: murrayc svn gnome org
- To: svn-commits-list gnome org
- Subject: gnomemm r1742 - in goocanvasmm/trunk: . goocanvas/src tests/child_properties
- Date: Mon, 13 Oct 2008 11:01:37 +0000 (UTC)
Author: murrayc
Date: Mon Oct 13 11:01:37 2008
New Revision: 1742
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1742&view=rev
Log:
2008-10-13 Murray Cumming <murrayc murrayc com>
* goocanvas/src/item.hg: Renamed set/get_child_property() to
set/get_child_property_value() and added templated set/get_child_property()
methods that do not use Glib::Value in their API.
* tests/child_properties/main.cc: Adjusted.
Modified:
goocanvasmm/trunk/ChangeLog
goocanvasmm/trunk/goocanvas/src/item.hg
goocanvasmm/trunk/tests/child_properties/main.cc
Modified: goocanvasmm/trunk/goocanvas/src/item.hg
==============================================================================
--- goocanvasmm/trunk/goocanvas/src/item.hg (original)
+++ goocanvasmm/trunk/goocanvas/src/item.hg Mon Oct 13 11:01:37 2008
@@ -65,11 +65,17 @@
_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)
+ _WRAP_METHOD(void get_child_property_value(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_value(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)
+ template <class PropertyType>
+ void get_child_property(const Glib::RefPtr<Item>& child, const Glib::ustring& the_property_name, PropertyType& value) const;
+
+ template <class PropertyType>
+ void set_child_property(const Glib::RefPtr<Item>& child, const Glib::ustring& the_property_name, const PropertyType& value);
+
_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,19 +239,27 @@
#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
+void Item::get_child_property(const Glib::RefPtr<Item>& child, 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);
+ this->get_child_property_value(child, the_property_name, property_value);
value = property_value.get();
}
-*/
+
+template <class PropertyType>
+void Item::set_child_property(const Glib::RefPtr<Item>& child, const Glib::ustring& the_property_name, const PropertyType& value)
+{
+ Glib::Value<PropertyType> property_value;
+ property_value.init(Glib::Value<PropertyType>::value_type());
+ property_value.set(value);
+
+ this->set_child_property_value(child, the_property_name, property_value);
+}
+
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
Modified: goocanvasmm/trunk/tests/child_properties/main.cc
==============================================================================
--- goocanvasmm/trunk/tests/child_properties/main.cc (original)
+++ goocanvasmm/trunk/tests/child_properties/main.cc Mon Oct 13 11:01:37 2008
@@ -32,11 +32,19 @@
table->attach(child, 2, 3, 5, 6, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);
//Examine the child property:
+
+ //Using a Glib::Value"
Glib::Value<int> column_value;
column_value.init(Glib::Value<int>::value_type());
- table->get_child_property(child, "column", column_value);
+ table->get_child_property_value(child, "column", column_value);
+
+ std::cout << "Column via Glib::Value: " << column_value.get() << std::endl;
+
+ //Using the template method:
+ int value2 = 0;
+ table->get_child_property(child, "column", value2);
- std::cout << "Column: " << column_value.get() << std::endl;
+ std::cout << "Column via templated get_child_property(): " << value2 << std::endl;
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]