/* * $Id: rb_edje_main.c 345 2005-05-08 17:03:21Z tilman $ * * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include "rb_edje_main.h" #include "rb_edje.h" #include "rb_part.h" /* * call-seq: * Edje.freeze => nil * * Freezes all Edje::Edje objects. */ static VALUE m_freeze (VALUE self) { edje_init (); edje_freeze (); edje_shutdown (); return Qnil; } /* * call-seq: * Edje.thaw => nil * * Thaws all Edje::Edje objects. */ static VALUE m_thaw (VALUE self) { edje_init (); edje_thaw (); edje_shutdown (); return Qnil; } /* * call-seq: * Edje.frametime => float * * Returns the frametime (1 / fps) for the Edje library. */ static VALUE m_frametime_get (VALUE self) { VALUE ret; edje_init (); ret = rb_float_new (edje_frametime_get ()); edje_shutdown (); return ret; } /* * 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); edje_init (); edje_frametime_set (NUM2DBL (val)); edje_shutdown (); 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 (); edje_init (); list = edje_file_collection_list (StringValuePtr (file)); if (list) { for (l = list; l; l = l->next) rb_ary_push (ary, rb_str_new2 (l->data)); edje_file_collection_list_free (list); } edje_shutdown (); return ary; } void Init_edje (void) { rb_require ("evas"); mEdje = rb_define_module ("Edje"); 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 (); }