/*
- * $Id: rb_edje.c 51 2004-08-01 10:19:02Z tilman $
+ * $Id: rb_edje.c 66 2004-08-12 19:37:52Z tilman $
*
* Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
*
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];
return self;
}
+/*
+ * call-seq:
+ * edje.freeze => nil
+ *
+ * Freezes <i>edje</i>.
+ */
static VALUE c_freeze (VALUE self)
{
GET_OBJ (self, RbEdje, e);
return Qnil;
}
+/*
+ * call-seq:
+ * edje.thaw => nil
+ *
+ * Thaws <i>edje</i>.
+ */
static VALUE c_thaw (VALUE self)
{
GET_OBJ (self, RbEdje, e);
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);
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;
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;
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 returns false.
+ */
static VALUE c_part_exists_get (VALUE self, VALUE name)
{
int r;
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;
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;
+ }
if (NIL_P (part = rb_hash_aref (e->parts, name))) {
part = TO_PART (self, name);
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);
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);
- Check_Type (emission, T_STRING);
+ Check_Type (signal, 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,
- const char *emission, const char *src)
+ const char *signal, const char *src)
{
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;
return Qnil;
}
+/*
+ * call-seq:
+ * edje.play? => true or false
+ *
+ * Returns true if <i>edje</i> is in play mode, else returns false.
+ */
static VALUE c_play_get (VALUE self)
{
GET_OBJ (self, RbEdje, e);
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);
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);
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);