X-Git-Url: http://git.code-monkey.de/?p=ruby-edje.git;a=blobdiff_plain;f=src%2Frb_edje_main.c;h=e00a2491e5ab9330dc9b7f66e4fc7500a3f033d3;hp=974d7ff793831394cc2c835dc0cfab98545c7aef;hb=54d77edaa3b998b749948b7a49ada5c209fbef57;hpb=7fab71eba9e0670ba3161b5619f7b532ef8ccccf diff --git a/src/rb_edje_main.c b/src/rb_edje_main.c index 974d7ff..e00a249 100644 --- a/src/rb_edje_main.c +++ b/src/rb_edje_main.c @@ -1,5 +1,5 @@ /* - * $Id: rb_edje_main.c 28 2004-07-08 18:35:51Z tilman $ + * $Id: rb_edje_main.c 287 2005-03-15 18:08:01Z tilman $ * * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de) * @@ -24,19 +24,15 @@ #include "rb_edje_main.h" #include "rb_edje.h" +#include "rb_part.h" +#include "rb_messages.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 Edje::Edje objects. + */ static VALUE m_freeze (VALUE self) { edje_freeze (); @@ -44,6 +40,12 @@ static VALUE m_freeze (VALUE self) return Qnil; } +/* + * call-seq: + * Edje.thaw => nil + * + * Thaws all Edje::Edje objects. + */ static VALUE m_thaw (VALUE self) { edje_thaw (); @@ -51,11 +53,23 @@ static VALUE m_thaw (VALUE self) 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 ()); } +/* + * 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); @@ -65,22 +79,41 @@ static VALUE m_frametime_set (VALUE self, VALUE val) return Qnil; } +static VALUE m_collections_get (VALUE self, VALUE file) +{ + VALUE ary; + Evas_List *list, *l; + + Check_Type (file, T_STRING); + + ary = rb_ary_new (); + + list = edje_file_collection_list (StringValuePtr (file)); + if (!list) + return ary; + + for (l = list; l; l = l->next) + rb_ary_push (ary, rb_str_new2 (l->data)); + + edje_file_collection_list_free (list); + + return ary; +} + void Init_edje (void) { rb_require ("evas"); 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, "frametime=", m_frametime_set, 1); + rb_define_module_function (mEdje, "collections", m_collections_get, 1); Init_Edje (); + Init_Part (); + Init_Messages (); }