Documentation arrived.
authorTilman Sauerbeck <tilman@code-monkey.de>
Tue, 10 Aug 2004 14:10:31 +0000 (14:10 +0000)
committerTilman Sauerbeck <tilman@code-monkey.de>
Tue, 10 Aug 2004 14:10:31 +0000 (14:10 +0000)
Makefile.am
README
src/rb_edje.c
src/rb_edje_main.c
src/rb_part.c

index a9b0ccd47f57217d7a879b68e27bc14cfc78f12c..838421503143063a86fd7c4075b6ca039862ccc2 100644 (file)
@@ -1,3 +1,9 @@
-## $Id: Makefile.am 7 2004-06-19 19:32:33Z tilman $
+## $Id: Makefile.am 59 2004-08-10 14:10:31Z tilman $
 
 SUBDIRS = m4 src
 
 SUBDIRS = m4 src
+DOC_INPUT = src/rb_edje_main.c \
+            src/rb_edje.c \
+            src/rb_part.c
+
+doc: $(DOC_INPUT)
+       rdoc $(DOC_INPUT)
diff --git a/README b/README
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..2022c20530519d750e8985668689d474dbc3564b 100644 (file)
--- a/README
+++ b/README
@@ -0,0 +1,29 @@
+$Id: README 59 2004-08-10 14:10:31Z tilman $
+
+ruby-edje - Ruby bindings for Edje
+==================================
+
+
+About
+-----
+
+ruby-edje is a set of Ruby language bindings for Enlightenment's Layout
+library, edje.
+
+
+Installation
+------------
+
+Please see INSTALL.
+
+
+Documentation
+-------------
+
+To create the HTML documentation for ruby-edje, a patched version of
+rdoc is required. The necessary patches can be found at
+http://code-monkey.de/?patches
+
+After you've patched rdoc, please run "make doc" to create the HTML.
+The docs can also be found at
+http://code-monkey.de/ruby-efl-docs/edje
index 57509cfc37044e2e0bff0b69e831017bd64556f3..6e32824418a6764ba6bd9d970d692c6f78dd87b3 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * $Id: rb_edje.c 51 2004-08-01 10:19:02Z tilman $
+ * $Id: rb_edje.c 59 2004-08-10 14:10:31Z tilman $
  *
  * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
  *
  *
  * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
  *
@@ -49,6 +49,12 @@ static void c_free (RbEdje *e)
        edje_shutdown ();
 }
 
        edje_shutdown ();
 }
 
+/*
+ * call-seq:
+ *  Edje::Edje.new(evas) => edje
+ *
+ * Creates an Edje::Edje object.
+ */
 static VALUE c_new (VALUE klass, VALUE evas)
 {
        VALUE self, argv[1];
 static VALUE c_new (VALUE klass, VALUE evas)
 {
        VALUE self, argv[1];
@@ -72,6 +78,12 @@ static VALUE c_new (VALUE klass, VALUE evas)
        return self;
 }
 
        return self;
 }
 
+/*
+ * call-seq:
+ *  edje.freeze => nil
+ *
+ * Freezes <i>edje</i>.
+ */
 static VALUE c_freeze (VALUE self)
 {
        GET_OBJ (self, RbEdje, e);
 static VALUE c_freeze (VALUE self)
 {
        GET_OBJ (self, RbEdje, e);
@@ -81,6 +93,12 @@ static VALUE c_freeze (VALUE self)
        return Qnil;
 }
 
        return Qnil;
 }
 
+/*
+ * call-seq:
+ *  edje.thaw => nil
+ *
+ * Thaws <i>edje</i>.
+ */
 static VALUE c_thaw (VALUE self)
 {
        GET_OBJ (self, RbEdje, e);
 static VALUE c_thaw (VALUE self)
 {
        GET_OBJ (self, RbEdje, e);
@@ -90,6 +108,13 @@ static VALUE c_thaw (VALUE self)
        return Qnil;
 }
 
        return Qnil;
 }
 
+/*
+ * call-seq:
+ *  edje.load(eet, group) => nil
+ *
+ * Loads <i>eet</i> into <i>edje</i>. <i>group</i> is the
+ * name of the group to be displayed.
+ */
 static VALUE c_load (VALUE self, VALUE eet, VALUE group)
 {
        GET_OBJ (self, RbEdje, e);
 static VALUE c_load (VALUE self, VALUE eet, VALUE group)
 {
        GET_OBJ (self, RbEdje, e);
@@ -104,6 +129,13 @@ static VALUE c_load (VALUE self, VALUE eet, VALUE group)
        return Qnil;
 }
 
        return Qnil;
 }
 
