/*
- * $Id: rb_evas_object.c 304 2005-03-22 17:51:51Z tilman $
+ * $Id: rb_evas_object.c 314 2005-04-07 18:23:42Z tilman $
*
* Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
*
return evas_object_visible_get (e->real) ? Qtrue : Qfalse;
}
+/*
+ * call-seq:
+ * e.focused? => true or false
+ *
+ * Returns true if <i>e</i> is focused, else returns false.
+ */
+static VALUE c_focused_get (VALUE self)
+{
+ GET_OBJ (self, RbEvasObject, e);
+
+ return evas_object_focus_get (e->real) ? Qtrue : Qfalse;
+}
+
+/*
+ * call-seq:
+ * e.focused(true or false)
+ *
+ * (Un)focuses <i>e</i>.
+ */
+static VALUE c_focused_set (VALUE self, VALUE val)
+{
+ GET_OBJ (self, RbEvasObject, e);
+
+ CHECK_BOOL (val);
+
+ evas_object_focus_set (e->real, val == Qtrue);
+
+ return Qnil;
+}
+
/*
* call-seq:
* e.evas => evas
rb_define_method (cEvasObject, "show", c_show, 0);
rb_define_method (cEvasObject, "hide", c_hide, 0);
rb_define_method (cEvasObject, "visible?", c_visible_get, 0);
+ rb_define_method (cEvasObject, "focused?", c_focused_get, 0);
+ rb_define_method (cEvasObject, "focused=", c_focused_set, 1);
rb_define_method (cEvasObject, "evas", c_evas_get, 0);
rb_define_method (cEvasObject, "name", c_name_get, 0);
rb_define_method (cEvasObject, "name=", c_name_set, 1);