Removed RCS-style IDs.
[ruby-ecore.git] / src / ecore_evas / rb_ecore_evas.c
1 /*
2  * Copyright (C) 2004 ruby-ecore team (see AUTHORS)
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
18
19 #include <ruby.h>
20 #include <stdbool.h>
21
22 #include <Ecore.h>
23 #include <Ecore_Evas.h>
24 #include <evas/rb_evas.h>
25
26 #define __RB_ECORE_EVAS_C
27 #include "../ecore/rb_ecore.h"
28 #include "rb_ecore_evas_main.h"
29 #include "rb_ecore_evas.h"
30
31 #define RUBY_ECORE_EVAS_KEY "__RB_ECORE_EVAS_KEY"
32
33 #define CALLBACK_DEFINE_HANDLER(name) \
34         static void on_##name (Ecore_Evas *real) \
35         { \
36                 VALUE self, cb; \
37 \
38                 self = (VALUE) ecore_evas_data_get (real, \
39                                                     RUBY_ECORE_EVAS_KEY); \
40                 GET_OBJ (self, RbEcoreEvas, ee); \
41 \
42                 cb = rb_hash_aref (ee->callbacks, \
43                                    LONG2NUM ((long) ecore_evas_callback_##name##_set)); \
44                 rb_funcall (cb, rb_intern ("call"), 0); \
45         } \
46
47 #define CALLBACK_REG_HANDLER(name) \
48                 GET_OBJ (self, RbEcoreEvas, ee); \
49 \
50                 if (!rb_block_given_p ()) \
51                         return Qnil; \
52 \
53                 if (NIL_P (ee->callbacks)) \
54                         ee->callbacks = rb_hash_new (); \
55 \
56                 rb_hash_aset (ee->callbacks, \
57                               LONG2NUM ((long) ecore_evas_callback_##name##_set), \
58                               rb_block_proc ()); \
59 \
60                 ecore_evas_callback_##name##_set (ee->real, on_##name); \
61 \
62                 return Qnil;
63
64 VALUE cEcoreEvas;
65
66 /* called by the child classes */
67 void c_ecore_evas_mark (RbEcoreEvas *ee)
68 {
69         if (!NIL_P (ee->evas))
70                 rb_gc_mark (ee->evas);
71
72         if (!NIL_P (ee->callbacks))
73                 rb_gc_mark (ee->callbacks);
74 }
75
76 void c_ecore_evas_free (RbEcoreEvas *ee, bool free_mem)
77 {
78         if (ee->real)
79                 ecore_evas_free (ee->real);
80
81         ecore_evas_shutdown ();
82         ecore_shutdown ();
83
84         if (free_mem)
85                 free (ee);
86 }
87
88 /* :nodoc: */
89 static VALUE c_init (int argc, VALUE *argv, VALUE self)
90 {
91         GET_OBJ (self, RbEcoreEvas, ee);
92
93         ee->evas = Qnil;
94         ee->callbacks = Qnil;
95
96         ecore_evas_data_set (ee->real, RUBY_ECORE_EVAS_KEY, (void *) self);
97
98         return Qnil;
99 }
100
101 /* :nodoc: */
102 static VALUE c_inspect (VALUE self)
103 {
104         INSPECT (self, RbEcoreEvas);
105 }
106
107 /*
108  * call-seq:
109  *  ee.show => nil
110  *
111  * Shows <i>ee</i>.
112  */
113 static VALUE c_show (VALUE self)
114 {
115         GET_OBJ (self, RbEcoreEvas, ee);
116
117         ecore_evas_show (ee->real);
118
119         return Qnil;
120 }
121
122 /*
123  * call-seq:
124  *  ee.hide => nil
125  *
126  * Hides <i>ee</i>.
127  */
128 static VALUE c_hide (VALUE self)
129 {
130         GET_OBJ (self, RbEcoreEvas, ee);
131
132         ecore_evas_hide (ee->real);
133
134         return Qnil;
135 }
136
137 /*
138  * call-seq:
139  *  ee.visible? => true or false
140  *
141  * Returns true if <i>ee</i> is visible, else returns false.
142  */
143 static VALUE c_visible_get (VALUE self)
144 {
145         GET_OBJ (self, RbEcoreEvas, ee);
146
147         return ecore_evas_visibility_get (ee->real) ? Qtrue : Qfalse;
148 }
149
150 /*
151  * call-seq:
152  *   ee.raise => nil
153  *
154  * Raises <i>ee</i>.
155  */
156 static VALUE c_raise (VALUE self)
157 {
158         GET_OBJ (self, RbEcoreEvas, ee);
159
160         ecore_evas_raise (ee->real);
161
162         return Qnil;
163 }
164
165 /*
166  * call-seq:
167  *  ee.lower => nil
168  *
169  * Lowers <i>ee</i>.
170  */
171 static VALUE c_lower (VALUE self)
172 {
173         GET_OBJ (self, RbEcoreEvas, ee);
174
175         ecore_evas_lower (ee->real);
176
177         return Qnil;
178 }
179
180 /*
181  * call-seq:
182  *   ee.layer => fixnum
183  *
184  * Returns the layer of <i>ee</i>.
185  */
186 static VALUE c_layer_get (VALUE self)
187 {
188         GET_OBJ (self, RbEcoreEvas, ee);
189
190         return INT2FIX (ecore_evas_layer_get (ee->real));
191 }
192
193 /*
194  * call-seq:
195  *  ee.layer(fixnum) => fixnum
196  *
197  * Sets the layer of <i>ee</i>.
198  */
199 static VALUE c_layer_set (VALUE self, VALUE val)
200 {
201         GET_OBJ (self, RbEcoreEvas, ee);
202
203         Check_Type (val, T_FIXNUM);
204
205         ecore_evas_layer_set (ee->real, FIX2INT (val));
206
207         return Qnil;
208 }
209
210 /*
211  * call-seq:
212  *  ee.evas => evas
213  *
214  * Returns the <code>Evas::Evas</code> object for <i>ee</i>.
215  */
216 static VALUE c_evas_get (VALUE self)
217 {
218         GET_OBJ (self, RbEcoreEvas, ee);
219
220         if (NIL_P (ee->evas))
221                 ee->evas = TO_EVAS (self, ecore_evas_get (ee->real));
222
223         return ee->evas;
224 }
225
226 /*
227  * call-seq:
228  *  ee.geometry => array
229  *
230  * Returns an array containing the geometry of <i>ee</i>.
231  *
232  *  ee.move(150, 300)   #=> nil
233  *  ee.resize(200, 200) #=> nil
234  *  ee.geometry         #=> [150, 300, 200, 200]
235  */
236 static VALUE c_geometry_get (VALUE self)
237 {
238         int x = 0, y = 0, w = 0, h = 0;
239
240         GET_OBJ (self, RbEcoreEvas, ee);
241
242         ecore_evas_geometry_get (ee->real, &x, &y, &w, &h);
243
244         return rb_ary_new3 (4, INT2FIX (x), INT2FIX (y),
245                             INT2FIX (w), INT2FIX (h));
246 }
247
248 /*
249  * call-seq:
250  *  ee.get_size_min => array
251  *
252  * Returns an array containing the minimum size of <i>ee</i>.
253  *
254  *  ee.set_size_min(100, 200) #=> nil
255  *  ee.get_size_min           #=> [100, 200]
256  */
257 static VALUE c_get_size_min (VALUE self)
258 {
259         int w = 0, h = 0;
260
261         GET_OBJ (self, RbEcoreEvas, ee);
262
263         ecore_evas_size_min_get (ee->real, &w, &h);
264
265         return rb_ary_new3 (2, INT2FIX (w), INT2FIX (h));
266 }
267
268 /*
269  * call-seq:
270  *  ee.set_size_min(width, height) => nil
271  *
272  * Sets the minimum size of <i>ee</i>.
273  *
274  *  ee.set_size_min(100, 200) #=> nil
275  */
276 static VALUE c_set_size_min (VALUE self, VALUE w, VALUE h)
277 {
278         GET_OBJ (self, RbEcoreEvas, ee);
279
280         Check_Type (w, T_FIXNUM);
281         Check_Type (h, T_FIXNUM);
282
283         ecore_evas_size_min_set (ee->real, FIX2INT (w), FIX2INT (h));
284
285         return Qnil;
286 }
287
288 /*
289  * call-seq:
290  *  ee.get_size_max => array
291  *
292  * Returns an array containing the maximum size of <i>ee</i>.
293  *
294  *  ee.set_size_max(100, 200) #=> nil
295  *  ee.get_size_max           #=> [100, 200]
296  */
297 static VALUE c_get_size_max (VALUE self)
298 {
299         int w = 0, h = 0;
300
301         GET_OBJ (self, RbEcoreEvas, ee);
302
303         ecore_evas_size_max_get (ee->real, &w, &h);
304
305         return rb_ary_new3 (2, INT2FIX (w), INT2FIX (h));
306 }
307
308 /*
309  * call-seq:
310  *  ee.set_size_max(width, height) => nil
311  *
312  * Sets the maximum size of <i>ee</i>.
313  *
314  *  ee.set_size_max(100, 200) #=> nil
315  */
316 static VALUE c_set_size_max (VALUE self, VALUE w, VALUE h)
317 {
318         GET_OBJ (self, RbEcoreEvas, ee);
319
320         Check_Type (w, T_FIXNUM);
321         Check_Type (h, T_FIXNUM);
322
323         ecore_evas_size_max_set (ee->real, FIX2INT (w), FIX2INT (h));
324
325         return Qnil;
326 }
327
328 /*
329  * call-seq:
330  *  ee.move(x, y) => nil
331  *
332  * Moves <i>ee</i> to the coordinates specified in
333  * <i>x</i> and <i>y</i>.
334  *
335  *  ee.move(100, 200) #=> nil
336  */
337 static VALUE c_move (VALUE self, VALUE x, VALUE y)
338 {
339         GET_OBJ (self, RbEcoreEvas, ee);
340
341         Check_Type (x, T_FIXNUM);
342         Check_Type (y, T_FIXNUM);
343
344         ecore_evas_move (ee->real, FIX2INT (x), FIX2INT (y));
345
346         return Qnil;
347 }
348
349 /*
350  * call-seq:
351  *  ee.resize(width, height) => nil
352  *
353  * Resizes <i>ee</i> to width x height.
354  *
355  *  ee.resize(100, 200) #=> nil
356  */
357 static VALUE c_resize (VALUE self, VALUE w, VALUE h)
358 {
359         GET_OBJ (self, RbEcoreEvas, ee);
360
361         Check_Type (w, T_FIXNUM);
362         Check_Type (h, T_FIXNUM);
363
364         ecore_evas_resize (ee->real, FIX2INT (w), FIX2INT (h));
365
366         return Qnil;
367 }
368
369 /*
370  * call-seq:
371  *  ee.title => string
372  *
373  * Returns the title of <i>ee</i>.
374  */
375 static VALUE c_title_get (VALUE self)
376 {
377         const char *tmp;
378
379         GET_OBJ (self, RbEcoreEvas, ee);
380
381         if (!(tmp = ecore_evas_title_get (ee->real)))
382                 return Qnil;
383         else
384                 return rb_str_new2 (tmp);
385 }
386
387 /*
388  * call-seq:
389  *  ee.title(string)
390  *
391  * Sets the title of <i>ee</i>.
392  */
393 static VALUE c_title_set (VALUE self, VALUE val)
394 {
395         GET_OBJ (self, RbEcoreEvas, ee);
396
397         Check_Type (val, T_STRING);
398
399         ecore_evas_title_set (ee->real, StringValuePtr (val));
400
401         return Qnil;
402 }
403
404 /*
405  * call-seq:
406  *  ee.borderless? => true or false
407  *
408  * Returns true if <i>ee</i> is borderless, else returns false.
409  */
410 static VALUE c_borderless_get (VALUE self)
411 {
412         GET_OBJ (self, RbEcoreEvas, ee);
413
414         return ecore_evas_borderless_get (ee->real) ? Qtrue : Qfalse;
415 }
416
417 /*
418  * call-seq:
419  *  ee.borderless(true or false)
420  *
421  * Sets whether <i>ee</i> is borderless or not.
422  */
423 static VALUE c_borderless_set (VALUE self, VALUE val)
424 {
425         GET_OBJ (self, RbEcoreEvas, ee);
426
427         CHECK_BOOL (val);
428
429         ecore_evas_borderless_set (ee->real, val == Qtrue);
430
431         return Qnil;
432 }
433
434 /*
435  * call-seq:
436  *  ee.shaped? => true or false
437  *
438  * Returns true if <i>ee</i> is shaped, else returns false.
439  */
440 static VALUE c_shaped_get (VALUE self)
441 {
442         GET_OBJ (self, RbEcoreEvas, ee);
443
444         return ecore_evas_shaped_get (ee->real) ? Qtrue : Qfalse;
445 }
446
447 /*
448  * call-seq:
449  *  ee.shaped(true or false)
450  *
451  * Sets whether <i>ee</i> is shaped or not.
452  */
453 static VALUE c_shaped_set (VALUE self, VALUE val)
454 {
455         GET_OBJ (self, RbEcoreEvas, ee);
456
457         CHECK_BOOL (val);
458
459         ecore_evas_shaped_set (ee->real, val == Qtrue);
460
461         return Qnil;
462 }
463
464 /*
465  * call-seq:
466  *  ee.sticky? => true or false
467  *
468  * Returns true if <i>ee</i> is sticky, else returns false.
469  */
470 static VALUE c_sticky_get (VALUE self)
471 {
472         GET_OBJ (self, RbEcoreEvas, ee);
473
474         return ecore_evas_sticky_get (ee->real) ? Qtrue : Qfalse;
475 }
476
477 /*
478  * call-seq:
479  *  ee.sticky(true or false)
480  *
481  * Sets whether <i>ee</i> is sticky or not.
482  */
483 static VALUE c_sticky_set (VALUE self, VALUE val)
484 {
485         GET_OBJ (self, RbEcoreEvas, ee);
486
487         CHECK_BOOL (val);
488
489         ecore_evas_sticky_set (ee->real, val == Qtrue);
490
491         return Qnil;
492 }
493
494 /*
495  * call-seq:
496  *  ee.rotation => fixnum
497  *
498  * Returns the rotation of <i>ee</i>.
499  */
500 static VALUE c_rotation_get (VALUE self)
501 {
502         GET_OBJ (self, RbEcoreEvas, ee);
503
504         return INT2FIX (ecore_evas_rotation_get (ee->real));
505 }
506
507 /*
508  * call-seq:
509  *  ee.rotation(fixnum)
510  *
511  * Sets the rotation of <i>ee</i>.
512  */
513 static VALUE c_rotation_set (VALUE self, VALUE val)
514 {
515         GET_OBJ (self, RbEcoreEvas, ee);
516
517         Check_Type (val, T_FIXNUM);
518
519         ecore_evas_rotation_set (ee->real, FIX2INT (val));
520
521         return Qnil;
522 }
523
524 static VALUE c_name_class_get (VALUE self)
525 {
526         const char *name = NULL, *klass = NULL;
527
528         GET_OBJ (self, RbEcoreEvas, ee);
529
530         ecore_evas_name_class_get (ee->real, &name, &klass);
531
532         return rb_ary_new3 (2, name ? rb_str_new2 (name) : Qnil,
533                             klass ? rb_str_new2 (klass) : Qnil);
534 }
535
536 static VALUE c_name_class_set (VALUE self, VALUE ary)
537 {
538         VALUE s1, s2;
539
540         GET_OBJ (self, RbEcoreEvas, ee);
541
542         Check_Type (ary, T_ARRAY);
543
544         s1 = rb_ary_shift (ary);
545         s2 = rb_ary_shift (ary);
546
547         StringValue (s1);
548         StringValue (s2);
549
550         ecore_evas_name_class_set (ee->real, StringValuePtr (s1),
551                                    StringValuePtr (s2));
552
553         return Qnil;
554 }
555
556 /*
557  * call-seq:
558  *  ee.iconified? => true or false
559  *
560  * Returns true if <i>ee</i> is iconified, else returns false.
561  */
562 static VALUE c_iconified_get (VALUE self)
563 {
564         GET_OBJ (self, RbEcoreEvas, ee);
565
566         return ecore_evas_iconified_get (ee->real) ? Qtrue : Qfalse;
567 }
568
569 /*
570  * call-seq:
571  *  ee.iconified(true or false)
572  *
573  * Sets whether <i>ee</i> is iconified or not.
574  */
575 static VALUE c_iconified_set (VALUE self, VALUE val)
576 {
577         GET_OBJ (self, RbEcoreEvas, ee);
578
579         CHECK_BOOL (val);
580
581         ecore_evas_iconified_set (ee->real, val == Qtrue);
582
583         return Qnil;
584 }
585
586 /*
587  * call-seq:
588  *  ee.has_alpha? => true or false
589  *
590  * Returns true if <i>ee</i> has an alpha channel, else returns false.
591  */
592 static VALUE c_has_alpha_get (VALUE self)
593 {
594         GET_OBJ (self, RbEcoreEvas, ee);
595
596         return ecore_evas_alpha_get (ee->real) ? Qtrue : Qfalse;
597 }
598
599 /*
600  * call-seq:
601  *  ee.has_alpha(true or false)
602  *
603  * Sets whether <i>ee</i> has an alpha channel or not.
604  */
605 static VALUE c_has_alpha_set (VALUE self, VALUE val)
606 {
607         GET_OBJ (self, RbEcoreEvas, ee);
608
609         CHECK_BOOL (val);
610
611         ecore_evas_alpha_set (ee->real, val == Qtrue);
612
613         return Qnil;
614 }
615
616 /* FIXME: this is unsafe!
617  * :nodoc:
618  */
619 static VALUE c_delete (VALUE self)
620 {
621         GET_OBJ (self, RbEcoreEvas, ee);
622
623         /* reap our children */
624         rb_gc_start ();
625
626         ecore_evas_free (ee->real);
627         ee->real = NULL;
628
629         return Qnil;
630 }
631
632 CALLBACK_DEFINE_HANDLER (resize);
633 CALLBACK_DEFINE_HANDLER (move);
634 CALLBACK_DEFINE_HANDLER (show);
635 CALLBACK_DEFINE_HANDLER (hide);
636 CALLBACK_DEFINE_HANDLER (delete_request);
637 CALLBACK_DEFINE_HANDLER (destroy);
638 CALLBACK_DEFINE_HANDLER (focus_in);
639 CALLBACK_DEFINE_HANDLER (focus_out);
640 CALLBACK_DEFINE_HANDLER (mouse_in);
641 CALLBACK_DEFINE_HANDLER (mouse_out);
642 CALLBACK_DEFINE_HANDLER (pre_render);
643 CALLBACK_DEFINE_HANDLER (post_render);
644
645 /*
646  * call-seq:
647  *  ee.on_resize { block } => nil
648  *
649  * Sets the handler for the resize event.
650  */
651 static VALUE c_on_resize (VALUE self)
652 {
653         CALLBACK_REG_HANDLER (resize);
654 }
655
656 /*
657  * call-seq:
658  *  ee.on_move { block } => nil
659  *
660  * Sets the handler for the move event.
661  */
662 static VALUE c_on_move (VALUE self)
663 {
664         CALLBACK_REG_HANDLER (move);
665 }
666
667 /*
668  * call-seq:
669  *  ee.on_show { block } => nil
670  *
671  * Sets the handler for the show event.
672  */
673 static VALUE c_on_show (VALUE self)
674 {
675         CALLBACK_REG_HANDLER (show);
676 }
677
678 /*
679  * call-seq:
680  *  ee.on_hide { block } => nil
681  *
682  * Sets the handler for the hide event.
683  */
684 static VALUE c_on_hide (VALUE self)
685 {
686         CALLBACK_REG_HANDLER (hide);
687 }
688
689 /*
690  * call-seq:
691  *  ee.on_delete_request { block } => nil
692  *
693  * Sets the handler for the delete request event.
694  */
695 static VALUE c_on_delete_request (VALUE self)
696 {
697         CALLBACK_REG_HANDLER (delete_request);
698 }
699
700 /*
701  * call-seq:
702  *  ee.on_destroy { block } => nil
703  *
704  * Sets the handler for the destroy event.
705  */
706 static VALUE c_on_destroy (VALUE self)
707 {
708         CALLBACK_REG_HANDLER (destroy);
709 }
710
711 /*
712  * call-seq:
713  *  ee.on_focus_in { block } => nil
714  *
715  * Sets the handler for the focus in event.
716  */
717 static VALUE c_on_focus_in (VALUE self)
718 {
719         CALLBACK_REG_HANDLER (focus_in);
720 }
721
722 /*
723  * call-seq:
724  *  ee.on_focus_out { block } => nil
725  *
726  * Sets the handler for the focus out event.
727  */
728 static VALUE c_on_focus_out (VALUE self)
729 {
730         CALLBACK_REG_HANDLER (focus_out);
731 }
732
733 /*
734  * call-seq:
735  *  ee.on_mouse_in { block } => nil
736  *
737  * Sets the handler for the mouse in event.
738  */
739 static VALUE c_on_mouse_in (VALUE self)
740 {
741         CALLBACK_REG_HANDLER (mouse_in);
742 }
743
744 /*
745  * call-seq:
746  *  ee.on_mouse_out { block } => nil
747  *
748  * Sets the handler for the mouse out event.
749  */
750 static VALUE c_on_mouse_out (VALUE self)
751 {
752         CALLBACK_REG_HANDLER (mouse_out);
753 }
754
755 /*
756  * call-seq:
757  *  ee.on_pre_render { block } => nil
758  *
759  * Sets the handler for the pre render event.
760  */
761 static VALUE c_on_pre_render (VALUE self)
762 {
763         CALLBACK_REG_HANDLER (pre_render);
764 }
765
766 /*
767  * call-seq:
768  *  ee.on_post_render { block } => nil
769  *
770  * Sets the handler for the post render event.
771  */
772 static VALUE c_on_post_render (VALUE self)
773 {
774         CALLBACK_REG_HANDLER (post_render);
775 }
776
777 void Init_EcoreEvas (void)
778 {
779         cEcoreEvas = rb_define_class_under (mEvas, "EcoreEvas", rb_cObject);
780
781         rb_define_method (cEcoreEvas, "initialize", c_init, -1);
782         rb_define_method (cEcoreEvas, "inspect", c_inspect, 0);
783         rb_define_method (cEcoreEvas, "delete", c_delete, 0);
784         rb_define_method (cEcoreEvas, "show", c_show, 0);
785         rb_define_method (cEcoreEvas, "hide", c_hide, 0);
786         rb_define_method (cEcoreEvas, "visible?", c_visible_get, 0);
787         rb_define_method (cEcoreEvas, "raise", c_raise, 0);
788         rb_define_method (cEcoreEvas, "lower", c_lower, 0);
789         rb_define_method (cEcoreEvas, "layer", c_layer_get, 0);
790         rb_define_method (cEcoreEvas, "layer=", c_layer_set, 1);
791         rb_define_method (cEcoreEvas, "evas", c_evas_get, 0);
792         rb_define_method (cEcoreEvas, "geometry", c_geometry_get, 0);
793         rb_define_method (cEcoreEvas, "get_size_min", c_get_size_min, 0);
794         rb_define_method (cEcoreEvas, "set_size_min", c_set_size_min, 2);
795         rb_define_method (cEcoreEvas, "get_size_max", c_get_size_max, 0);
796         rb_define_method (cEcoreEvas, "set_size_max", c_set_size_max, 2);
797         rb_define_method (cEcoreEvas, "move", c_move, 2);
798         rb_define_method (cEcoreEvas, "resize", c_resize, 2);
799         rb_define_method (cEcoreEvas, "title", c_title_get, 0);
800         rb_define_method (cEcoreEvas, "title=", c_title_set, 1);
801         rb_define_method (cEcoreEvas, "borderless?", c_borderless_get, 0);
802         rb_define_method (cEcoreEvas, "borderless=", c_borderless_set, 1);
803         rb_define_method (cEcoreEvas, "shaped?", c_shaped_get, 0);
804         rb_define_method (cEcoreEvas, "shaped=", c_shaped_set, 1);
805         rb_define_method (cEcoreEvas, "sticky?", c_sticky_get, 0);
806         rb_define_method (cEcoreEvas, "sticky=", c_sticky_set, 1);
807         rb_define_method (cEcoreEvas, "rotation", c_rotation_get, 0);
808         rb_define_method (cEcoreEvas, "rotation=", c_rotation_set, 1);
809         rb_define_method (cEcoreEvas, "name_class", c_name_class_get, 0);
810         rb_define_method (cEcoreEvas, "name_class=", c_name_class_set, 1);
811         rb_define_method (cEcoreEvas, "iconified?", c_iconified_get, 0);
812         rb_define_method (cEcoreEvas, "iconified=", c_iconified_set, 1);
813         rb_define_method (cEcoreEvas, "has_alpha?", c_has_alpha_get, 0);
814         rb_define_method (cEcoreEvas, "has_alpha=", c_has_alpha_set, 1);
815
816         rb_define_method (cEcoreEvas, "on_resize", c_on_resize, 0);
817         rb_define_method (cEcoreEvas, "on_move", c_on_move, 0);
818         rb_define_method (cEcoreEvas, "on_show", c_on_show, 0);
819         rb_define_method (cEcoreEvas, "on_hide", c_on_hide, 0);
820         rb_define_method (cEcoreEvas, "on_delete_request", c_on_delete_request, 0);
821         rb_define_method (cEcoreEvas, "on_destroy", c_on_destroy, 0);
822         rb_define_method (cEcoreEvas, "on_focus_in", c_on_focus_in, 0);
823         rb_define_method (cEcoreEvas, "on_focus_out", c_on_focus_out, 0);
824         rb_define_method (cEcoreEvas, "on_mouse_in", c_on_mouse_in, 0);
825         rb_define_method (cEcoreEvas, "on_mouse_out", c_on_mouse_out, 0);
826         rb_define_method (cEcoreEvas, "on_pre_render", c_on_pre_render, 0);
827         rb_define_method (cEcoreEvas, "on_post_render", c_on_post_render, 0);
828 }