+/*
+ * call-seq:
+ *  edje.get_size_min => array
+ *
+ * Returns an array that contains the minimum size
+ * of <i>edje</i>.
+ */
 static VALUE c_get_size_min (VALUE self)
 {
        int w = 0, h = 0;
 static VALUE c_get_size_min (VALUE self)
 {
        int w = 0, h = 0;
@@ -115,6 +147,13 @@ static VALUE c_get_size_min (VALUE self)
        return rb_ary_new3 (2, INT2FIX (w), INT2FIX (h));
 }
 
        return rb_ary_new3 (2, INT2FIX (w), INT2FIX (h));
 }
 
+/*
+ * call-seq:
+ *  edje.get_size_max => array
+ *
+ * Returns an array that contains the maximum size
+ * of <i>edje</i>.
+ */
 static VALUE c_get_size_max (VALUE self)
 {
        int w = 0, h = 0;
 static VALUE c_get_size_max (VALUE self)
 {
        int w = 0, h = 0;
@@ -126,6 +165,12 @@ static VALUE c_get_size_max (VALUE self)
        return rb_ary_new3 (2, INT2FIX (w), INT2FIX (h));
 }
 
        return rb_ary_new3 (2, INT2FIX (w), INT2FIX (h));
 }
 
+/*
+ * call-seq:
+ *  edje.part_exists?(part) => true or false
+ *
+ * Returns true if <i>edje</i> has a part called <i>part</i>, else false.
+ */
 static VALUE c_part_exists_get (VALUE self, VALUE name)
 {
        int r;
 static VALUE c_part_exists_get (VALUE self, VALUE name)
 {
        int r;
@@ -139,6 +184,14 @@ static VALUE c_part_exists_get (VALUE self, VALUE name)
        return r ? Qtrue : Qfalse;
 }
 
        return r ? Qtrue : Qfalse;
 }
 
