gnomemm r1305 - in cluttermm/trunk: . clutter/src



Author: murrayc
Date: Sat Jan 26 14:24:18 2008
New Revision: 1305
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1305&view=rev

Log:
2008-01-26  Murray Cumming  <murrayc murrayc com>

* clutter/src/score.hg: Do not use _DERIVES_INITIALLY_UNOWNED, because I 
do not think it does.
get_timeline(): Use refreturn. 
* clutter/src/script.hg: Wrap clutter_get_script_id() as a static method.
* clutter/src/scriptable.hg: Wrap the get_id() vfunc.
* clutter/src/shader.ccg:
* clutter/src/shader.hg: Use std::string for the source code (data) parameters.
* clutter/src/stage.hg: Added default values for set_*(bool) methods.

Modified:
   cluttermm/trunk/ChangeLog
   cluttermm/trunk/clutter/src/behaviour-bspline.hg
   cluttermm/trunk/clutter/src/behaviour-path.hg
   cluttermm/trunk/clutter/src/score.hg
   cluttermm/trunk/clutter/src/script.hg
   cluttermm/trunk/clutter/src/scriptable.hg
   cluttermm/trunk/clutter/src/shader.ccg
   cluttermm/trunk/clutter/src/shader.hg
   cluttermm/trunk/clutter/src/stage.hg

