gnomemm r1571 - in cluttermm/trunk: . clutter/src tools/m4
- From: arminb svn gnome org
- To: svn-commits-list gnome org
- Subject: gnomemm r1571 - in cluttermm/trunk: . clutter/src tools/m4
- Date: Sat, 21 Jun 2008 12:55:15 +0000 (UTC)
Author: arminb
Date: Sat Jun 21 12:55:15 2008
New Revision: 1571
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1571&view=rev
Log:
2008-06-21 Armin Burgmeier <armin openismus com>
* clutter/src/clutter_methods.defs: Removed private definitions from
clutter-script-private.h.
* clutter/src/types.hg:
* clutter/src/types.ccg:
* tools/m4/convert_cluttermm.m4: Wrapped ClutterKnot, adapted
conversions.
* clutter/src/behaviour-bspline.hg:
* clutter/src/behaviour-depth.hg:
* clutter/src/behaviour-ellipse.hg:
* clutter/src/behaviour-path.hg:
* clutter/src/behaviour-scale.hg:
* clutter/src/behaviour-rotate.hg:
* clutter/src/behaviour-opacity.hg:
* clutter/src/behaviour-bspline.ccg:
* clutter/src/behaviour-path.ccg: Wrapped missing methods and
properties.
* clutter/src/clutter_vfuncs.defs: Fix signature for
ClutterScriptable's set_custom_property vfunc (GValue* vs. const
GValue*).
* clutter/src/scriptable.hg: Wrapped missing methods and the
set_custom_property vfunc.
* clutter/src/script.hg:
* clutter/src/script.ccg: Wrapped the load_from_data method and the
get_type_from_name vfunc in which we try to instantiate
gtkmm-overriden objects, as libglademm does.
Modified:
cluttermm/trunk/ChangeLog
cluttermm/trunk/clutter/src/behaviour-bspline.ccg
cluttermm/trunk/clutter/src/behaviour-bspline.hg
cluttermm/trunk/clutter/src/behaviour-depth.hg
cluttermm/trunk/clutter/src/behaviour-ellipse.hg
cluttermm/trunk/clutter/src/behaviour-opacity.hg
cluttermm/trunk/clutter/src/behaviour-path.ccg
cluttermm/trunk/clutter/src/behaviour-path.hg
cluttermm/trunk/clutter/src/behaviour-rotate.hg
cluttermm/trunk/clutter/src/behaviour-scale.hg
cluttermm/trunk/clutter/src/clutter_methods.defs
cluttermm/trunk/clutter/src/clutter_vfuncs.defs
cluttermm/trunk/clutter/src/script.ccg
cluttermm/trunk/clutter/src/script.hg
cluttermm/trunk/clutter/src/scriptable.hg
cluttermm/trunk/clutter/src/types.ccg
cluttermm/trunk/clutter/src/types.hg
cluttermm/trunk/tools/m4/convert_cluttermm.m4
Modified: cluttermm/trunk/clutter/src/behaviour-bspline.ccg
==============================================================================
--- cluttermm/trunk/clutter/src/behaviour-bspline.ccg (original)
+++ cluttermm/trunk/clutter/src/behaviour-bspline.ccg Sat Jun 21 12:55:15 2008
@@ -19,12 +19,23 @@
namespace Clutter
{
- ClutterKnot BehaviourBspline::get_origin() const
- {
- ClutterKnot knot;
- clutter_behaviour_bspline_get_origin(const_cast<ClutterBehaviourBspline*>(gobj()), &knot);
- return knot;
- }
+
+BehaviourBspline::BehaviourBspline(const Glib::RefPtr<Alpha>& alpha, const Glib::ArrayHandle<Knot>& knots)
+:
+ _CONSTRUCT("alpha", Glib::unwrap(alpha))
+{
+ for(Glib::ArrayHandle<Knot>::const_iterator iter = knots.begin(); iter != knots.end(); ++ iter)
+ {
+ append_knot(*iter);
+ }
+}
+
+Knot BehaviourBspline::get_origin() const
+{
+ Knot knot;
+ clutter_behaviour_bspline_get_origin(const_cast<ClutterBehaviourBspline*>(gobj()), knot.gobj());
+ return knot;
+}
} //namespace Clutter
Modified: cluttermm/trunk/clutter/src/behaviour-bspline.hg
==============================================================================
--- cluttermm/trunk/clutter/src/behaviour-bspline.hg (original)
+++ cluttermm/trunk/clutter/src/behaviour-bspline.hg Sat Jun 21 12:55:15 2008
@@ -35,12 +35,14 @@
_IMPLEMENTS_INTERFACE(Scriptable)
protected:
- // TODO: pass the knots as a C++ container
- _WRAP_CTOR(BehaviourBspline(const Glib::RefPtr<Alpha>& alpha, const ClutterKnot* knots, guint n_knots), clutter_behaviour_bspline_new)
+ BehaviourBspline(const Glib::RefPtr<Alpha>& alpha, const Glib::ArrayHandle<Knot>& knots);
+ _IGNORE(clutter_behaviour_bspline_new)
+
+ // We don't wrap the vararg functions:
+ _IGNORE(clutter_behaviour_bspline_append_knots)
public:
- // TODO: pass the knots as a C++ container
- _WRAP_CREATE(const Glib::RefPtr<Alpha>& alpha, const ClutterKnot* knots, guint n_knots)
+ _WRAP_CREATE(const Glib::RefPtr<Alpha>& alpha, const Glib::ArrayHandle<Knot>& knots)
_WRAP_METHOD(void append_knot(const Knot& knot), clutter_behaviour_bspline_append_knot)
_WRAP_METHOD(void truncate(guint offset), clutter_behaviour_bspline_truncate)
@@ -59,4 +61,3 @@
};
} // namespace Clutter
-// vim:ts=2,sw=2
Modified: cluttermm/trunk/clutter/src/behaviour-depth.hg
==============================================================================
--- cluttermm/trunk/clutter/src/behaviour-depth.hg (original)
+++ cluttermm/trunk/clutter/src/behaviour-depth.hg Sat Jun 21 12:55:15 2008
@@ -35,10 +35,12 @@
public:
_WRAP_CREATE(const Glib::RefPtr<Alpha>& alpha, int start_depth, int end_depth)
+ _WRAP_METHOD(void set_bounds(int depth_start, int depth_end), clutter_behaviour_depth_set_bounds)
+ _WRAP_METHOD(void get_bounds(int& depth_start, int& depth_end), clutter_behaviour_depth_get_bounds)
+
_WRAP_PROPERTY("depth-end", int)
_WRAP_PROPERTY("depth-start", int)
};
} // namespace Clutter
-// vim:ts=2,sw=2
Modified: cluttermm/trunk/clutter/src/behaviour-ellipse.hg
==============================================================================
--- cluttermm/trunk/clutter/src/behaviour-ellipse.hg (original)
+++ cluttermm/trunk/clutter/src/behaviour-ellipse.hg Sat Jun 21 12:55:15 2008
@@ -69,12 +69,11 @@
_WRAP_METHOD(void set_direction(RotateDirection direction), clutter_behaviour_ellipse_set_direction)
_WRAP_METHOD(RotateDirection get_direction() const, clutter_behaviour_ellipse_get_direction)
- _WRAP_SIGNAL(void knot_reached(const Knot& knot), "knot_reached")
-
_WRAP_PROPERTY("angle-end", double)
_WRAP_PROPERTY("angle-start", double)
_WRAP_PROPERTY("angle-tilt-x", double)
_WRAP_PROPERTY("angle-tilt-y", double)
+ _WRAP_PROPERTY("angle-tilt-z", double)
_WRAP_PROPERTY("center", Knot)
_WRAP_PROPERTY("direction", RotateDirection)
_WRAP_PROPERTY("height", int)
@@ -82,4 +81,3 @@
};
} // namespace Clutter
-// vim:ts=2,sw=2
Modified: cluttermm/trunk/clutter/src/behaviour-opacity.hg
==============================================================================
--- cluttermm/trunk/clutter/src/behaviour-opacity.hg (original)
+++ cluttermm/trunk/clutter/src/behaviour-opacity.hg Sat Jun 21 12:55:15 2008
@@ -44,4 +44,3 @@
};
} // namespace Clutter
-// vim:ts=2,sw=2
Modified: cluttermm/trunk/clutter/src/behaviour-path.ccg
==============================================================================
--- cluttermm/trunk/clutter/src/behaviour-path.ccg (original)
+++ cluttermm/trunk/clutter/src/behaviour-path.ccg Sat Jun 21 12:55:15 2008
@@ -20,5 +20,20 @@
namespace Clutter
{
+BehaviourPath::BehaviourPath(const Glib::RefPtr<Alpha>& alpha, const Glib::ArrayHandle<Knot>& knots)
+:
+ _CONSTRUCT("alpha", Glib::unwrap(alpha))
+{
+ for(Glib::ArrayHandle<Knot>::const_iterator iter = knots.begin(); iter != knots.end(); ++ iter)
+ {
+ append_knot(*iter);
+ }
+}
+
+BehaviourPath::ListHandle_Knots BehaviourPath::get_knots() const
+{
+ return ListHandle_Knots(clutter_behaviour_path_get_knots(const_cast<ClutterBehaviourPath*>(gobj())), Glib::OWNERSHIP_SHALLOW);
+}
+
} //namespace Clutter
Modified: cluttermm/trunk/clutter/src/behaviour-path.hg
==============================================================================
--- cluttermm/trunk/clutter/src/behaviour-path.hg (original)
+++ cluttermm/trunk/clutter/src/behaviour-path.hg Sat Jun 21 12:55:15 2008
@@ -36,17 +36,41 @@
protected:
// TODO: pass the knots as a C++ container
- _WRAP_CTOR(BehaviourPath(const Glib::RefPtr<Alpha>& alpha, const ClutterKnot* knots, guint n_knots), clutter_behaviour_path_new)
+ BehaviourPath(const Glib::RefPtr<Alpha>& alpha, const Glib::ArrayHandle<Knot>& knots);
+ _IGNORE(clutter_behaviour_path_new)
+
+ // We don't wrap the vararg functions:
+ _IGNORE(clutter_behaviour_path_append_knots)
public:
// TODO: pass the knots as a C++ container
- _WRAP_CREATE(const Glib::RefPtr<Alpha>& alpha, const ClutterKnot* knots, guint n_knots)
+ _WRAP_CREATE(const Glib::RefPtr<Alpha>& alpha, const Glib::ArrayHandle<Knot>& knot);
_WRAP_METHOD(void append_knot(const Knot& knot), clutter_behaviour_path_append_knot)
_WRAP_METHOD(void insert_knot(guint offset, const Knot& knot), clutter_behaviour_path_insert_knot)
_WRAP_METHOD(void remove_knot(guint offset), clutter_behaviour_path_remove_knot)
_WRAP_METHOD(void clear(), clutter_behaviour_path_clear)
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+
+struct KnotTraits
+{
+ typedef Knot CppType;
+ typedef const ClutterKnot* CType;
+ typedef ClutterKnot* CTypeNonConst;
+
+ static CType to_c_type(const CppType& obj) { return obj.gobj(); }
+ static CType to_c_type(const CType& obj) { return obj; }
+ static CppType to_cpp_type(const CType& obj) { return Knot(obj); }
+ static void release_c_type(const CType& obj) { }
+};
+
+#endif // DOXYGEN_SHOULD_SKIP_THIS
+
+ typedef Glib::SListHandle<Knot, KnotTraits> ListHandle_Knots;
+ _WRAP_METHOD_DOCS_ONLY(clutter_behaviour_path_get_knots)
+ ListHandle_Knots get_knots() const;
+
_WRAP_SIGNAL(void knot_reached(const Knot& knot), "knot_reached")
_WRAP_PROPERTY("knot", Knot)
@@ -54,4 +78,3 @@
};
} // namespace Clutter
-// vim:ts=2,sw=2
Modified: cluttermm/trunk/clutter/src/behaviour-rotate.hg
==============================================================================
--- cluttermm/trunk/clutter/src/behaviour-rotate.hg (original)
+++ cluttermm/trunk/clutter/src/behaviour-rotate.hg Sat Jun 21 12:55:15 2008
@@ -63,4 +63,3 @@
};
} // namespace Clutter
-// vim:ts=2,sw=2
Modified: cluttermm/trunk/clutter/src/behaviour-scale.hg
==============================================================================
--- cluttermm/trunk/clutter/src/behaviour-scale.hg (original)
+++ cluttermm/trunk/clutter/src/behaviour-scale.hg Sat Jun 21 12:55:15 2008
@@ -31,21 +31,18 @@
_CLASS_GOBJECT(BehaviourScale, ClutterBehaviourScale, CLUTTER_BEHAVIOUR_SCALE, Behaviour, ClutterBehaviour)
protected:
- _WRAP_CTOR(BehaviourScale(const Glib::RefPtr<Alpha>& alpha, double x_scale_start, double x_scale_end, double y_scale_start, double y_scale_end, Gravity scale_gravity), clutter_behaviour_scale_new)
- _WRAP_CTOR(BehaviourScale(const Glib::RefPtr<Alpha>& alpha, Fixed x_scale_start, Fixed x_scale_end, Fixed y_scale_start, Fixed y_scale_end, Gravity scale_gravity), clutter_behaviour_scale_newx)
+ _WRAP_CTOR(BehaviourScale(const Glib::RefPtr<Alpha>& alpha, double x_scale_start, double x_scale_end, double y_scale_start, double y_scale_end), clutter_behaviour_scale_new)
+ _WRAP_CTOR(BehaviourScale(const Glib::RefPtr<Alpha>& alpha, Fixed x_scale_start, Fixed x_scale_end, Fixed y_scale_start, Fixed y_scale_end), clutter_behaviour_scale_newx)
public:
- _WRAP_CREATE(const Glib::RefPtr<Alpha>& alpha, double x_scale_start, double x_scale_end, double y_scale_start, double y_scale_end, Gravity gravity)
- _WRAP_CREATE(const Glib::RefPtr<Alpha>& alpha, Fixed x_scale_start, Fixed x_scale_end, Fixed y_scale_start, Fixed y_scale_end, Gravity gravity)
+ _WRAP_CREATE(const Glib::RefPtr<Alpha>& alpha, double x_scale_start, double x_scale_end, double y_scale_start, double y_scale_end)
+ _WRAP_CREATE(const Glib::RefPtr<Alpha>& alpha, Fixed x_scale_start, Fixed x_scale_end, Fixed y_scale_start, Fixed y_scale_end)
_WRAP_METHOD(void set_bounds(double x_scale_start, double y_scale_start, double x_scale_end, double y_scale_end), clutter_behaviour_scale_set_bounds)
_WRAP_METHOD(void get_bounds(double& x_scale_start, double& y_scale_start, double& x_scale_end, double& y_scale_end) const, clutter_behaviour_scale_get_bounds)
_WRAP_METHOD(void set_boundsx(Fixed x_scale_start, Fixed y_scale_start, Fixed x_scale_end, Fixed y_scale_end), clutter_behaviour_scale_set_boundsx)
_WRAP_METHOD(void get_boundsx(Fixed& x_scale_start, Fixed& y_scale_start, Fixed& x_scale_end, Fixed& y_scale_end) const, clutter_behaviour_scale_get_boundsx)
- _WRAP_METHOD(void set_gravity(Gravity gravity), clutter_behaviour_scale_set_gravity)
- _WRAP_METHOD(Gravity get_gravity() const, clutter_behaviour_scale_get_gravity)
- _WRAP_PROPERTY("scale-gravity", Gravity)
_WRAP_PROPERTY("x-scale-start", double)
_WRAP_PROPERTY("x-scale-end", double)
_WRAP_PROPERTY("y-scale-start", double)
@@ -54,4 +51,3 @@
};
} // namespace Clutter
-// vim:ts=2,sw=2
Modified: cluttermm/trunk/clutter/src/clutter_methods.defs
==============================================================================
--- cluttermm/trunk/clutter/src/clutter_methods.defs (original)
+++ cluttermm/trunk/clutter/src/clutter_methods.defs Sat Jun 21 12:55:15 2008
@@ -5155,113 +5155,6 @@
)
-
-;; From clutter-script-private.h
-
-(define-function object_info_free
- (c-name "object_info_free")
- (return-type "none")
- (parameters
- '("gpointer" "data")
- )
-)
-
-(define-function property_info_free
- (c-name "property_info_free")
- (return-type "none")
- (parameters
- '("gpointer" "data")
- )
-)
-
-(define-method parse_node
- (of-object "ClutterScript")
- (c-name "clutter_script_parse_node")
- (return-type "gboolean")
- (parameters
- '("GValue*" "value")
- '("const-gchar*" "name")
- '("JsonNode*" "node")
- '("GParamSpec*" "pspec")
- )
-)
-
-(define-function clutter_script_get_type_from_symbol
- (c-name "clutter_script_get_type_from_symbol")
- (return-type "GType")
- (parameters
- '("const-gchar*" "symbol")
- )
-)
-
-(define-function clutter_script_get_type_from_class
- (c-name "clutter_script_get_type_from_class")
- (return-type "GType")
- (parameters
- '("const-gchar*" "name")
- )
-)
-
-(define-method construct_object
- (of-object "ClutterScript")
- (c-name "clutter_script_construct_object")
- (return-type "GObject*")
- (parameters
- '("ObjectInfo*" "info")
- )
-)
-
-(define-function clutter_script_enum_from_string
- (c-name "clutter_script_enum_from_string")
- (return-type "gboolean")
- (parameters
- '("GType" "gtype")
- '("const-gchar*" "string")
- '("gint*" "enum_value")
- )
-)
-
-(define-function clutter_script_flags_from_string
- (c-name "clutter_script_flags_from_string")
- (return-type "gboolean")
- (parameters
- '("GType" "gtype")
- '("const-gchar*" "string")
- '("gint*" "flags_value")
- )
-)
-
-(define-method parse_knot
- (of-object "ClutterScript")
- (c-name "clutter_script_parse_knot")
- (return-type "gboolean")
- (parameters
- '("JsonNode*" "node")
- '("ClutterKnot*" "knot")
- )
-)
-
-(define-method parse_geometry
- (of-object "ClutterScript")
- (c-name "clutter_script_parse_geometry")
- (return-type "gboolean")
- (parameters
- '("JsonNode*" "node")
- '("ClutterGeometry*" "geometry")
- )
-)
-
-(define-method parse_alpha
- (of-object "ClutterScript")
- (c-name "clutter_script_parse_alpha")
- (return-type "GObject*")
- (parameters
- '("JsonNode*" "node")
- )
-)
-
-
-
;; From clutter-shader.h
(define-function clutter_shader_error_quark
Modified: cluttermm/trunk/clutter/src/clutter_vfuncs.defs
==============================================================================
--- cluttermm/trunk/clutter/src/clutter_vfuncs.defs (original)
+++ cluttermm/trunk/clutter/src/clutter_vfuncs.defs Sat Jun 21 12:55:15 2008
@@ -180,7 +180,7 @@
(parameters
'("ClutterScript*" "script")
'("const-gchar*" "name")
- '("GValue*" "value")
+ '("const-GValue*" "value")
)
)
Modified: cluttermm/trunk/clutter/src/script.ccg
==============================================================================
--- cluttermm/trunk/clutter/src/script.ccg (original)
+++ cluttermm/trunk/clutter/src/script.ccg Sat Jun 21 12:55:15 2008
@@ -19,5 +19,79 @@
namespace Clutter
{
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+guint Script::load_from_data(const Glib::ustring& data)
+#else
+guint Script::load_from_data(const Glib::ustring& data, std::auto_ptr<Glib::Error>& error)
+#endif
+{
+ GError* gerror = 0;
+ guint result = clutter_script_load_from_data(gobj(), data.c_str(), data.bytes(), &gerror);
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+ if(gerror)
+ ::Glib::Error::throw_exception(gerror);
+#else
+ if(gerror)
+ error = ::Glib::Error::throw_exception(gerror);
+#endif // GLIBMM_EXCEPTIONS_ENABLED
+
+ return result;
+}
+
+#ifdef GLIBMM_VFUNGS_ENABLED
+// Custom coded so that we can custom-code the vfunc in the ClutterScript class.
+// This is marginally better than modifying gtkmmproc to allow this.
+GType Script_Class::get_type_from_name_vfunc_callback(ClutterScript* slef, const char* type_name)
+{
+ CppObjectType *const obj = dynamic_cast<CppObjectType*>(
+ Glib::ObjectBase::_get_current_wrapper((GObject*) self));
+
+ if(obj)
+ {
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
+ try
+ {
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
+ return obj->get_type_from_name_vfunc(Glib::convert_const_gchar_ptr_to_ustring(type_name));
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
+ }
+ catch(...)
+ {
+ Glib::exception_handlers_invoke();
+ }
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
+ }
+ else
+ {
+ BaseClassType *const base = static_cast<BaseClassType*>(
+ g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class.
+ );
+
+ if(base && base->lookup_type)
+ return (*base->lookup_type)(self, type_name);
+ }
+
+ return 0;
+}
+#endif
+
+GType Script::get_type_from_name_vfunc(const Glib::ustring& type_name)
+{
+ // See if there is a gtkmm version of the gclass:
+ Glib::ustring classname_prefixed ("gtkmm__"); // gtkmm uses a prefix
+ classname_prefixed += type_name;
+
+ GType gtype = g_type_from_name(classname_prefixed.c_str());
+
+ if(gtype == G_TYPE_INVALID) // if it's not a registered typename
+ {
+ // There's no gtkmm derived type, so just use the normal one.
+ gtype = g_type_from_name(type_name.c_str());
+ }
+
+ return gtype;
+}
+
} //namespace Clutter
Modified: cluttermm/trunk/clutter/src/script.hg
==============================================================================
--- cluttermm/trunk/clutter/src/script.hg (original)
+++ cluttermm/trunk/clutter/src/script.hg Sat Jun 21 12:55:15 2008
@@ -36,7 +36,16 @@
public:
_WRAP_CREATE()
- //_WRAP_METHOD(guint load_from_data(const std::string& data), clutter_script_load_from_data, errthrow)
+ // We don't support signal autoconnection in C++:
+ _IGNORE(clutter_script_connect_signals, clutter_script_connect_signals_full,
+ clutter_script_get_type_from_name)
+
+ _WRAP_METHOD_DOCS_ONLY(clutter_script_load_from_data)
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+ guint load_from_data(const Glib::ustring& data);
+#else
+ guint load_from_data(const Glib::ustring& data, std::auto_ptr<Glib::Error>& error);
+#endif
_WRAP_METHOD(guint load_from_file(const std::string& filename), clutter_script_load_from_file, errthrow)
_WRAP_METHOD(Glib::RefPtr<Glib::Object> get_object(const Glib::ustring& name), clutter_script_get_object, refreturn)
@@ -57,7 +66,21 @@
_WRAP_PROPERTY("filename", std::string)
_WRAP_PROPERTY("filename-set", bool)
+
+protected:
+#m4begin
+dnl Custom-coded vfunc:
+dnl
+ _PUSH(SECTION_PCC_CLASS_INIT_VFUNCS)
+ klass->get_type_from_name = &get_type_from_name_vfunc_callback;
+ _SECTION(SECTION_PH_VFUNCS)
+ static GType get_type_from_name_vfunc_callback(ClutterScript* script, const char* type_name);
+ _POP()
+#m4end
+
+ // TODO: Make sure this is actually invoked even with disabled vfuncs so
+ // that ClutterScript creates gtkmm's GObjects.
+ virtual GType get_type_from_name_vfunc(const Glib::ustring& type_name);
};
} // namespace Clutter
-// vim:ts=2,sw=2
Modified: cluttermm/trunk/clutter/src/scriptable.hg
==============================================================================
--- cluttermm/trunk/clutter/src/scriptable.hg (original)
+++ cluttermm/trunk/clutter/src/scriptable.hg Sat Jun 21 12:55:15 2008
@@ -17,6 +17,7 @@
#include <glibmm/interface.h>
#include <glibmm/ustring.h>
+#include <cluttermm/script.h>
#include <clutter/clutter-scriptable.h>
_DEFS(cluttermm,clutter)
@@ -34,17 +35,29 @@
_WRAP_METHOD(void set_id(const std::string& id), clutter_scriptable_set_id)
_WRAP_METHOD(std::string get_id() const, clutter_scriptable_get_id)
- _WRAP_SIGNAL(void actor_added(const Glib::RefPtr<Actor>& actor), "actor_added")
- _WRAP_SIGNAL(void actor_removed(const Glib::RefPtr<Actor>& actor), "actor_removed")
- // TODO: parse_custom_node, set_custom_property
+ // TODO: Wrap glib-json?
+#m4 _CONVERSION(`const Glib::RefPtr<Script>&', `ClutterScript*', `Glib::unwrap($3)')
+ _WRAP_METHOD(bool parse_custom_node(const Glib::RefPtr<Script>& script, Glib::ValueBase& value, const Glib::ustring& name, JsonNode* node), clutter_scriptable_parse_custom_node)
+ _WRAP_METHOD(void set_custom_property(const Glib::RefPtr<Script>& script, const Glib::ustring& name, const Glib::ValueBase& value), clutter_scriptable_set_custom_property)
protected:
_WRAP_VFUNC(void set_id(const std::string& id), set_id)
-#m4 _CONVERSION(`std::string', `const gchar*', `($3).c_str()')
- _WRAP_VFUNC(std::string get_id() const, get_id)
- // TODO: parse_custom_node, set_custom_property vfuncs
+ // Note: We cannot return a std::string here since the C API expects a
+ // const gchar* as return value. const gchar* however means that the returned
+ // value is not supposed to be freed by the caller. If we would want to return
+ // std::string here, what should we pass to the underlying C API then?
+ // string.c_str() doesn't work since the string destroys the data upon
+ // destruction (which means, we would effectively return an invalid pointer).
+ // We also can't copy the string's content since we would leak that copy
+ // otherwise.
+ _WRAP_VFUNC(const char* get_id() const, get_id)
+
+#m4 _CONVERSION(`ClutterScript*', `const Glib::RefPtr<Script>&', `Glib::wrap(($3), true)')
+ _WRAP_VFUNC(void set_custom_property(const Glib::RefPtr<Script>& script, const Glib::ustring& name, const Glib::ValueBase& value), set_custom_property)
+
+ // TODO: parse_custom_node vfunc
};
} // namespace Clutter
Modified: cluttermm/trunk/clutter/src/types.ccg
==============================================================================
--- cluttermm/trunk/clutter/src/types.ccg (original)
+++ cluttermm/trunk/clutter/src/types.ccg Sat Jun 21 12:55:15 2008
@@ -20,6 +20,17 @@
namespace Clutter
{
+Knot::Knot(int x, int y)
+{
+ gobject_.x = x;
+ gobject_.y = y;
+}
+
+bool Knot::operator==(const Knot& knot) const
+{
+ return clutter_knot_equal(gobj(), knot.gobj());
+}
+
Vertex::Vertex(Unit x, Unit y, Unit z)
{
gobject_.x = x;
Modified: cluttermm/trunk/clutter/src/types.hg
==============================================================================
--- cluttermm/trunk/clutter/src/types.hg (original)
+++ cluttermm/trunk/clutter/src/types.hg Sat Jun 21 12:55:15 2008
@@ -26,7 +26,6 @@
//TODO: Maybe redefine these, to avoid including a C header in our C++ header:
typedef ClutterUnit Unit;
-typedef ClutterKnot Knot;
typedef ClutterFixed Fixed;
typedef ClutterAngle Angle;
@@ -35,6 +34,20 @@
_WRAP_ENUM(Gravity, ClutterGravity, NO_GTYPE)
_WRAP_ENUM(RequestMode, ClutterRequestMode, NO_GTYPE)
+class Knot
+{
+ _CLASS_BOXEDTYPE_STATIC(Knot, ClutterKnot)
+public:
+ Knot(int x, int y);
+
+ _MEMBER_GET(x, x, int, int)
+ _MEMBER_SET(x, x, int, int)
+ _MEMBER_GET(y, y, int, int)
+ _MEMBER_SET(y, y, int, int)
+
+ bool operator==(const Knot& knot) const;
+};
+
class Vertex
{
_CLASS_BOXEDTYPE_STATIC(Vertex, ClutterVertex)
Modified: cluttermm/trunk/tools/m4/convert_cluttermm.m4
==============================================================================
--- cluttermm/trunk/tools/m4/convert_cluttermm.m4 (original)
+++ cluttermm/trunk/tools/m4/convert_cluttermm.m4 Sat Jun 21 12:55:15 2008
@@ -26,12 +26,11 @@
_CONVERSION(`ClutterUnit&',`ClutterUnit*',`&($3)')
_CONVERSION(`ClutterUnit*',`ClutterUnit&',`*($3)')
-_CONVERSION(`Knot&',`ClutterKnot*',`&($3)')
-_CONVERSION(`const Knot&',`ClutterKnot*',`&($3)')
-_CONVERSION(`const Knot&',`const ClutterKnot*',`&($3)')
-_CONVERSION(`ClutterKnot*',`Knot&',`*($3)')
-_CONVERSION(`ClutterKnot*',`const Knot&',`*($3)')
-_CONVERSION(`const ClutterKnot*',`const Knot&',`*($3)')
+_CONVERSION(`Knot&',`ClutterKnot*',`($3).gobj()')
+_CONVERSION(`const Knot&',`ClutterKnot*',`const_cast<ClutterKnot*>(($3).gobj())')
+_CONVERSION(`const Knot&',`const ClutterKnot*',`($3).gobj()')
+_CONVERSION(`ClutterKnot*',`const Knot&',`Knot($3)')
+_CONVERSION(`const ClutterKnot*',`const Knot&',`Knot($3)')
_CONVERSION(`Padding&',`ClutterPadding*',`&($3)')
_CONVERSION(`const Padding&',`const ClutterPadding*',`&($3)')
_CONVERSION(`ClutterPadding*',`Padding&',`*($3)')
@@ -69,3 +68,4 @@
_CONV_ENUM(Pango,EllipsizeMode)
_CONV_ENUM(Pango,WrapMode)
+_CONVERSION(`const gchar*', `const Glib::ustring&',__GCHARP_TO_USTRING)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]