+/*
+ * call-seq:
+ *  edje.part(part_name) => part
+ *
+ * Returns the <code>Edje::Part</code> object that corresponds to
+ * <i>part_name</i>. If there's no part with that name in <i>edje</i>,
+ * an exception is raised.
+ */
 static VALUE c_part_get (VALUE self, VALUE name)
 {
        VALUE part;
 static VALUE c_part_get (VALUE self, VALUE name)
 {
        VALUE part;
@@ -146,8 +199,10 @@ static VALUE c_part_get (VALUE self, VALUE name)
        GET_OBJ (self, RbEdje, e);
        Check_Type (name, T_STRING);
 
        GET_OBJ (self, RbEdje, e);
        Check_Type (name, T_STRING);
 
-       if (!edje_object_part_exists (e->real.real, StringValuePtr (name)))
+       if (!edje_object_part_exists (e->real.real, StringValuePtr (name))) {
+               rb_raise (rb_eException, "Unknown part name");
                return Qnil;
                return Qnil;
+       }
 
        if (NIL_P (part = rb_hash_aref (e->parts, name))) {
                part = TO_PART (self, name);
 
        if (NIL_P (part = rb_hash_aref (e->parts, name))) {
                part = TO_PART (self, name);
@@ -175,6 +230,15 @@ static void on_text_changed (void *data, Evas_Object *eo,
                    rb_intern ("call"), 1, part);
 }
 
                    rb_intern ("call"), 1, part);
 }
 
+/*
+ * call-seq:
+ *  edje.on_text_changed { |part_obj| block }
+ *
+ * Registers a callback that will get called when the text
+ * of any part is changed in <i>edje</i>.
+ * The block is passed the <code>Edje::Part</code> object
+ * of which the text changed.
+ */
 static VALUE c_on_text_changed (VALUE self)
 {
        GET_OBJ (self, RbEdje, e);
 static VALUE c_on_text_changed (VALUE self)
 {
        GET_OBJ (self, RbEdje, e);
@@ -190,26 +254,43 @@ static VALUE c_on_text_changed (VALUE self)
        return Qnil;
 }
 
        return Qnil;
 }
 
-static VALUE c_emit_signal (VALUE self, VALUE emission, VALUE source)
+/*
+ * call-seq:
+ *  edje.emit_signal(signal, source) => nil
+ *
+ * Emits a signal to <i>edje</i>.
+ *
+ *  edje.emit_signal("signal_foo", "part_bar") #=> nil
+ */
+static VALUE c_emit_signal (VALUE self, VALUE signal, VALUE source)
 {
        GET_OBJ (self, RbEdje, e);
 
 {
        GET_OBJ (self, RbEdje, e);
 
-       Check_Type (emission, T_STRING);
+       Check_Type (signal, T_STRING);
        Check_Type (source, T_STRING);
 
        Check_Type (source, T_STRING);
 
-       edje_object_signal_emit (e->real.real, StringValuePtr (emission),
+       edje_object_signal_emit (e->real.real, StringValuePtr (signal),
                                 StringValuePtr (source));
 
        return Qnil;
 }
 
 static void on_signal (void *data, Evas_Object *o,
                                 StringValuePtr (source));
 
        return Qnil;
 }
 
 static void on_signal (void *data, Evas_Object *o,
-                       const char *emission, const char *src)
+                       const char *signal, const char *src)
 {
        rb_funcall ((VALUE) data, rb_intern ("call"), 2,
 {
        rb_funcall ((VALUE) data, rb_intern ("call"), 2,
-                   rb_str_new2 (emission), rb_str_new2 (src));
+                   rb_str_new2 (signal), rb_str_new2 (src));
 }
 
 }
 
+/*
+ * call-seq:
+ *  edje.on_signal(signal, source) { |signal, source| block } => nil
+ *
+ * Registers a callback that will get called when <i>signal</i>
+ * is emitted by <i>source</i>.
+ * The block is passed two strings, signal and source, which identify
+ * the emission.
+ */
 static VALUE c_on_signal (VALUE self, VALUE signal, VALUE src)
 {
        VALUE cb;
 static VALUE c_on_signal (VALUE self, VALUE signal, VALUE src)
 {
        VALUE cb;
@@ -233,6 +314,12 @@ static VALUE c_on_signal (VALUE self, VALUE signal, VALUE src)
        return Qnil;
 }
 
        return Qnil;
 }
 
+/*
+ * call-seq:
+ *  edje.play? => true or false
+ *
+ * Returns true if <i>edje</i> is in play mode, else false.
+ */
 static VALUE c_play_get (VALUE self)
 {
        GET_OBJ (self, RbEdje, e);
 static VALUE c_play_get (VALUE self)
 {
        GET_OBJ (self, RbEdje, e);
@@ -240,6 +327,12 @@ static VALUE c_play_get (VALUE self)
        return edje_object_play_get (e->real.real) ? Qtrue : Qfalse;
 }
 
        return edje_object_play_get (e->real.real) ? Qtrue : Qfalse;
 }
 
+/*
+ * call-seq:
+ *  edje.play(true or false)
+ *
+ * Sets <i>edje</i> to play resp. pause mode.
+ */
 static VALUE c_play_set (VALUE self, VALUE val)
 {
        GET_OBJ (self, RbEdje, e);
 static VALUE c_play_set (VALUE self, VALUE val)
 {
        GET_OBJ (self, RbEdje, e);
@@ -251,6 +344,12 @@ static VALUE c_play_set (VALUE self, VALUE val)
        return Qnil;
 }
 
        return Qnil;
 }
 
+/*
+ * call-seq:
+ *  edje.animation? => true or false
+ *
+ * Returns the animation state of <i>edje</i>.
+ */
 static VALUE c_animation_get (VALUE self)
 {
        GET_OBJ (self, RbEdje, e);
 static VALUE c_animation_get (VALUE self)
 {
        GET_OBJ (self, RbEdje, e);
@@ -258,6 +357,12 @@ static VALUE c_animation_get (VALUE self)
        return edje_object_animation_get (e->real.real) ? Qtrue : Qfalse;
 }
 
        return edje_object_animation_get (e->real.real) ? Qtrue : Qfalse;
 }
 
+/*
+ * call-seq:
+ *  edje.animation(true or false)
+ *
+ * Sets the animation state of <i>edje</i>.
+ */
 static VALUE c_animation_set (VALUE self, VALUE val)
 {
        GET_OBJ (self, RbEdje, e);
 static VALUE c_animation_set (VALUE self, VALUE val)
 {
        GET_OBJ (self, RbEdje, e);
index 10fc3c7c7a06e56613201890dd3d3e607db8265d..a553b54703202fbb8aff456105bd27cd599bda10 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * $Id: rb_edje_main.c 47 2004-07-26 13:24:50Z tilman $
+ * $Id: rb_edje_main.c 59 2004-08-10 14:10:31Z tilman $
  *
  * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
  *
  *
  * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
  *
 #include "rb_edje.h"
 #include "rb_part.h"
 
 #include "rb_edje.h"
 #include "rb_part.h"
 
-#ifdef DEBUG
-static VALUE m_init (VALUE self)
-{
-       return INT2FIX (edje_init ());
-}
-
-static VALUE m_shutdown (VALUE self)
-{
-       return INT2FIX (edje_shutdown ());
-}
-#endif
-
+/*
+ * call-seq:
+ *    Edje.freeze => nil
+ *
+ * Freezes all <code>Edje::Edje</code> objects.
+ */
 static VALUE m_freeze (VALUE self)
 {
        edje_freeze ();
 static VALUE m_freeze (VALUE self)
 {
        edje_freeze ();
@@ -45,6 +39,12 @@ static VALUE m_freeze (VALUE self)
        return Qnil;
 }
 
        return Qnil;
 }
 
+/*
+ * call-seq:
+ *    Edje.thaw => nil
+ *
+ * Thaws all <code>Edje::Edje</code> objects.
+ */
 static VALUE m_thaw (VALUE self)
 {
        edje_thaw ();
 static VALUE m_thaw (VALUE self)
 {
        edje_thaw ();
@@ -52,11 +52,23 @@ static VALUE m_thaw (VALUE self)
        return Qnil;
 }
 
        return Qnil;
 }
 
+/*
+ * call-seq:
+ *    Edje.frametime => float
+ *
+ * Returns the frametime (1 / fps) for the Edje library.
+ */
 static VALUE m_frametime_get (VALUE self)
 {
        return rb_float_new (edje_frametime_get ());
 }
 
 static VALUE m_frametime_get (VALUE self)
 {
        return rb_float_new (edje_frametime_get ());
 }
 
+/*
+ * call-seq:
+ *    Edje.frametime(float)
+ *
+ * Sets the frametime (1 / fps) for the Edje library.
+ */
 static VALUE m_frametime_set (VALUE self, VALUE val)
 {
        Check_Type (val, T_FLOAT);
 static VALUE m_frametime_set (VALUE self, VALUE val)
 {
        Check_Type (val, T_FLOAT);
@@ -72,11 +84,6 @@ void Init_edje (void)
 
        mEdje = rb_define_module ("Edje");
 
 
        mEdje = rb_define_module ("Edje");
 
-#ifdef DEBUG
-       rb_define_module_function (mEdje, "init", m_init, 0);
-       rb_define_module_function (mEdje, "shutdown", m_shutdown, 0);
-#endif
-
        rb_define_module_function (mEdje, "freeze", m_freeze, 0);
        rb_define_module_function (mEdje, "thaw", m_thaw, 0);
        rb_define_module_function (mEdje, "frametime", m_frametime_get, 0);
        rb_define_module_function (mEdje, "freeze", m_freeze, 0);
        rb_define_module_function (mEdje, "thaw", m_thaw, 0);
        rb_define_module_function (mEdje, "frametime", m_frametime_get, 0);
index 563be555b6430020945c92e24248e5d9ad7b6959..e20259c48411daf307442a1d2bdcc88159162080 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * $Id: rb_part.c 51 2004-08-01 10:19:02Z tilman $
+ * $Id: rb_part.c 59 2004-08-10 14:10:31Z tilman $
  *
  * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
  *
  *
  * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
  *
@@ -67,7 +67,13 @@ VALUE TO_PART (VALUE edje, VALUE name)
        return self;
 }
 
        return self;
 }
 
-static VALUE c_get_geometry (VALUE self)
+/*
+ * call-seq:
+ *  part.geometry => array
+ *
+ * Returns an array containing the geometry of <i>part</i>.
+ */
+static VALUE c_geometry_get (VALUE self)
 {
        int x = 0, y = 0, w = 0, h = 0;
 
 {
        int x = 0, y = 0, w = 0, h = 0;
 
@@ -83,6 +89,12 @@ static VALUE c_get_geometry (VALUE self)
                            INT2FIX (y), INT2FIX (h));
 }
 
                            INT2FIX (y), INT2FIX (h));
 }
 
+/*
+ * call-seq:
+ *  part.swallow(evasobject) => nil
+ *
+ * Swallows an <code>Evas::EvasObject</code> into <i>part</i>.
+ */
 static VALUE c_swallow (VALUE self, VALUE target)
 {
        GET_OBJ (GET_EDJE (self), RbEdje, e);
 static VALUE c_swallow (VALUE self, VALUE target)
 {
        GET_OBJ (GET_EDJE (self), RbEdje, e);
@@ -95,6 +107,13 @@ static VALUE c_swallow (VALUE self, VALUE target)
        return Qnil;
 }
 
        return Qnil;
 }
 
+/*
+ * call-seq:
+ *  part.unswallow => nil
+ *
+ * Unswallows the <code>Evas::EvasObject</code> swallowed by
+ * <i>part</i>.
+ */
 static VALUE c_unswallow (VALUE self)
 {
        Evas_Object *o;
 static VALUE c_unswallow (VALUE self)
 {
        Evas_Object *o;
@@ -112,6 +131,14 @@ static VALUE c_unswallow (VALUE self)
        return Qnil;
 }
 
        return Qnil;
 }
 
+/*
+ * call-seq:
+ *  part.swallowed_object => evasobject or nil
+ *
+ * Returns the <code>Evas::EvasObject</code> swallowed by
+ * <i>part</i> or nil if <i>part</i> didn't swallow an
+ * <code>Evas::EvasObject</code>.
+ */
 static VALUE c_swallowed_object_get (VALUE self)
 {
        Evas_Object *o;
 static VALUE c_swallowed_object_get (VALUE self)
 {
        Evas_Object *o;
@@ -131,6 +158,12 @@ static VALUE c_swallowed_object_get (VALUE self)
        return (VALUE) obj;
 }
 
        return (VALUE) obj;
 }
 
+/*
+ * call-seq:
+ *  part.text => string
+ *
+ * Returns the text of <i>part</i>.
+ */
 static VALUE c_text_get (VALUE self)
 {
        const char *s;
 static VALUE c_text_get (VALUE self)
 {
        const char *s;
@@ -142,6 +175,12 @@ static VALUE c_text_get (VALUE self)
        return s ? rb_str_new2 (s) : Qnil;
 }
 
        return s ? rb_str_new2 (s) : Qnil;
 }
 
+/*
+ * call-seq:
+ *  part.text(string)
+ *
+ * Sets the text of <i>part</i>.
+ */
 static VALUE c_text_set (VALUE self, VALUE text)
 {
        GET_OBJ (GET_EDJE (self), RbEdje, e);
 static VALUE c_text_set (VALUE self, VALUE text)
 {
        GET_OBJ (GET_EDJE (self), RbEdje, e);
@@ -154,6 +193,15 @@ static VALUE c_text_set (VALUE self, VALUE text)
        return Qnil;
 }
 
        return Qnil;
 }
 
+/*
+ * call-seq:
+ *  part.get_drag_value => array
+ *
+ * Returns the drag value of <i>part</i>.
+ *
+ *  part.set_drag_value(1.5, 2.5) #=> nil
+ *  part.get_drag_value           #=> [1.5, 2.5]
+ */
 static VALUE c_get_drag_value (VALUE self)
 {
        double dx = 0, dy = 0;
 static VALUE c_get_drag_value (VALUE self)
 {
        double dx = 0, dy = 0;
@@ -165,6 +213,14 @@ static VALUE c_get_drag_value (VALUE self)
        return rb_ary_new3 (2, rb_float_new (dx), rb_float_new (dy));
 }
 
        return rb_ary_new3 (2, rb_float_new (dx), rb_float_new (dy));
 }
 
+/*
+ * call-seq:
+ *  part.set_drag_value(dx, dy) => nil
+ *
+ * Sets the drag value of <i>part</i>.
+ *
+ *  part.set_drag_value(1.5, 2.5) #=> nil
+ */
 static VALUE c_set_drag_value (VALUE self, VALUE dx, VALUE dy)
 {
        GET_OBJ (GET_EDJE (self), RbEdje, e);
 static VALUE c_set_drag_value (VALUE self, VALUE dx, VALUE dy)
 {
        GET_OBJ (GET_EDJE (self), RbEdje, e);
@@ -191,7 +247,7 @@ void Init_Part (void)
        /* not publically instantiable yet */
        rb_define_private_method (rb_singleton_class (cPart),
                                  "new", NULL, 0);
        /* not publically instantiable yet */
        rb_define_private_method (rb_singleton_class (cPart),
                                  "new", NULL, 0);
-       rb_define_method (cPart, "get_geometry", c_get_geometry, 0);
+       rb_define_method (cPart, "geometry", c_geometry_get, 0);
        rb_define_method (cPart, "swallow", c_swallow, 1);
        rb_define_method (cPart, "unswallow", c_unswallow, 1);
        rb_define_method (cPart, "swallowed_object",
        rb_define_method (cPart, "swallow", c_swallow, 1);
        rb_define_method (cPart, "unswallow", c_unswallow, 1);
        rb_define_method (cPart, "swallowed_object",