/*
- * $Id: rb_edje.c 13 2004-06-20 10:32:56Z tilman $
+ * $Id: rb_edje.c 17 2004-06-22 19:37:54Z tilman $
*
* Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
*
static VALUE c_load (VALUE self, VALUE eet, VALUE group)
{
- GET_OBJ (self, Evas_Object, e, "EvasObject");
+ GET_OBJ (self, Evas_Object, e, "Edje");
Check_Type (eet, T_STRING);
Check_Type (group, T_STRING);
return Qnil;
}
+static VALUE c_get_size_min (VALUE self)
+{
+ int w = 0, h = 0;
+
+ GET_OBJ (self, Evas_Object, e, "Edje");
+
+ edje_object_size_min_get (*e, &w, &h);
+
+ return rb_ary_new3 (2, INT2FIX (w), INT2FIX (h));
+}
+
+static VALUE c_get_size_max (VALUE self)
+{
+ int w = 0, h = 0;
+
+ GET_OBJ (self, Evas_Object, e, "Edje");
+
+ edje_object_size_max_get (*e, &w, &h);
+
+ return rb_ary_new3 (2, INT2FIX (w), INT2FIX (h));
+}
+
+static VALUE c_part_exists_get (VALUE self, VALUE part)
+{
+ int r;
+
+ GET_OBJ (self, Evas_Object, e, "Edje");
+
+ Check_Type (part, T_STRING);
+
+ r = edje_object_part_exists (*e, StringValuePtr (part));
+
+ return r ? Qtrue : Qfalse;
+}
+
+static VALUE c_part_swallow (VALUE self, VALUE part, VALUE target)
+{
+ GET_OBJ (self, Evas_Object, e, "Edje");
+
+ Check_Type (part, T_STRING);
+
+ if (!rb_obj_is_kind_of (target, cEvasObject)) {
+ rb_raise (rb_eTypeError,
+ "wrong argument type %s (expected EvasObject)",
+ rb_obj_classname (target));
+ return Qnil;
+ }
+
+ GET_OBJ (target, Evas_Object, target2, "EvasObject");
+
+ edje_object_part_swallow (*e, StringValuePtr (part), *target2);
+
+ return Qnil;
+}
+
+static VALUE c_part_unswallow (VALUE self, VALUE target)
+{
+ GET_OBJ (self, Evas_Object, e, "Edje");
+
+ if (!rb_obj_is_kind_of (target, cEvasObject)) {
+ rb_raise (rb_eTypeError,
+ "wrong argument type %s (expected EvasObject)",
+ rb_obj_classname (target));
+ return Qnil;
+ }
+
+ GET_OBJ (target, Evas_Object, target2, "EvasObject");
+
+ edje_object_part_unswallow (*e, *target2);
+
+ return Qnil;
+}
+
+static VALUE c_get_part_swallow (VALUE self, VALUE part)
+{
+ Evas_Object *o;
+ void *obj;
+
+ GET_OBJ (self, Evas_Object, e, "Edje");
+
+ Check_Type (part, T_STRING);
+
+ if (!(o = edje_object_part_swallow_get (*e, StringValuePtr (part))))
+ return Qnil;
+
+ if (!(obj = evas_object_data_get (o, RUBY_EVAS_OBJECT_KEY))) {
+ rb_raise (rb_eException, "EvasObject Ruby object key missing");
+ return Qnil;
+ }
+
+ return (VALUE) obj;
+}
+
void Init_Edje (void)
{
cEdje = rb_define_class_under (mEdje, "Edje", cEvasObject);
rb_define_singleton_method (cEdje, "new", c_new, 1);
rb_define_method (cEdje, "load", c_load, 2);
+ rb_define_method (cEdje, "get_size_min", c_get_size_min, 0);
+ rb_define_method (cEdje, "get_size_max", c_get_size_max, 0);
+ rb_define_method (cEdje, "part_exists?", c_part_exists_get, 1);
+ rb_define_method (cEdje, "part_swallow", c_part_swallow, 2);
+ rb_define_method (cEdje, "part_unswallow", c_part_unswallow, 1);
+ rb_define_method (cEdje, "get_part_swallow", c_get_part_swallow, 1);
}
/*
- * $Id: rb_edje_main.c 7 2004-06-19 19:32:33Z tilman $
+ * $Id: rb_edje_main.c 17 2004-06-22 19:37:54Z tilman $
*
* Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
*
return INT2FIX (edje_shutdown ());
}
+static VALUE m_freeze (VALUE self)
+{
+ edje_freeze ();
+
+ return Qnil;
+}
+
+static VALUE m_thaw (VALUE self)
+{
+ edje_thaw ();
+
+ return Qnil;
+}
+
+static VALUE m_frametime_get (VALUE self)
+{
+ return rb_float_new (edje_frametime_get ());
+}
+
+static VALUE m_frametime_set (VALUE self, VALUE val)
+{
+ Check_Type (val, T_FLOAT);
+
+ edje_frametime_set (NUM2DBL (val));
+
+ return Qnil;
+}
+
void Init_edje (void)
{
rb_require ("evas");
rb_define_module_function (mEdje, "init", m_init, 0);
rb_define_module_function (mEdje, "shutdown", m_shutdown, 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);
+ rb_define_module_function (mEdje, "frametime=", m_frametime_set, 1);
Init_Edje ();
}