gnomemm r1410 - in goocanvasmm/trunk: . examples/table goocanvas goocanvas/src tools/m4
- From: arminb svn gnome org
- To: svn-commits-list gnome org
- Subject: gnomemm r1410 - in goocanvasmm/trunk: . examples/table goocanvas goocanvas/src tools/m4
- Date: Mon, 17 Mar 2008 13:56:12 +0000 (GMT)
Author: arminb
Date: Mon Mar 17 13:56:12 2008
New Revision: 1410
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1410&view=rev
Log:
2008-03-17 Armin Burgmeier <armin openismus com>
* goocanvas/src/table.hg:
* goocanvas/src/table.ccg:
* examples/table/examplewindow.h:
* examples/table/examplewindow.cc: Added attach() convenience API.
* goocanvas/src/tablemodel.hg:
* goocanvas/src/tablemodel.ccg:
* goocanvas/src/Makefile_list_of_hg.am_fragment:
* goocanvas/goocanvasmm.h: Wrapped GooCanvasItemModel.
* goocanvas/src/style.hg:
* goocanvas/src/style.ccg:
* goocanvas/src/enums.ccg: Wrapped goo_canvas_style_get/set_property()
via a similar approach to Glib::ObjectBase::get/set_property(). This
requires Glib::Value<> to work with some non-GObject-based cairo
types (that goocanvas already wraps for GObject).
* goocanvas/src/libgoocanvas_methods.defs: Regenerated.
* goocanvas/src/libgoocanvas_vfuncs.defs: Added missing vfuncs.
* tools/m4/convert_libgoocanvasmm.m4: Added more required conversions.
* goocanvas/src/itemsimple.hg:
* goocanvas/src/itemmodel.ccg:
* goocanvas/src/canvas.hg:
* goocanvas/src/widget.hg:
* goocanvas/src/enums.hg:
* goocanvas/src/item.hg:
* goocanvas/src/itemmodel.hg:
* goocanvas/src/text.hg:
* goocanvas/src/item.ccg: Wrapped remaining properties, signals,
methods and vfuncs.
Added:
goocanvasmm/trunk/goocanvas/src/tablemodel.ccg
goocanvasmm/trunk/goocanvas/src/tablemodel.hg
Modified:
goocanvasmm/trunk/ChangeLog
goocanvasmm/trunk/examples/table/examplewindow.cc
goocanvasmm/trunk/goocanvas/goocanvasmm.h
goocanvasmm/trunk/goocanvas/src/Makefile_list_of_hg.am_fragment
goocanvasmm/trunk/goocanvas/src/canvas.hg
goocanvasmm/trunk/goocanvas/src/enums.ccg
goocanvasmm/trunk/goocanvas/src/enums.hg
goocanvasmm/trunk/goocanvas/src/item.ccg
goocanvasmm/trunk/goocanvas/src/item.hg
goocanvasmm/trunk/goocanvas/src/itemmodel.ccg
goocanvasmm/trunk/goocanvas/src/itemmodel.hg
goocanvasmm/trunk/goocanvas/src/itemsimple.hg
goocanvasmm/trunk/goocanvas/src/libgoocanvas_methods.defs
goocanvasmm/trunk/goocanvas/src/libgoocanvas_vfuncs.defs
goocanvasmm/trunk/goocanvas/src/style.ccg
goocanvasmm/trunk/goocanvas/src/style.hg
goocanvasmm/trunk/goocanvas/src/table.ccg
goocanvasmm/trunk/goocanvas/src/table.hg
goocanvasmm/trunk/goocanvas/src/text.hg
goocanvasmm/trunk/goocanvas/src/widget.hg
goocanvasmm/trunk/tools/m4/convert_libgoocanvasmm.m4
Modified: goocanvasmm/trunk/examples/table/examplewindow.cc
==============================================================================
--- goocanvasmm/trunk/examples/table/examplewindow.cc (original)
+++ goocanvasmm/trunk/examples/table/examplewindow.cc Mon Mar 17 13:56:12 2008
@@ -39,13 +39,7 @@
void ExampleWindow::add_text_to_cell(const Glib::RefPtr<Goocanvas::Table>& table, const Glib::ustring& text, guint row, guint col)
{
Glib::RefPtr<Goocanvas::Text> text_item = Goocanvas::Text::create(text);
- table->add_child(text_item);
- goo_canvas_item_set_child_properties(GOO_CANVAS_ITEM(table->gobj()), GOO_CANVAS_ITEM(text_item->gobj()),
- "row", row,
- "column", col,
- "x-fill", TRUE,
- "x-expand", TRUE,
- NULL);
+ table->attach(text_item, col, col+1, row, row+1, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);
}
bool
Modified: goocanvasmm/trunk/goocanvas/goocanvasmm.h
==============================================================================
--- goocanvasmm/trunk/goocanvas/goocanvasmm.h (original)
+++ goocanvasmm/trunk/goocanvas/goocanvasmm.h Mon Mar 17 13:56:12 2008
@@ -56,6 +56,7 @@
#include <goocanvasmm/rectmodel.h>
#include <goocanvasmm/style.h>
#include <goocanvasmm/table.h>
+#include <goocanvasmm/tablemodel.h>
#include <goocanvasmm/text.h>
#include <goocanvasmm/textmodel.h>
#include <goocanvasmm/types.h>
Modified: goocanvasmm/trunk/goocanvas/src/Makefile_list_of_hg.am_fragment
==============================================================================
--- goocanvasmm/trunk/goocanvas/src/Makefile_list_of_hg.am_fragment (original)
+++ goocanvasmm/trunk/goocanvas/src/Makefile_list_of_hg.am_fragment Mon Mar 17 13:56:12 2008
@@ -25,6 +25,7 @@
rectmodel.hg \
style.hg \
table.hg \
+tablemodel.hg \
text.hg \
textmodel.hg \
widget.hg \
Modified: goocanvasmm/trunk/goocanvas/src/canvas.hg
==============================================================================
--- goocanvasmm/trunk/goocanvas/src/canvas.hg (original)
+++ goocanvasmm/trunk/goocanvas/src/canvas.hg Mon Mar 17 13:56:12 2008
@@ -57,14 +57,14 @@
_WRAP_METHOD(Glib::RefPtr<Item> get_item_at(double x, double y, bool is_pointer_event), goo_canvas_get_item_at, refreturn)
_WRAP_METHOD(Glib::RefPtr<const Item> get_item_at(double x, double y, bool is_pointer_event) const, goo_canvas_get_item_at, constversion)
- //TODO: Ref the items?
- //TODO: Add const versions
-
#define(`__FL2H_SHALLOW',`$`'2($`'3, Glib::OWNERSHIP_SHALLOW)')
#_CONVERSION(`GList*',`Glib::ListHandle< Glib::RefPtr<Item> >', __FL2H_SHALLOW)
+#_CONVERSION(`GList*',`Glib::ListHandle< Glib::RefPtr<const Item> >', __FL2H_SHALLOW)
_WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<Item> > get_items_at(double x, double y, bool is_pointer_event), goo_canvas_get_items_at)
- _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<Item> > get_items_in_area(const Bounds& area, bool inside_area, bool allow_overlaps, bool include_containers) const, goo_canvas_get_items_in_area)
+ _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<const Item> > get_items_at(double x, double y, bool is_pointer_event) const, goo_canvas_get_items_at)
+ _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<Item> > get_items_in_area(const Bounds& area, bool inside_area, bool allow_overlaps, bool include_containers), goo_canvas_get_items_in_area)
+ _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<const Item> > get_items_in_area(const Bounds& area, bool inside_area, bool allow_overlaps, bool include_containers) const, goo_canvas_get_items_in_area)
_WRAP_METHOD(double get_scale() const, goo_canvas_get_scale)
_WRAP_METHOD(void set_scale(double scale), goo_canvas_set_scale)
@@ -136,7 +136,10 @@
_WRAP_PROPERTY("background-color", Glib::ustring)
_WRAP_PROPERTY("background-color-rgb", guint)
_WRAP_PROPERTY("integer-layout", bool)
+ _WRAP_PROPERTY("clear-background", bool)
+protected:
+ _WRAP_VFUNC(Glib::RefPtr<Item> create_item(const Glib::RefPtr<ItemModel>& model), "create_item")
};
} //namespace Goocanvas
Modified: goocanvasmm/trunk/goocanvas/src/enums.ccg
==============================================================================
--- goocanvasmm/trunk/goocanvas/src/enums.ccg (original)
+++ goocanvasmm/trunk/goocanvas/src/enums.ccg Mon Mar 17 13:56:12 2008
@@ -14,4 +14,31 @@
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+
#include <goocanvasenumtypes.h>
+
+namespace Glib
+{
+
+// Make the cairo enums and structures work with Glib::Value using the
+// GTypes goocanvas defines for them in goocanvasutil.h
+
+// We can't simply derive from Glib::ValueBoxed<> because these have no
+// gobj() function to return the underlying boxed C object.
+GType Value<Cairo::Pattern>::value_type() { return goo_cairo_pattern_get_type(); }
+GType Value<Cairo::Matrix*>::value_type() { return goo_cairo_matrix_get_type(); }
+
+// Normally, _WRAP_ENUM does generate this code for us, but we can't use
+// _WRAP_ENUM here because the enums are already wrapped in cairomm. However,
+// goocanvas defines GTypes for them so they can be used with GValue. We need
+// this since we want to use these enums in Glib::Value<>s, for example to
+// pass them to properties via the property_*() functions.
+GType Value<Cairo::FillRule>::value_type() { return goo_cairo_fill_rule_get_type(); }
+GType Value<Cairo::Operator>::value_type() { return goo_cairo_operator_get_type(); }
+GType Value<Cairo::Antialias>::value_type() { return goo_cairo_antialias_get_type(); }
+GType Value<Cairo::LineCap>::value_type() { return goo_cairo_line_cap_get_type(); }
+GType Value<Cairo::LineJoin>::value_type() { return goo_cairo_line_join_get_type(); }
+GType Value<Cairo::HintMetrics>::value_type() { return goo_cairo_hint_metrics_get_type(); }
+
+}
+
Modified: goocanvasmm/trunk/goocanvas/src/enums.hg
==============================================================================
--- goocanvasmm/trunk/goocanvas/src/enums.hg (original)
+++ goocanvasmm/trunk/goocanvas/src/enums.hg Mon Mar 17 13:56:12 2008
@@ -17,6 +17,10 @@
#include <goocanvasutils.h>
+#include <cairomm/enums.h>
+#include <cairomm/pattern.h>
+#include <cairomm/context.h> // For Cairo::Matrix
+
_DEFS(goocanvasmm,libgoocanvas)
namespace Goocanvas
@@ -28,3 +32,76 @@
_WRAP_ENUM(PathCommandType,GooCanvasPathCommandType)
} //namespace Goocanvas
+
+namespace Glib
+{
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+// Make the cairo enums and structures work with Glib::Value using the
+// GTypes goocanvas defines for them in goocanvasutil.h
+
+template<>
+class Value<Cairo::Pattern> : public Glib::ValueBase_Boxed
+{
+public:
+ static GType value_type() G_GNUC_CONST;
+
+ void set(const Cairo::Pattern& data) { set_boxed(data.cobj()); }
+ Cairo::Pattern get() const { return Cairo::Pattern(static_cast<cairo_pattern_t*>(get_boxed())); }
+};
+
+template<>
+class Value<Cairo::Matrix*> : public Glib::ValueBase_Boxed
+{
+public:
+ static GType value_type() G_GNUC_CONST;
+
+ void set(const Cairo::Matrix* data) { set_boxed(data); }
+ Cairo::Matrix* get() const { return static_cast<Cairo::Matrix*>(get_boxed()); }
+};
+
+template<>
+class Value<Cairo::FillRule> : public Glib::Value_Enum<Cairo::FillRule>
+{
+public:
+ static GType value_type() G_GNUC_CONST;
+};
+
+template<>
+class Value<Cairo::Operator> : public Glib::Value_Enum<Cairo::Operator>
+{
+public:
+ static GType value_type() G_GNUC_CONST;
+};
+
+template<>
+class Value<Cairo::Antialias> : public Glib::Value_Enum<Cairo::Antialias>
+{
+public:
+ static GType value_type() G_GNUC_CONST;
+};
+
+template<>
+class Value<Cairo::LineCap> : public Glib::Value_Enum<Cairo::LineCap>
+{
+public:
+ static GType value_type() G_GNUC_CONST;
+};
+
+template<>
+class Value<Cairo::LineJoin> : public Glib::Value_Enum<Cairo::LineJoin>
+{
+public:
+ static GType value_type() G_GNUC_CONST;
+};
+
+template<>
+class Value<Cairo::HintMetrics> : public Glib::Value_Enum<Cairo::HintMetrics>
+{
+public:
+ static GType value_type() G_GNUC_CONST;
+};
+
+#endif // DOXYGEN_SHOULD_SKIP_THIS
+
+}
Modified: goocanvasmm/trunk/goocanvas/src/item.ccg
==============================================================================
--- goocanvasmm/trunk/goocanvas/src/item.ccg (original)
+++ goocanvasmm/trunk/goocanvas/src/item.ccg Mon Mar 17 13:56:12 2008
@@ -45,6 +45,143 @@
goo_canvas_item_add_child(gobj(), Glib::unwrap(child), -1);
}
+// We need to hand-code this vfunc to write the result back into the
+// bounds variable. The C++ wrapper cannot ref the existing variable, but only
+// make a copy.
+void Item_Class::get_bounds_vfunc_callback(GooCanvasItem* item, GooCanvasBounds* bounds)
+{
+ CppObjectType *const obj = dynamic_cast<CppObjectType*>(
+ Glib::ObjectBase::_get_current_wrapper((GObject*)item));
+
+ // Non-gtkmmproc-generated custom classes implicitly call the default
+ // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
+ // generated classes can use this optimisation, which avoids the unnecessary
+ // parameter conversions if there is no possibility of the virtual function
+ // being overridden:
+ if(obj && obj->is_derived_())
+ {
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
+ try // Trap C++ exceptions which would normally be lost because this is a C callback.
+ {
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
+ // Call the virtual member method, which derived classes might override.
+ Bounds cpp_bounds;
+ obj->get_bounds_vfunc(cpp_bounds);
+ *bounds = *cpp_bounds.gobj();
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
+ }
+ catch(...)
+ {
+ Glib::exception_handlers_invoke();
+ }
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
+ }
+ else
+ {
+ BaseClassType *const base = static_cast<BaseClassType*>(
+ g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
+g_type_interface_peek(G_OBJECT_GET_CLASS(item), CppObjectType::get_type()) // Get the interface.
+) );
+
+ // Call the original underlying C function:
+ if(base && base->get_bounds)
+ return (*base->get_bounds)(item, bounds);
+ }
+}
+
+void Item::get_bounds_vfunc(Bounds& bounds) const
+{
+ //Call the default C implementation:
+
+ BaseClassType *const base = static_cast<BaseClassType*>(
+ g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
+ g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
+ )
+ );
+
+ if(base && base->get_bounds)
+ (*base->get_bounds)(const_cast<GooCanvasItem*>(gobj()), bounds.gobj());
+}
+
+// We need to hand-code this vfunc because of the semantics of the GList
+// parameter and return value. In C, this function is supposed to prepend
+// new entries to the given list and return the new list head. In C++, we
+// cannot emulate this behaviour since it is not possible to prepend items to
+// a Glib::ListHandle<>. Thus, we always create a new list to return, and
+// free the one passed in.
+GList* Item_Class::get_items_at_vfunc_callback(GooCanvasItem* self, gdouble x, gdouble y, cairo_t* cr, gboolean is_pointer_event, gboolean parent_is_visible, GList* found_items)
+{
+ CppObjectType *const obj = dynamic_cast<CppObjectType*>(
+ Glib::ObjectBase::_get_current_wrapper((GObject*)self));
+
+ // Non-gtkmmproc-generated custom classes implicitly call the default
+ // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
+ // generated classes can use this optimisation, which avoids the unnecessary
+ // parameter conversions if there is no possibility of the virtual function
+ // being overridden:
+ if(obj && obj->is_derived_())
+ {
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
+ try // Trap C++ exceptions which would normally be lost because this is a C callback.
+ {
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
+ // Call the virtual member method, which derived classes might override.
+ Bounds cpp_bounds;
+ Glib::ListHandle<Glib::RefPtr<Item> > retval(obj->get_items_at_vfunc(x, y, Cairo::RefPtr<Cairo::Context>(new Cairo::Context(cr, false /* has_reference */)), is_pointer_event == TRUE, parent_is_visible == TRUE, Glib::ListHandle<Glib::RefPtr<Item> >(found_items, Glib::OWNERSHIP_NONE)));
+ // retval will free the list on destruction, and we can't change the
+ // ownership here, so we have to copy the list.
+ return g_list_copy(retval.data());
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
+ }
+ catch(...)
+ {
+ Glib::exception_handlers_invoke();
+ }
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
+ }
+ else
+ {
+ BaseClassType *const base = static_cast<BaseClassType*>(
+ g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
+g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
+) );
+
+ // Call the original underlying C function:
+ if(base && base->get_items_at)
+ return (*base->get_items_at)(self, x, y, cr, is_pointer_event, parent_is_visible, found_items);
+ }
+}
+
+Glib::ListHandle<Glib::RefPtr<Item> > Item::get_items_at_vfunc(double x, double y, const Cairo::RefPtr<Cairo::Context>& context, bool is_pointer_event, bool is_parent_visible, const Glib::ListHandle<Glib::RefPtr<Item> >& found_items) const
+{
+ //Call the default C implementation:
+
+ BaseClassType *const base = static_cast<BaseClassType*>(
+ g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
+ g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
+ )
+ );
+
+ // We rely on found_items having ownership NONE here, otherwise we would have
+ // to do an extra copy. Note that we cannot return a OWNERSHIP_NONE list
+ // since overriders of the C++ vfunc might return a vector or list or
+ // something which, when converting to ListHandle, has always shallow
+ // ownership.
+ if(base && base->get_items_at)
+ return Glib::ListHandle<Glib::RefPtr<Item> >((*base->get_items_at)(const_cast<GooCanvasItem*>(gobj()), x, y, context->cobj(), static_cast<int>(is_pointer_event), static_cast<int>(is_parent_visible), found_items.data()), Glib::OWNERSHIP_SHALLOW);
+
+ return Glib::ListHandle<Glib::RefPtr<Item> >(NULL, Glib::OWNERSHIP_SHALLOW);
+}
+
+Glib::ListHandle< Glib::RefPtr<Item> > Item::get_items_at(double x, double y, const Cairo::RefPtr<Cairo::Context>& context, bool is_pointer_event, bool parent_is_visible)
+{
+ return Glib::ListHandle< Glib::RefPtr<Item> >(goo_canvas_item_get_items_at(gobj(), x, y, (context)->cobj(), static_cast<int>(is_pointer_event), static_cast<int>(parent_is_visible), NULL), Glib::OWNERSHIP_SHALLOW);
+}
+
+Glib::ListHandle< Glib::RefPtr<const Item> > Item::get_items_at(double x, double y, const Cairo::RefPtr<Cairo::Context>& context, bool is_pointer_event, bool parent_is_visible) const
+{
+ return Glib::ListHandle< Glib::RefPtr<const Item> >(goo_canvas_item_get_items_at(const_cast<GooCanvasItem*>(gobj()), x, y, (context)->cobj(), static_cast<int>(is_pointer_event), static_cast<int>(parent_is_visible), NULL), Glib::OWNERSHIP_SHALLOW);
+}
} //namespace Goocanvas
Modified: goocanvasmm/trunk/goocanvas/src/item.hg
==============================================================================
--- goocanvasmm/trunk/goocanvas/src/item.hg (original)
+++ goocanvasmm/trunk/goocanvas/src/item.hg Mon Mar 17 13:56:12 2008
@@ -98,9 +98,19 @@
_WRAP_METHOD(double get_requested_height(const Cairo::RefPtr<Cairo::Context>& context, double width) const, goo_canvas_item_get_requested_height)
_WRAP_METHOD(void allocate_area(const Cairo::RefPtr<Cairo::Context>& context, const Bounds& requested_area, const Bounds& allocated_area, double x_offset, double y_offset), goo_canvas_item_allocate_area)
-#m4 _CONVERSION(`GList*',`Glib::ListHandle< Glib::RefPtr<Item> >',`$2($3, Glib::OWNERSHIP_NONE)')
-#m4 _CONVERSION(`Glib::ListHandle< Glib::RefPtr<Item> >&',`GList*', `($3).data()')
- _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<Item> > get_items_at(double x, double y, const Cairo::RefPtr<Cairo::Context>& context, bool is_pointer_event, bool parent_is_visible, Glib::ListHandle< Glib::RefPtr<Item> >& found_items), goo_canvas_item_get_items_at)
+
+ // Note the semantics of the C version: The returned list is the same as the
+ // one fed into the function, with possibly some elements added to the head.
+#m4 _CONVERSION(`const Glib::ListHandle< Glib::RefPtr<Item> >&', `GList*', `g_list_copy(($3).data())')
+#m4 _CONVERSION(`const Glib::ListHandle< Glib::RefPtr<const Item> >&', `GList*', `g_list_copy(($3).data())')
+#m4 _CONVERSION(`GList*', `Glib::ListHandle< Glib::RefPtr<Item> >', `$2($3, Glib::OWNERSHIP_SHALLOW)')
+#m4 _CONVERSION(`GList*', `Glib::ListHandle< Glib::RefPtr<const Item> >', `$2($3, Glib::OWNERSHIP_SHALLOW)')
+ _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<Item> > get_items_at(double x, double y, const Cairo::RefPtr<Cairo::Context>& context, bool is_pointer_event, bool parent_is_visible, const Glib::ListHandle< Glib::RefPtr<Item> >& found_items), goo_canvas_item_get_items_at)
+ _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<const Item> > get_items_at(double x, double y, const Cairo::RefPtr<Cairo::Context>& context, bool is_pointer_event, bool parent_is_visible, const Glib::ListHandle< Glib::RefPtr<const Item> >& found_items) const, goo_canvas_item_get_items_at)
+
+ // Use this if you don't have a list already:
+ Glib::ListHandle< Glib::RefPtr<Item> > get_items_at(double x, double y, const Cairo::RefPtr<Cairo::Context>& context, bool is_pointer_event, bool parent_is_visible);
+ Glib::ListHandle< Glib::RefPtr<const Item> > get_items_at(double x, double y, const Cairo::RefPtr<Cairo::Context>& context, bool is_pointer_event, bool parent_is_visible) const;
//TODO: Use Cairo::RefPtr?
_WRAP_METHOD(bool get_transform(Cairo::Matrix* matrix), goo_canvas_item_get_transform)
@@ -141,90 +151,85 @@
_WRAP_SIGNAL(bool grab_broken_event(const Glib::RefPtr<Item>& target, GdkEventGrabBroken* event), "grab_broken_event")
_WRAP_SIGNAL(void child_notify(GParamSpec* pspec), "child_notify")
- _WRAP_PROPERTY("can-focus", bool)
+ _WRAP_PROPERTY("parent", Glib::RefPtr<Item>);
_WRAP_PROPERTY("visibility", ItemVisibility)
- _WRAP_PROPERTY("description", Glib::ustring)
_WRAP_PROPERTY("visibility-threshold", double)
+ _WRAP_PROPERTY("transform", Cairo::Matrix*);
_WRAP_PROPERTY("pointer-events", PointerEvents)
+ _WRAP_PROPERTY("title", Glib::ustring)
+ _WRAP_PROPERTY("description", Glib::ustring)
+ _WRAP_PROPERTY("can-focus", bool)
protected:
-/*
-
- //_WRAP_VFUNC(Cairo::Matrix* get_transform(), get_transform)
- _WRAP_VFUNC(void set_transform(Cairo::Matrix* matrix), set_transform)
- //_WRAP_VFUNC(Glib::RefPtr<ItemView> create_view(const Glib::RefPtr<View>& canvas_view, const Glib::RefPtr<ItemView>& parent_view), create_view)
-*/
-
-
+#m4 _CONVERSION(`Glib::RefPtr<Item>', `GooCanvasItem*', `(($3) ? ($3)->gobj() : 0)');
+#m4 _CONVERSION(`GooCanvasItem*', `Glib::RefPtr<Item>', `Glib::wrap($3, true)')
/* Virtual methods that group items must implement. */
_WRAP_VFUNC(int get_n_children() const, get_n_children)
- _WRAP_VFUNC(Glib::RefPtr<Item> get_child(int child_num), get_child)
+ _WRAP_VFUNC(Glib::RefPtr<Item> get_child(int child_num) const, get_child)
_WRAP_VFUNC(void request_update(), request_update)
- _WRAP_VFUNC(GooCanvas* get_canvas(), get_canvas)
- _WRAP_VFUNC(void set_canvas(GooCanvas* canvas), set_canvas)
+ _WRAP_VFUNC(Canvas* get_canvas() const, get_canvas)
+ _WRAP_VFUNC(void set_canvas(Canvas* canvas), set_canvas)
+
/* Virtual methods that group items may implement. */
_WRAP_VFUNC(void add_child(const Glib::RefPtr<Item>& child, int position), add_child)
-/*
- void (* move_child(
- gint old_position,
- gint new_position);
- void (* remove_child(
- gint child_num);
- void (* get_child_property(
- GooCanvasItem *child,
- guint property_id,
- GValue *value,
- GParamSpec *pspec);
- void (* set_child_property(
- GooCanvasItem *child,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec);
- gboolean (* get_transform_for_child) (GooCanvasItem *item,
- GooCanvasItem *child,
- cairo_matrix_t *transform);
-*/
+ _WRAP_VFUNC(void move_child(int old_position, int new_position), move_child)
+ _WRAP_VFUNC(void remove_child(int child_num), remove_child)
+ _WRAP_VFUNC(void get_child_property(const Glib::RefPtr<Item>& child, guint property_id, Glib::ValueBase& value, GParamSpec* pspec) const, get_child_property)
+ _WRAP_VFUNC(void set_child_property(const Glib::RefPtr<Item>& child, guint property_id, const Glib::ValueBase& value, GParamSpec* pspec), set_child_property)
+ _WRAP_VFUNC(bool get_transform_for_child(const Glib::RefPtr<Item>& child, Cairo::Matrix* transform) const, get_transform_for_child)
/* Virtual methods that all canvas items must implement. */
-#m4 _CONVERSION(`Glib::RefPtr<Item>', `GooCanvasItem*', `(($3) ? ($3)->gobj() : 0)');
-#m4 _CONVERSION(`GooCanvasItem*', `Glib::RefPtr<Item>', `Glib::wrap($3, true)')
- _WRAP_VFUNC(GooCanvasItem* get_parent(), get_parent)
- _WRAP_VFUNC(void set_parent(GooCanvasItem* parent), set_parent)
-
+ _WRAP_VFUNC(Glib::RefPtr<Item> get_parent() const, get_parent)
+ _WRAP_VFUNC(void set_parent(const Glib::RefPtr<Item>& parent), set_parent)
- _WRAP_VFUNC(void get_bounds(GooCanvasBounds* bounds), get_bounds)
+#ifdef GLIBMM_VFUNCS_ENABLED
+ // Hand code, since Bounds can only copy a GooCanvasBounds* but not ref one.
+ virtual void get_bounds_vfunc(Bounds& bounds) const;
+ virtual Glib::ListHandle<Glib::RefPtr<Item> > get_items_at_vfunc(double x, double y, const Cairo::RefPtr<Cairo::Context>& context, bool is_pointer_event, bool is_parent_visible, const Glib::ListHandle<Glib::RefPtr<Item> >& found_items) const;
+#endif
+
+#m4begin
+ _PUSH(SECTION_PCC_CLASS_INIT_VFUNCS)
+ klass->get_bounds = &get_bounds_vfunc_callback;
+ klass->get_items_at = &get_items_at_vfunc_callback;
+ _SECTION(SECTION_PH_VFUNCS)
+ static void get_bounds_vfunc_callback(GooCanvasItem* self, GooCanvasBounds* bounds);
+ static GList* get_items_at_vfunc_callback(GooCanvasItem* self, gdouble x, gdouble y, cairo_t* cr, gboolean is_pointer_event, gboolean parent_is_visible, GList* found_items);
+ _POP()
+#m4end
#m4 _CONVERSION(`cairo_t*',`const Cairo::RefPtr<Cairo::Context>&',`Cairo::RefPtr<Cairo::Context>(new Cairo::Context($3, false /* has_reference */))')
- _WRAP_VFUNC(GList* get_items_at(double x, double y, const Cairo::RefPtr<Cairo::Context>& cr, bool is_pointer_event, bool parent_is_visible, GList* found_items), get_items_at)
_WRAP_VFUNC(void update(bool entire_tree, const Cairo::RefPtr<Cairo::Context>& cr, Bounds& bounds), update)
#m4 _CONVERSION(`const GooCanvasBounds*', `const Bounds&', `Glib::wrap($3)');
_WRAP_VFUNC(void paint(const Cairo::RefPtr<Cairo::Context>& cr, const Bounds& bounds, double scale), paint)
- _WRAP_VFUNC(bool get_requested_area(const Cairo::RefPtr<Cairo::Context>& cr, GooCanvasBounds* requested_area), get_requested_area)
+ _WRAP_VFUNC(bool get_requested_area(const Cairo::RefPtr<Cairo::Context>& cr, GooCanvasBounds* requested_area) const, get_requested_area)
_WRAP_VFUNC(void allocate_area(const Cairo::RefPtr<Cairo::Context>& cr, const Bounds& requested_area, const Bounds& allocated_area, double x_offset, double y_offset), allocate_area)
/* Virtual methods that canvas items may implement. */
- _WRAP_VFUNC(bool get_transform(cairo_matrix_t* transform), get_transform)
- _WRAP_VFUNC(void set_transform(const cairo_matrix_t* transform), set_transform)
- _WRAP_VFUNC(GooCanvasStyle* get_style(), get_style)
- _WRAP_VFUNC(void set_style(GooCanvasStyle* style), set_style)
- _WRAP_VFUNC(bool is_visible(), is_visible)
+ _WRAP_VFUNC(bool get_transform(Cairo::Matrix* transform) const, get_transform)
+ _WRAP_VFUNC(void set_transform(const Cairo::Matrix* transform), set_transform)
+
+#m4 _CONVERSION(`Glib::RefPtr<Style>', `GooCanvasStyle*', `(($3) ? ($3)->gobj() : 0)')
+#m4 _CONVERSION(`GooCanvasStyle*', `Glib::RefPtr<Style>', `Glib::wrap($3, true)')
+#m4 _CONVERSION(`GooCanvasStyle*', `const Glib::RefPtr<Style>&', `Glib::wrap($3, true)')
+ _WRAP_VFUNC(Glib::RefPtr<Style> get_style() const, get_style)
+ _WRAP_VFUNC(void set_style(const Glib::RefPtr<Style>& style), set_style)
+ _WRAP_VFUNC(bool is_visible() const, is_visible)
_WRAP_VFUNC(double get_requested_height(const Cairo::RefPtr<Cairo::Context>& cr, double width), get_requested_height)
/* Virtual methods that model/view items must implement. */
-/*
- GooCanvasItemModel* (* get_model) (GooCanvasItem *item);
- void (* set_model(
- GooCanvasItemModel *model);
-*/
-
-
+#m4 _CONVERSION(`Glib::RefPtr<ItemModel>', `GooCanvasItemModel*', `(($3) ? ($3)->gobj() : 0)');
+#m4 _CONVERSION(`GooCanvasItemModel*', `Glib::RefPtr<ItemModel>', `Glib::wrap($3, true)')
+#m4 _CONVERSION(`GooCanvasItemModel*', `const Glib::RefPtr<ItemModel>&', `Glib::wrap($3, true)')
+ _WRAP_VFUNC(Glib::RefPtr<ItemModel> get_model() const, get_model)
+ _WRAP_VFUNC(void set_model(const Glib::RefPtr<ItemModel>& model), set_model)
};
} //namespace Goocanvas
Modified: goocanvasmm/trunk/goocanvas/src/itemmodel.ccg
==============================================================================
--- goocanvasmm/trunk/goocanvas/src/itemmodel.ccg (original)
+++ goocanvasmm/trunk/goocanvas/src/itemmodel.ccg Mon Mar 17 13:56:12 2008
@@ -16,6 +16,7 @@
*/
#include <goocanvasenumtypes.h>
+#include <goocanvasmm/canvas.h>
namespace Goocanvas
Modified: goocanvasmm/trunk/goocanvas/src/itemmodel.hg
==============================================================================
--- goocanvasmm/trunk/goocanvas/src/itemmodel.hg (original)
+++ goocanvasmm/trunk/goocanvas/src/itemmodel.hg Mon Mar 17 13:56:12 2008
@@ -30,6 +30,8 @@
namespace Goocanvas
{
+ class Canvas ;
+ class Item ;
_WRAP_ENUM(AnimateType,GooCanvasAnimateType)
@@ -44,8 +46,7 @@
_IGNORE(goo_canvas_item_model_get_child_properties_valist)
_IGNORE(goo_canvas_item_model_set_child_properties_valist)
- _WRAP_METHOD(int get_n_children(), goo_canvas_item_model_get_n_children)
- _WRAP_METHOD(int get_n_children() const, goo_canvas_item_model_get_n_children, constversion)
+ _WRAP_METHOD(int get_n_children() const, goo_canvas_item_model_get_n_children)
_WRAP_METHOD(Glib::RefPtr<ItemModel> get_child(int child_num), goo_canvas_item_model_get_child, refreturn)
_WRAP_METHOD(Glib::RefPtr<const ItemModel> get_child(int child_num) const, goo_canvas_item_model_get_child, refreturn, constversion)
_WRAP_METHOD(void get_child_property(const Glib::RefPtr<ItemModel>& child, const Glib::ustring& property_name, Glib::ValueBase& value) const, goo_canvas_item_model_get_child_property)
@@ -100,8 +101,9 @@
_WRAP_SIGNAL(void changed (bool recompute_bounds), "changed")
_WRAP_SIGNAL(void child_notify(GParamSpec* pspec), "child_notify")
- _WRAP_PROPERTY("parent", Glib::RefPtr<ItemModel>);
- _WRAP_PROPERTY("can-focus", bool);
+ _WRAP_PROPERTY("parent", Glib::RefPtr<ItemModel>)
+ _WRAP_PROPERTY("can-focus", bool)
+ _WRAP_PROPERTY("transform", Cairo::Matrix*)
_WRAP_PROPERTY("title", Glib::ustring)
_WRAP_PROPERTY("description", Glib::ustring)
_WRAP_PROPERTY("pointer-events", PointerEvents)
@@ -109,7 +111,31 @@
_WRAP_PROPERTY("visibility-threshold", double)
protected:
-
+#m4 _CONVERSION(`Glib::RefPtr<ItemModel>', `GooCanvasItemModel*', `(($3) ? ($3)->gobj() : 0)')
+#m4 _CONVERSION(`GooCanvasItemModel*', `Glib::RefPtr<ItemModel>', `Glib::wrap($3, true)')
+#m4 _CONVERSION(`GooCanvasItemModel*', `const Glib::RefPtr<ItemModel>&', `Glib::wrap($3, true)')
+ _WRAP_VFUNC(int get_n_children() const, get_n_children)
+ _WRAP_VFUNC(Glib::RefPtr<ItemModel> get_child(int child_num) const, get_child)
+ _WRAP_VFUNC(void add_child(const Glib::RefPtr<ItemModel>& child, int position), add_child)
+ _WRAP_VFUNC(void move_child(int old_position, int ne_position), move_child)
+ _WRAP_VFUNC(void remove_child(int child_num), remove_child)
+ _WRAP_VFUNC(void get_child_property(const Glib::RefPtr<ItemModel>& child, guint property_id, Glib::ValueBase& value, GParamSpec* pspec) const, get_child_property)
+ _WRAP_VFUNC(void set_child_property(const Glib::RefPtr<ItemModel>& child, guint property_id, const Glib::ValueBase& value, GParamSpec* pspec), set_child_property)
+
+ _WRAP_VFUNC(Glib::RefPtr<ItemModel> get_parent() const, get_parent)
+ _WRAP_VFUNC(void set_parent(const Glib::RefPtr<ItemModel>& parent), set_parent)
+
+#m4 _CONVERSION(`Glib::RefPtr<Item>', `GooCanvasItem*', `static_cast<GooCanvasItem*>(g_object_ref(Glib::unwrap($3)))')
+#m4 _CONVERSION(`GooCanvasItem*', `Glib::RefPtr<Item>', `Glib::wrap($3, false)')
+ _WRAP_VFUNC(Glib::RefPtr<Item> create_item(Canvas* canvas), create_item)
+ _WRAP_VFUNC(bool get_transform(Cairo::Matrix* transform) const, get_transform)
+ _WRAP_VFUNC(void set_transform(const Cairo::Matrix* transform), set_transform)
+
+#m4 _CONVERSION(`Glib::RefPtr<Style>', `GooCanvasStyle*', `(($3) ? ($3)->gobj() : 0)')
+#m4 _CONVERSION(`GooCanvasStyle*', `Glib::RefPtr<Style>', `Glib::wrap($3, true)')
+#m4 _CONVERSION(`GooCanvasStyle*', `const Glib::RefPtr<Style>&', `Glib::wrap($3, true)')
+ _WRAP_VFUNC(Glib::RefPtr<Style> get_style() const, get_style)
+ _WRAP_VFUNC(void set_style(const Glib::RefPtr<Style>& style), set_style)
};
}
Modified: goocanvasmm/trunk/goocanvas/src/itemsimple.hg
==============================================================================
--- goocanvasmm/trunk/goocanvas/src/itemsimple.hg (original)
+++ goocanvasmm/trunk/goocanvas/src/itemsimple.hg Mon Mar 17 13:56:12 2008
@@ -84,7 +84,7 @@
_WRAP_PROPERTY("parent", Glib::RefPtr<Item>)
_WRAP_PROPERTY("can-focus", bool)
_WRAP_PROPERTY("clip-path", Glib::ustring)
- _WRAP_PROPERTY("clip-path-fill-rule", Cairo::FillRule)
+ _WRAP_PROPERTY("clip-fill-rule", Cairo::FillRule)
#m4 _CONVERSION(`Bounds',`GooCanvasBounds',*($3).gobj())
#m4 _CONVERSION(`GooCanvasBounds',`Bounds',`Glib::wrap(&$3)')
Modified: goocanvasmm/trunk/goocanvas/src/libgoocanvas_methods.defs
==============================================================================
--- goocanvasmm/trunk/goocanvas/src/libgoocanvas_methods.defs (original)
+++ goocanvasmm/trunk/goocanvas/src/libgoocanvas_methods.defs Mon Mar 17 13:56:12 2008
@@ -225,6 +225,25 @@
)
+;; From goocanvasatk.h
+
+(define-function goo_canvas_accessible_factory_get_type
+ (c-name "goo_canvas_accessible_factory_get_type")
+ (return-type "GType")
+)
+
+(define-function goo_canvas_item_accessible_factory_get_type
+ (c-name "goo_canvas_item_accessible_factory_get_type")
+ (return-type "GType")
+)
+
+(define-function goo_canvas_widget_accessible_factory_get_type
+ (c-name "goo_canvas_widget_accessible_factory_get_type")
+ (return-type "GType")
+)
+
+
+
;; From goocanvasellipse.h
(define-function goo_canvas_ellipse_get_type
@@ -1676,6 +1695,66 @@
+;; From goocanvasprivate.h
+
+(define-function goo_canvas_util_ptr_array_insert
+ (c-name "goo_canvas_util_ptr_array_insert")
+ (return-type "none")
+ (parameters
+ '("GPtrArray*" "ptr_array")
+ '("gpointer" "data")
+ '("gint" "index")
+ )
+)
+
+(define-function goo_canvas_util_ptr_array_move
+ (c-name "goo_canvas_util_ptr_array_move")
+ (return-type "none")
+ (parameters
+ '("GPtrArray*" "ptr_array")
+ '("gint" "old_index")
+ '("gint" "new_index")
+ )
+)
+
+(define-function goo_canvas_util_ptr_array_find_index
+ (c-name "goo_canvas_util_ptr_array_find_index")
+ (return-type "gint")
+ (parameters
+ '("GPtrArray*" "ptr_array")
+ '("gpointer" "data")
+ )
+)
+
+(define-function goo_canvas_cairo_pattern_from_pixbuf
+ (c-name "goo_canvas_cairo_pattern_from_pixbuf")
+ (return-type "cairo_pattern_t*")
+ (parameters
+ '("GdkPixbuf*" "pixbuf")
+ )
+)
+
+(define-function goo_canvas_cairo_surface_from_pixbuf
+ (c-name "goo_canvas_cairo_surface_from_pixbuf")
+ (return-type "cairo_surface_t*")
+ (parameters
+ '("GdkPixbuf*" "pixbuf")
+ )
+)
+
+(define-function goo_canvas_boolean_handled_accumulator
+ (c-name "goo_canvas_boolean_handled_accumulator")
+ (return-type "gboolean")
+ (parameters
+ '("GSignalInvocationHint*" "ihint")
+ '("GValue*" "return_accu")
+ '("const-GValue*" "handler_return")
+ '("gpointer" "dummy")
+ )
+)
+
+
+
;; From goocanvasrect.h
(define-function goo_canvas_rect_get_type
@@ -1847,6 +1926,16 @@
(varargs #t)
)
+(define-method get_natural_extents
+ (of-object "GooCanvasText")
+ (c-name "goo_canvas_text_get_natural_extents")
+ (return-type "none")
+ (parameters
+ '("PangoRectangle*" "ink_rect")
+ '("PangoRectangle*" "logical_rect")
+ )
+)
+
(define-function goo_canvas_text_model_get_type
(c-name "goo_canvas_text_model_get_type")
(return-type "GType")
@@ -2005,3 +2094,11 @@
)
+
+;; From stamp-goocanvasenumtypes.h
+
+
+
+;; From stamp-goocanvasmarshal.h
+
+
Modified: goocanvasmm/trunk/goocanvas/src/libgoocanvas_vfuncs.defs
==============================================================================
--- goocanvasmm/trunk/goocanvas/src/libgoocanvas_vfuncs.defs (original)
+++ goocanvasmm/trunk/goocanvas/src/libgoocanvas_vfuncs.defs Mon Mar 17 13:56:12 2008
@@ -1,4 +1,14 @@
+; GooCanvas
+
+(define-vfunc create_item
+ (of-object "GooCanvas")
+ (parameters
+ '("GooCanvasItemModel*" "model")
+ )
+ (return-type "GooCanvasItem*")
+)
+
; GooCanvasModel
(define-vfunc get_root_item
@@ -61,13 +71,30 @@
(define-vfunc remove_child
(of-object "GooCanvasItem")
(parameters
- '("GooCanvasItem*" "item")
'("gint" "position")
)
(return-type "void")
)
-; TODO: get_child_property, set_child_property()
+(define-vfunc get_child_property
+ (of-object "GooCanvasItem")
+ (parameters
+ '("GooCanvasItem*" "child")
+ '("guint" "property_id")
+ '("GValue*" "value")
+ '("GParamSpec*" "pspec")
+ )
+)
+
+(define-vfunc set_child_property
+ (of-object "GooCanvasItem")
+ (parameters
+ '("GooCanvasItem*" "child")
+ '("guint" "property_id")
+ '("const-GValue*" "value")
+ '("GParamSpec*" "pspec")
+ )
+)
(define-vfunc get_transform_for_child
@@ -125,13 +152,40 @@
)
(define-vfunc set_transform
- (of-object "GooCanavsItem")
+ (of-object "GooCanvasItem")
(return-type "void")
(parameters
'("const-cairo_matrix_t*" "matrix")
)
)
+(define-vfunc get_style
+ (of-object "GooCanvasItem")
+ (return-type "GooCanvasStyle*")
+)
+
+(define-vfunc set_style
+ (of-object "GooCanvasItem")
+ (return-type "void")
+ (parameters
+ '("GooCanvasStyle*" "style")
+ )
+)
+
+(define-vfunc is_visible
+ (of-object "GooCanvasItem")
+ (return-type "gboolean")
+)
+
+(define-vfunc get_requested_height
+ (of-object "GooCanvasItem")
+ (return-type "gdouble")
+ (parameters
+ '("cairo_t*" "cr")
+ '("gdouble" "width")
+ )
+)
+
(define-vfunc create_view
(of-object "GooCanvasItem")
(return-type "GooCanvasItem*")
@@ -141,9 +195,6 @@
)
)
-;GooCanvasItem
-
-
(define-vfunc get_canvas_view
(of-object "GooCanvasItem")
(return-type "GooCanvasView*")
@@ -236,6 +287,133 @@
)
)
+(define-vfunc get_model
+ (of-object "GooCanvasItem")
+ (return-type "GooCanvasItemModel*")
+)
+
+(define-vfunc set_model
+ (of-object "GooCanvasItem")
+ (return-type "void")
+ (parameters
+ '("GooCanvasItemModel*" "model")
+ )
+)
+
+; GooCanvasItemModel
+
+(define-vfunc get_n_children
+ (of-object "GooCanvasItemModel")
+ (return-type "gint")
+)
+
+(define-vfunc get_child
+ (of-object "GooCanvasItemModel")
+ (return-type "GooCanvasItemModel*")
+ (parameters
+ '("gint" "child_num")
+ )
+)
+
+(define-vfunc add_child
+ (of-object "GooCanvasItemModel")
+ (return-type "void")
+ (parameters
+ '("GooCanvasItemModel*" "model")
+ '("gint" "position")
+
+ )
+)
+
+(define-vfunc move_child
+ (of-object "GooCanvasItemModel")
+ (return-type "void")
+ (parameters
+ '("gint" "old_position")
+ '("gint" "new_position")
+ )
+)
+
+(define-vfunc remove_child
+ (of-object "GooCanvasItemModel")
+ (return-type "void")
+ (parameters
+ '("gint" "child_num")
+ )
+)
+
+(define-vfunc get_child_property
+ (of-object "GooCanvasItemModel")
+ (return-type "void")
+ (parameters
+ '("GooCanvasItemModel*" "child")
+ '("guint" "property_id")
+ '("GValue*" "value")
+ '("GParamSpec*" "pspec")
+ )
+)
+
+(define-vfunc set_child_property
+ (of-object "GooCanvasItemModel")
+ (return-type "void")
+ (parameters
+ '("GooCanvasItemModel*" "child")
+ '("guint" "property_id")
+ '("const-GValue*" "value")
+ '("GParamSpec*" "pspec")
+ )
+)
+
+(define-vfunc get_parent
+ (of-object "GooCanvasItemModel")
+ (return-type "GooCanvasItemModel*")
+)
+
+(define-vfunc set_parent
+ (of-object "GooCanvasItemModel")
+ (return-type "void")
+ (parameters
+ '("GooCanvasItemModel*" "parent")
+ )
+)
+
+(define-vfunc create_item
+ (of-object "GooCanvasItemModel")
+ (return-type "GooCanvasItem*")
+ (parameters
+ '("GooCanvas*" "canvas")
+ )
+)
+
+(define-vfunc get_transform
+ (of-object "GooCanvasItemModel")
+ (return-type "gboolean")
+ (parameters
+ '("cairo_matrix_t*" "transform")
+ )
+)
+
+(define-vfunc set_transform
+ (of-object "GooCanvasItemModel")
+ (return-type "void")
+ (parameters
+ '("const-cairo_matrix_t*" "transform")
+ )
+)
+
+(define-vfunc get_style
+ (of-object "GooCanvasItemModel")
+ (return-type "GooCanvasStyle*")
+)
+
+(define-vfunc set_style
+ (of-object "GooCanvasItemModel")
+ (return-type "void")
+ (parameters
+ '("GooCanvasStyle*" "style")
+ )
+)
+
; GooCanvasItemSimple
(define-vfunc simple_create_path
@@ -273,7 +451,3 @@
'("gboolean" "is_pointer_event")
)
)
-
-
-; //TODO: And the rest. murrayc
-
Modified: goocanvasmm/trunk/goocanvas/src/style.ccg
==============================================================================
--- goocanvasmm/trunk/goocanvas/src/style.ccg (original)
+++ goocanvasmm/trunk/goocanvas/src/style.ccg Mon Mar 17 13:56:12 2008
@@ -22,8 +22,5 @@
namespace Goocanvas
{
-
}
-
-
Modified: goocanvasmm/trunk/goocanvas/src/style.hg
==============================================================================
--- goocanvasmm/trunk/goocanvas/src/style.hg (original)
+++ goocanvasmm/trunk/goocanvas/src/style.hg Mon Mar 17 13:56:12 2008
@@ -17,7 +17,10 @@
*/
#include <glibmm/object.h>
-#include <cairo.h> //TODO: Replace this with appropriate cairomm/*.h includes.
+#include <cairomm/context.h>
+#include <cairomm/refptr.h>
+
+#include <goocanvasstyle.h>
_DEFS(goocanvasmm,libgoocanvas)
_PINCLUDE(glibmm/private/object_p.h)
@@ -35,9 +38,36 @@
_WRAP_CREATE()
_IGNORE(goo_canvas_style_new)
+ template<typename PropertyType>
+ void get_property(GQuark property_id, PropertyType& value) const;
+ _IGNORE(goo_canvas_style_get_property)
+
+ template<typename PropertyType>
+ void set_property(GQuark property_id, const PropertyType& value);
+ _IGNORE(goo_canvas_style_set_property)
+
+ _WRAP_METHOD(Glib::RefPtr<Style> copy() const, goo_canvas_style_copy)
+ _WRAP_METHOD(Glib::RefPtr<Style> get_parent() const, goo_canvas_style_get_parent, refreturn)
+ _WRAP_METHOD(void set_parent(const Glib::RefPtr<Style>& style), goo_canvas_style_set_parent)
+ _WRAP_METHOD(bool set_stroke_options(const Cairo::RefPtr<Cairo::Context>& context), goo_canvas_style_set_stroke_options)
+ _WRAP_METHOD(bool set_fill_options(const Cairo::RefPtr<Cairo::Context>& context), goo_canvas_style_set_fill_options)
};
+template<typename PropertyType> inline
+void Style::get_property(GQuark property_id, PropertyType& value) const
+{
+ Glib::Value<PropertyType> property_value(goo_canvas_style_get_property(const_cast<GooCanvasStyle*>(gobj()), property_id));
+ value = property_value.get();
+}
+template<typename PropertyType> inline
+void Style::set_property(GQuark property_id, const PropertyType& value)
+{
+ Glib::Value<PropertyType> property_value;
+ property_value.init(Glib::Value<PropertyType>::value_type());
+ property_value.set(value);
+ goo_canvas_style_set_property(gobj(), property_id, property_value.gobj());
+}
}
Modified: goocanvasmm/trunk/goocanvas/src/table.ccg
==============================================================================
--- goocanvasmm/trunk/goocanvas/src/table.ccg (original)
+++ goocanvasmm/trunk/goocanvas/src/table.ccg Mon Mar 17 13:56:12 2008
@@ -23,10 +23,45 @@
namespace Goocanvas
{
-Table::Table()
-:
- _CONSTRUCT()
+void Table::attach(const Glib::RefPtr<Item>& item, guint left_attach, guint right_attach, guint top_attach, guint bottom_attach, Gtk::AttachOptions xoptions, Gtk::AttachOptions yoptions, gdouble left_padding, gdouble right_padding, gdouble top_padding, gdouble bottom_padding)
{
+ const gboolean x_expand = (xoptions & Gtk::EXPAND) != 0;
+ const gboolean x_fill = (xoptions & Gtk::FILL) != 0;
+ const gboolean x_shrink = (xoptions & Gtk::SHRINK) != 0;
+ const gboolean y_expand = (yoptions & Gtk::EXPAND) != 0;
+ const gboolean y_fill = (yoptions & Gtk::FILL) != 0;
+ const gboolean y_shrink = (yoptions & Gtk::SHRINK) != 0;
+
+ add_child(item);
+ goo_canvas_item_set_child_properties(GOO_CANVAS_ITEM(gobj()), item->gobj(),
+ "column", left_attach,
+ "columns", right_attach - left_attach,
+ "row", top_attach,
+ "rows", bottom_attach - top_attach,
+ "x-fill", x_fill,
+ "x-expand", x_expand,
+ "x-shrink", x_shrink,
+ "y-fill", y_fill,
+ "y-expand", y_expand,
+ "y-shrink", y_shrink,
+ "left-padding", left_padding,
+ "right-padding", right_padding,
+ "top-padding", top_padding,
+ "bottom-padding", bottom_padding,
+ static_cast<void*>(0));
+}
+
+void Table::set_align(const Glib::RefPtr<Item>& child, double xalign, double yalign)
+{
+ goo_canvas_item_set_child_properties(GOO_CANVAS_ITEM(gobj()), child->gobj(),
+ "xalign", xalign,
+ "yalign", yalign,
+ static_cast<void*>(0));
+}
+
+void Table::set_align(const Glib::RefPtr<Item>& child, Gtk::AlignmentEnum xalign, Gtk::AlignmentEnum yalign)
+{
+ set_align(child, _gtkmm_align_float_from_enum(xalign), _gtkmm_align_float_from_enum(yalign));
}
} //namspace Goocanvas
Modified: goocanvasmm/trunk/goocanvas/src/table.hg
==============================================================================
--- goocanvasmm/trunk/goocanvas/src/table.hg (original)
+++ goocanvasmm/trunk/goocanvas/src/table.hg Mon Mar 17 13:56:12 2008
@@ -17,6 +17,7 @@
#include <goocanvasmm/group.h>
+#include <gtkmm/enums.h>
_DEFS(goocanvasmm,libgoocanvas)
@@ -27,13 +28,20 @@
{
_CLASS_GOBJECT(Table, GooCanvasTable, GOO_CANVAS_TABLE, Goocanvas::Group, GooCanvasGroup)
protected:
- explicit Table();
- _IGNORE(goo_table_new)
+ _CTOR_DEFAULT()
+ _IGNORE(goo_canvas_table_new)
public:
_WRAP_CREATE()
+ void attach(const Glib::RefPtr<Item>& item, guint left_attach, guint right_attach, guint top_attach, guint bottom_attach, Gtk::AttachOptions xoptions = Gtk::FILL | Gtk::EXPAND, Gtk::AttachOptions yoptions = Gtk::FILL | Gtk::EXPAND, gdouble left_padding = 0.0, gdouble right_padding = 0.0, gdouble top_padding = 0.0, gdouble bottom_padding = 0.0);
+
+ // TODO: We should get rid of this overload with the next gtkmm API/ABI break.
+ // See http://bugzilla.gnome.org/show_bug.cgi?id=142849.
+ void set_align(const Glib::RefPtr<Item>& child, double xalign = 0.0, double yalign = 0.0);
+ void set_align(const Glib::RefPtr<Item>& child, Gtk::AlignmentEnum xalign = Gtk::ALIGN_LEFT, Gtk::AlignmentEnum yalign = Gtk::ALIGN_TOP);
+
_WRAP_PROPERTY("width", double)
_WRAP_PROPERTY("height", double)
_WRAP_PROPERTY("row-spacing", double)
Added: goocanvasmm/trunk/goocanvas/src/tablemodel.ccg
==============================================================================
--- (empty file)
+++ goocanvasmm/trunk/goocanvas/src/tablemodel.ccg Mon Mar 17 13:56:12 2008
@@ -0,0 +1,68 @@
+/* Copyright (C) 1998-2006 The gtkmm 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 <goocanvastable.h>
+
+_PINCLUDE(goocanvasmm/private/groupmodel_p.h)
+
+namespace Goocanvas
+{
+
+void TableModel::attach(const Glib::RefPtr<ItemModel>& item, guint left_attach, guint right_attach, guint top_attach, guint bottom_attach, Gtk::AttachOptions xoptions, Gtk::AttachOptions yoptions, gdouble left_padding, gdouble right_padding, gdouble top_padding, gdouble bottom_padding)
+{
+ const gboolean x_expand = (xoptions & Gtk::EXPAND) != 0;
+ const gboolean x_fill = (xoptions & Gtk::FILL) != 0;
+ const gboolean x_shrink = (xoptions & Gtk::SHRINK) != 0;
+ const gboolean y_expand = (yoptions & Gtk::EXPAND) != 0;
+ const gboolean y_fill = (yoptions & Gtk::FILL) != 0;
+ const gboolean y_shrink = (yoptions & Gtk::SHRINK) != 0;
+
+ add_child(item);
+ goo_canvas_item_model_set_child_properties(GOO_CANVAS_ITEM_MODEL(gobj()), item->gobj(),
+ "column", left_attach,
+ "columns", right_attach - left_attach,
+ "row", top_attach,
+ "rows", bottom_attach - top_attach,
+ "x-fill", x_fill,
+ "x-expand", x_expand,
+ "x-shrink", x_shrink,
+ "y-fill", y_fill,
+ "y-expand", y_expand,
+ "y-shrink", y_shrink,
+ "left-padding", left_padding,
+ "right-padding", right_padding,
+ "top-padding", top_padding,
+ "bottom-padding", bottom_padding,
+ static_cast<void*>(0));
+}
+
+void TableModel::set_align(const Glib::RefPtr<ItemModel>& child, double xalign, double yalign)
+{
+ goo_canvas_item_model_set_child_properties(GOO_CANVAS_ITEM_MODEL(gobj()), child->gobj(),
+ "xalign", xalign,
+ "yalign", yalign,
+ static_cast<void*>(0));
+}
+
+void TableModel::set_align(const Glib::RefPtr<ItemModel>& child, Gtk::AlignmentEnum xalign, Gtk::AlignmentEnum yalign)
+{
+ set_align(child, _gtkmm_align_float_from_enum(xalign), _gtkmm_align_float_from_enum(yalign));
+}
+
+} //namspace Goocanvas
+
Added: goocanvasmm/trunk/goocanvas/src/tablemodel.hg
==============================================================================
--- (empty file)
+++ goocanvasmm/trunk/goocanvas/src/tablemodel.hg Mon Mar 17 13:56:12 2008
@@ -0,0 +1,52 @@
+/* Copyright (C) 1998-2006 The gtkmm 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 <goocanvasmm/groupmodel.h>
+#include <gtkmm/enums.h>
+
+_DEFS(goocanvasmm,libgoocanvas)
+
+namespace Goocanvas
+{
+
+class TableModel : public Goocanvas::GroupModel
+{
+ _CLASS_GOBJECT(TableModel, GooCanvasTableModel, GOO_CANVAS_TABLE_MODEL, Goocanvas::GroupModel, GooCanvasGroupModel)
+protected:
+ _CTOR_DEFAULT()
+ _IGNORE(goo_canvas_table_model_new)
+
+public:
+
+ _WRAP_CREATE()
+
+ void attach(const Glib::RefPtr<ItemModel>& item, guint left_attach, guint right_attach, guint top_attach, guint bottom_attach, Gtk::AttachOptions xoptions = Gtk::FILL | Gtk::EXPAND, Gtk::AttachOptions yoptions = Gtk::FILL | Gtk::EXPAND, gdouble left_padding = 0.0, gdouble right_padding = 0.0, gdouble top_padding = 0.0, gdouble bottom_padding = 0.0);
+
+ void set_align(const Glib::RefPtr<ItemModel>& child, double xalign = 0.0, double yalign = 0.0);
+ void set_align(const Glib::RefPtr<ItemModel>& child, Gtk::AlignmentEnum xalign = Gtk::ALIGN_LEFT, Gtk::AlignmentEnum yalign = Gtk::ALIGN_TOP);
+
+ _WRAP_PROPERTY("width", double)
+ _WRAP_PROPERTY("height", double)
+ _WRAP_PROPERTY("row-spacing", double)
+ _WRAP_PROPERTY("column-spacing", double)
+ _WRAP_PROPERTY("homogeneous-rows", bool)
+ _WRAP_PROPERTY("homogeneous-columns", bool)
+};
+
+} //namespace Goocanvas
+
Modified: goocanvasmm/trunk/goocanvas/src/text.hg
==============================================================================
--- goocanvasmm/trunk/goocanvas/src/text.hg (original)
+++ goocanvasmm/trunk/goocanvas/src/text.hg Mon Mar 17 13:56:12 2008
@@ -37,6 +37,9 @@
_WRAP_CREATE(const Glib::ustring& text = Glib::ustring(), double x = 0.0, double y = 0.0, double width = 0.0, Gtk::AnchorType anchor = Gtk::ANCHOR_NORTH_WEST);
+#m4 _CONVERSION(`Pango::Rectangle&',`PangoRectangle*',`($3).gobj()')
+ _WRAP_METHOD(void get_natural_extents(Pango::Rectangle& ink_rect, Pango::Rectangle& logical_rect) const, goo_canvas_text_get_natural_extents)
+
_WRAP_PROPERTY("alignment", Pango::Alignment)
_WRAP_PROPERTY("anchor", Gtk::AnchorType)
_WRAP_PROPERTY("ellipsize",Pango::EllipsizeMode)
Modified: goocanvasmm/trunk/goocanvas/src/widget.hg
==============================================================================
--- goocanvasmm/trunk/goocanvas/src/widget.hg (original)
+++ goocanvasmm/trunk/goocanvas/src/widget.hg Mon Mar 17 13:56:12 2008
@@ -37,7 +37,13 @@
public:
_WRAP_CREATE(Gtk::Widget& widget, double x = 0.0, double y = 0.0, double width = 0.0, double height = 0.0)
-
+
+ _WRAP_PROPERTY("widget", Gtk::Widget*)
+ _WRAP_PROPERTY("x", double)
+ _WRAP_PROPERTY("y", double)
+ _WRAP_PROPERTY("width", double)
+ _WRAP_PROPERTY("height", double)
+ _WRAP_PROPERTY("anchor", Gtk::AnchorType)
};
}
Modified: goocanvasmm/trunk/tools/m4/convert_libgoocanvasmm.m4
==============================================================================
--- goocanvasmm/trunk/tools/m4/convert_libgoocanvasmm.m4 (original)
+++ goocanvasmm/trunk/tools/m4/convert_libgoocanvasmm.m4 Mon Mar 17 13:56:12 2008
@@ -37,8 +37,9 @@
_CONVERSION(`const Cairo::RefPtr<Cairo::Context>&',`cairo_t*',`($3)->cobj()')
_CONVERSION(`cairo_t*',`Cairo::RefPtr<Cairo::Context>',`Cairo::RefPtr<Cairo::Context>(new Cairo::Context($3))')
-_CONVERSION(`cairo_matrix_t*',`Cairo::Matrix*',`((Cairo::Matrix*))($3))')
+_CONVERSION(`cairo_matrix_t*',`Cairo::Matrix*',`((Cairo::Matrix*)($3))')
_CONVERSION(`Cairo::Matrix*',`cairo_matrix_t*',`((cairo_matrix_t*)($3))')
+_CONVERSION(`const cairo_matrix_t*',`const Cairo::Matrix*',`((const Cairo::Matrix*)($3))')
_CONVERSION(`const Cairo::Matrix*',`const cairo_matrix_t*',`((const cairo_matrix_t*)($3))')
# GooCairoPattern* is actually a cairo_pattern_t*:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]