Modified: cluttermm/trunk/clutter/src/behaviour-bspline.hg
==============================================================================
--- cluttermm/trunk/clutter/src/behaviour-bspline.hg	(original)
+++ cluttermm/trunk/clutter/src/behaviour-bspline.hg	Sat Jan 26 14:24:18 2008
@@ -27,7 +27,9 @@
 namespace Clutter
 {
 
-class BehaviourBspline : public Behaviour, public Scriptable
+class BehaviourBspline
+: public Behaviour,
+  public Scriptable
 {
   _CLASS_GOBJECT(BehaviourBspline, ClutterBehaviourBspline, CLUTTER_BEHAVIOUR_BSPLINE, Behaviour, ClutterBehaviour)
   _IMPLEMENTS_INTERFACE(Scriptable)

Modified: cluttermm/trunk/clutter/src/behaviour-path.hg
==============================================================================
--- cluttermm/trunk/clutter/src/behaviour-path.hg	(original)
+++ cluttermm/trunk/clutter/src/behaviour-path.hg	Sat Jan 26 14:24:18 2008
@@ -27,7 +27,9 @@
 namespace Clutter
 {
 
-class BehaviourPath : public Behaviour, public Scriptable
+class BehaviourPath 
+: public Behaviour, 
+  public Scriptable
 {
   _CLASS_GOBJECT(BehaviourPath, ClutterBehaviourPath, CLUTTER_BEHAVIOUR_PATH, Behaviour, ClutterBehaviour)
   _IMPLEMENTS_INTERFACE(Scriptable)

Modified: cluttermm/trunk/clutter/src/score.hg
==============================================================================
--- cluttermm/trunk/clutter/src/score.hg	(original)
+++ cluttermm/trunk/clutter/src/score.hg	Sat Jan 26 14:24:18 2008
@@ -29,7 +29,6 @@
 class Score : public Glib::Object
 {
   _CLASS_GOBJECT(Score, ClutterScore, CLUTTER_SCORE, Glib::Object, GObject)
-  _DERIVES_INITIALLY_UNOWNED()
 
 protected:
   _CTOR_DEFAULT()
@@ -37,24 +36,25 @@
 public:
   _WRAP_CREATE()
 
-  _WRAP_METHOD(void set_loop(bool loop), clutter_score_set_loop)
+  _WRAP_METHOD(void set_loop(bool loop = true), clutter_score_set_loop)
   _WRAP_METHOD(bool get_loop() const, clutter_score_get_loop)
 
   _WRAP_METHOD(guint append(const Glib::RefPtr<Timeline>& parent, const Glib::RefPtr<Timeline>& timeline), clutter_score_append)
-  /**
-   * Appends a timeline to another one existing in the score; the new timeline
-   * will be started when start() is called
+
+  /** Appends a timeline to another one existing in the score. The new timeline
+   * will be started when start() is called.
    *
    * @param timeline the Timeline to append
    * @return the id of the newly added timeline, to be used with get_timeline() and remove().
-   *
-   * @since 0.6 
    */
   guint append(const Glib::RefPtr<Timeline>& timeline);
+
   _WRAP_METHOD(void remove(guint id), clutter_score_remove)
   _WRAP_METHOD(void remove_all(), clutter_score_remove_all)
-  _WRAP_METHOD(Glib::RefPtr<Timeline> get_timeline(guint id), clutter_score_get_timeline)
-  _WRAP_METHOD(Glib::RefPtr<const Timeline> get_timeline(guint id) const, clutter_score_get_timeline, CONSTVERSION)
+
+  _WRAP_METHOD(Glib::RefPtr<Timeline> get_timeline(guint id), clutter_score_get_timeline, refreturn)
+  _WRAP_METHOD(Glib::RefPtr<const Timeline> get_timeline(guint id) const, clutter_score_get_timeline, , refreturn, constversion)
+
   _WRAP_METHOD(void start(), clutter_score_start)
   _WRAP_METHOD(void pause(), clutter_score_pause)
   _WRAP_METHOD(void stop(), clutter_score_stop)

Modified: cluttermm/trunk/clutter/src/script.hg
==============================================================================
--- cluttermm/trunk/clutter/src/script.hg	(original)
+++ cluttermm/trunk/clutter/src/script.hg	Sat Jan 26 14:24:18 2008
@@ -39,15 +39,22 @@
 
   //_WRAP_METHOD(guint load_from_data(const std::string& data), clutter_script_load_from_data, errthrow)
   _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)
-  // TODO: get_objects()
+  _WRAP_METHOD(Glib::RefPtr<const Glib::Object> get_object(const Glib::ustring& name) const, clutter_script_get_object, refreturn, constverrsion)
+
+  //clutter_script_get_objects() is a varargs convenience function for C.
+  _IGNORE(clutter_script_get_objects)
+
   _WRAP_METHOD(void unmerge_object(guint merge_id), clutter_script_unmerge_objects)
   _WRAP_METHOD(void ensure_objects(), clutter_script_ensure_objects)
+
   // TODO: connect_signals functions
   // TODO: do we need get_type_from_name()?
+  // clutter_script_connect_signals() and clutter_script_connect_signals_full() seem to be like glade_xml_autoconnect(), 
+  // and I don't see a way to implement them in C++. murrayc.
 
-  // TODO: clutter_get_script_id is not really a Script method, how to handle
-  // this?
+  _WRAP_METHOD(static std::string get_script_id(const Glib::RefPtr<const Glib::Object>& object), clutter_get_script_id)
 
   _WRAP_PROPERTY("filename", std::string)
   _WRAP_PROPERTY("filename-set", bool)

Modified: cluttermm/trunk/clutter/src/scriptable.hg
==============================================================================
--- cluttermm/trunk/clutter/src/scriptable.hg	(original)
+++ cluttermm/trunk/clutter/src/scriptable.hg	Sat Jan 26 14:24:18 2008
@@ -33,6 +33,7 @@
 public:
   _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
@@ -40,9 +41,9 @@
 protected:
 
   _WRAP_VFUNC(void set_id(const std::string& id), set_id)
-  // TODO: 'No conversion from std::string to const gchar* defined' - why does
-  // it work above?
-  //_WRAP_VFUNC(std::string get_id(), get_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
 };
 

Modified: cluttermm/trunk/clutter/src/shader.ccg
==============================================================================
--- cluttermm/trunk/clutter/src/shader.ccg	(original)
+++ cluttermm/trunk/clutter/src/shader.ccg	Sat Jan 26 14:24:18 2008
@@ -15,3 +15,18 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+namespace Clutter
+{
+
+void Shader::set_vertex_source(const std::string& source_code)
+{
+  clutter_shader_set_vertex_source(gobj(), source_code.c_str(), source_code.size()); 
+}
+
+void Shader::set_fragment_source(const std::string& source_code)
+{
+  clutter_shader_set_fragment_source(gobj(), source_code.c_str(), source_code.size()); 
+}
+
+} //namespace Clutter
+

Modified: cluttermm/trunk/clutter/src/shader.hg
==============================================================================
--- cluttermm/trunk/clutter/src/shader.hg	(original)
+++ cluttermm/trunk/clutter/src/shader.hg	Sat Jan 26 14:24:18 2008
@@ -36,22 +36,28 @@
 public:
   _WRAP_CREATE()
 
-  // TODO: For now I've left this as gchar*, the same as the underlying C API.
-  // Another type might be easier in C++
-  _WRAP_METHOD(void set_vertex_source(const gchar* data, gssize length), clutter_shader_set_vertex_source)
-  _WRAP_METHOD(const gchar* get_vertex_source() const, clutter_shader_get_vertex_source)
-  _WRAP_METHOD(void set_fragment_source(const gchar* data, gssize length), clutter_shader_set_fragment_source)
-  _WRAP_METHOD(const gchar* get_fragment_source() const, clutter_shader_get_fragment_source)
+  //TODO: Documentation:
+  void set_vertex_source(const std::string& source_code);
+  _IGNORE(clutter_shader_set_vertex_source)
+
+  _WRAP_METHOD(std::string get_vertex_source() const, clutter_shader_get_vertex_source)
+
+    //TODO: Documentation:
+  void set_fragment_source(const std::string& source_code);
+  _IGNORE(clutter_shader_set_fragment_source)
+
+  _WRAP_METHOD(std::string get_fragment_source() const, clutter_shader_get_fragment_source)
+
   _WRAP_METHOD(bool bind(), clutter_shader_bind, errthrow)
   _WRAP_METHOD(void release(), clutter_shader_release)
   _WRAP_METHOD(bool is_bound() const, clutter_shader_is_bound)
-  _WRAP_METHOD(void set_is_enabled(bool enabled), clutter_shader_set_is_enabled)
+  _WRAP_METHOD(void set_is_enabled(bool enabled = true), clutter_shader_set_is_enabled)
   _WRAP_METHOD(bool get_is_enabled() const, clutter_shader_get_is_enabled)
 
   _WRAP_PROPERTY("bound", bool)
   _WRAP_PROPERTY("enabled", bool)
-  _WRAP_PROPERTY("fragment-source", gchar*)
-  _WRAP_PROPERTY("vertex-source", gchar*)
+  _WRAP_PROPERTY("fragment-source", std::string)
+  _WRAP_PROPERTY("vertex-source", std::string)
 };
 
 } // namespace Clutter

Modified: cluttermm/trunk/clutter/src/stage.hg
==============================================================================
--- cluttermm/trunk/clutter/src/stage.hg	(original)
+++ cluttermm/trunk/clutter/src/stage.hg	Sat Jan 26 14:24:18 2008
@@ -59,14 +59,19 @@
   _WRAP_METHOD(void set_title(const Glib::ustring& title), clutter_stage_set_title)
   _WRAP_METHOD(void set_user_resizable(bool value), clutter_stage_set_user_resizable)
   _WRAP_METHOD(bool get_user_resizable() const, clutter_stage_get_user_resizable)
+
   _WRAP_METHOD(Glib::RefPtr<Actor> get_actor_at_pos(int x, int y), clutter_stage_get_actor_at_pos, refreturn)
-  _WRAP_METHOD(Glib::RefPtr<const Actor> get_actor_at_pos(int x, int y) const, clutter_stage_get_actor_at_pos, constversion)
+  _WRAP_METHOD(Glib::RefPtr<const Actor> get_actor_at_pos(int x, int y) const, clutter_stage_get_actor_at_pos, refreturn, constversion)
+
   _WRAP_METHOD(Glib::RefPtr<Actor> get_key_focus(), clutter_stage_get_key_focus, refreturn)
-  _WRAP_METHOD(Glib::RefPtr<const Actor> get_key_focus() const, clutter_stage_get_key_focus, constversion)
+  _WRAP_METHOD(Glib::RefPtr<const Actor> get_key_focus() const, clutter_stage_get_key_focus,  refreturn, constversion)
+
+  //TODO: actor can be NULL.
   _WRAP_METHOD(void set_key_focus(const Glib::RefPtr<Actor>& actor), clutter_stage_set_key_focus)
+
   _WRAP_METHOD(Glib::RefPtr<Gdk::Pixbuf> snapshot(int x, int y, int width, int height) const, clutter_stage_snapshot)
   _WRAP_METHOD(bool get_use_fog() const, clutter_stage_get_use_fog)
-  _WRAP_METHOD(void set_use_fog(bool fog), clutter_stage_set_use_fog)
+  _WRAP_METHOD(void set_use_fog(bool fog = true), clutter_stage_set_use_fog)
   _WRAP_METHOD(void set_fog(double density, double z_near, double z_far), clutter_stage_set_fog)
   _WRAP_METHOD(void get_fog(double& density, double& z_near, double& z_far) const, clutter_stage_get_fog)
 #m4 _CONVERSION(`const Fog&',`ClutterFog*',`const_cast<ClutterFog*>(&($3))')



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