merged evas image masking code from brett
[framework/uifw/evas.git] / src / lib / canvas / evas_object_main.c
1 #include "evas_common.h"
2 #include "evas_private.h"
3
4 EVAS_MEMPOOL(_mp_obj);
5 EVAS_MEMPOOL(_mp_sh);
6
7 static Eina_Inlist *
8 get_layer_objects(Evas_Layer *l)
9 {
10    if ((!l) || (!l->objects)) return NULL;
11    return (EINA_INLIST_GET(l->objects));
12 }
13
14 /* evas internal stuff */
15 Evas_Object *
16 evas_object_new(Evas *e __UNUSED__)
17 {
18    Evas_Object *obj;
19
20    EVAS_MEMPOOL_INIT(_mp_obj, "evas_object", Evas_Object, 512, NULL);
21    obj = EVAS_MEMPOOL_ALLOC(_mp_obj, Evas_Object);
22    if (!obj) return NULL;
23    EVAS_MEMPOOL_PREP(_mp_obj, obj, Evas_Object);
24    obj->magic = MAGIC_OBJ;
25    obj->cur.scale = 1.0;
26    obj->prev.scale = 1.0;
27    return obj;
28 }
29
30 void
31 evas_object_free(Evas_Object *obj, int clean_layer)
32 {
33    int was_smart_child = 0;
34
35    evas_object_map_set(obj, NULL);
36    evas_object_grabs_cleanup(obj);
37    evas_object_intercept_cleanup(obj);
38    if (obj->smart.parent) was_smart_child = 1;
39    evas_object_smart_cleanup(obj);
40    obj->func->free(obj);
41    if (!was_smart_child) evas_object_release(obj, clean_layer);
42    if (obj->clip.clipees)
43      eina_list_free(obj->clip.clipees);
44    evas_object_clip_changes_clean(obj);
45    evas_object_event_callback_all_del(obj);
46    evas_object_event_callback_cleanup(obj);
47    while (obj->data.elements)
48      {
49         Evas_Data_Node *node;
50
51         node = obj->data.elements->data;
52         obj->data.elements = eina_list_remove(obj->data.elements, node);
53         free(node);
54      }
55    obj->magic = 0;
56    if (obj->size_hints)
57      {
58        EVAS_MEMPOOL_FREE(_mp_sh, obj->size_hints);
59      }
60    EVAS_MEMPOOL_FREE(_mp_obj, obj);
61 }
62
63 void
64 evas_object_change(Evas_Object *obj)
65 {
66    Eina_List *l;
67    Evas_Object *obj2;
68
69    if (obj->layer->evas->nochange)
70      {
71 //        printf("nochange %p\n", obj);
72         return;
73      }
74 //   else
75 //      printf("ch %p\n", obj);
76    obj->layer->evas->changed = 1;
77    if (obj->changed) return;
78 //   obj->changed = 1;
79    evas_render_object_recalc(obj);
80    /* set changed flag on all objects this one clips too */
81    EINA_LIST_FOREACH(obj->clip.clipees, l, obj2) evas_object_change(obj2);
82    if (obj->smart.parent) evas_object_change(obj->smart.parent);
83 }
84
85 void
86 evas_object_render_pre_visible_change(Eina_Array *rects, Evas_Object *obj, int is_v, int was_v)
87 {
88    if (obj->smart.smart) return ;
89    if (is_v == was_v) return ;
90    if (is_v)
91      {
92         evas_add_rect(rects,
93                       obj->cur.cache.clip.x,
94                       obj->cur.cache.clip.y,
95                       obj->cur.cache.clip.w,
96                       obj->cur.cache.clip.h);
97      }
98    else
99      {
100         evas_add_rect(rects,
101                       obj->prev.cache.clip.x,
102                       obj->prev.cache.clip.y,
103                       obj->prev.cache.clip.w,
104                       obj->prev.cache.clip.h);
105      }
106 }
107
108 void
109 evas_object_render_pre_clipper_change(Eina_Array *rects, Evas_Object *obj)
110 {
111    if (obj->smart.smart) return ;
112    if (obj->cur.clipper == obj->prev.clipper) return ;
113    if ((obj->cur.clipper) && (obj->prev.clipper))
114      {
115         /* get difference rects between clippers */
116         evas_rects_return_difference_rects(rects,
117                                            obj->cur.clipper->cur.cache.clip.x,
118                                            obj->cur.clipper->cur.cache.clip.y,
119                                            obj->cur.clipper->cur.cache.clip.w,
120                                            obj->cur.clipper->cur.cache.clip.h,
121                                            obj->prev.clipper->prev.cache.clip.x,
122                                            obj->prev.clipper->prev.cache.clip.y,
123                                            obj->prev.clipper->prev.cache.clip.w,
124                                            obj->prev.clipper->prev.cache.clip.h);
125      }
126    else if (obj->cur.clipper)
127      {
128         evas_rects_return_difference_rects(rects,
129                                            obj->cur.geometry.x,
130                                            obj->cur.geometry.y,
131                                            obj->cur.geometry.w,
132                                            obj->cur.geometry.h,
133 ////    rl = evas_rects_return_difference_rects(obj->cur.cache.geometry.x,
134 ////                                            obj->cur.cache.geometry.y,
135 ////                                            obj->cur.cache.geometry.w,
136 ////                                            obj->cur.cache.geometry.h,
137                                            obj->cur.clipper->cur.cache.clip.x,
138                                            obj->cur.clipper->cur.cache.clip.y,
139                                            obj->cur.clipper->cur.cache.clip.w,
140                                            obj->cur.clipper->cur.cache.clip.h);
141      }
142    else if (obj->prev.clipper)
143      {
144         evas_rects_return_difference_rects(rects,
145                                            obj->prev.geometry.x,
146                                            obj->prev.geometry.y,
147                                            obj->prev.geometry.w,
148                                            obj->prev.geometry.h,
149 ////    rl = evas_rects_return_difference_rects(obj->prev.cache.geometry.x,
150 ////                                            obj->prev.cache.geometry.y,
151 ////                                            obj->prev.cache.geometry.w,
152 ////                                            obj->prev.cache.geometry.h,
153                                            obj->prev.clipper->prev.cache.clip.x,
154                                            obj->prev.clipper->prev.cache.clip.y,
155                                            obj->prev.clipper->prev.cache.clip.w,
156                                            obj->prev.clipper->prev.cache.clip.h);
157      }
158 }
159
160 void
161 evas_object_render_pre_prev_cur_add(Eina_Array *rects, Evas_Object *obj)
162 {
163    evas_add_rect(rects,
164                  obj->cur.cache.clip.x,
165                  obj->cur.cache.clip.y,
166                  obj->cur.cache.clip.w,
167                  obj->cur.cache.clip.h);
168    evas_add_rect(rects,
169                  obj->prev.cache.clip.x,
170                  obj->prev.cache.clip.y,
171                  obj->prev.cache.clip.w,
172                  obj->prev.cache.clip.h);
173 /*        
174         evas_add_rect(rects,
175                       obj->cur.geometry.x,
176                       obj->cur.geometry.y,
177                       obj->cur.geometry.w,
178                       obj->cur.geometry.h);
179 ////        obj->cur.cache.geometry.x,
180 ////        obj->cur.cache.geometry.y,
181 ////        obj->cur.cache.geometry.w,
182 ////        obj->cur.cache.geometry.h);
183         evas_add_rect(rects,
184                       obj->prev.geometry.x,
185                       obj->prev.geometry.y,
186                       obj->prev.geometry.w,
187                       obj->prev.geometry.h);
188 ////        obj->prev.cache.geometry.x,
189 ////        obj->prev.cache.geometry.y,
190 ////        obj->prev.cache.geometry.w,
191 ////        obj->prev.cache.geometry.h);
192 */
193 }
194
195 void
196 evas_object_clip_changes_clean(Evas_Object *obj)
197 {
198    Eina_Rectangle *r;
199
200    EINA_LIST_FREE(obj->clip.changes, r) eina_rectangle_free(r);
201 }
202
203 void
204 evas_object_render_pre_effect_updates(Eina_Array *rects, Evas_Object *obj, int is_v, int was_v)
205 {
206    Eina_Rectangle *r;
207    Evas_Object *clipper;
208    Eina_List *l;
209    unsigned int i;
210    Eina_Array_Iterator it;
211    int x, y, w, h;
212
213    if (obj->smart.smart) goto end;
214    /* FIXME: was_v isn't used... why? */
215    was_v = 0;
216    if (!obj->clip.clipees)
217      {
218         EINA_ARRAY_ITER_NEXT(rects, i, r, it)
219           {
220              /* get updates and clip to current clip */
221              x = r->x;
222              y = r->y;
223              w = r->w;
224              h = r->h;
225              RECTS_CLIP_TO_RECT(x, y, w, h,
226                                 obj->cur.cache.clip.x,
227                                 obj->cur.cache.clip.y,
228                                 obj->cur.cache.clip.w,
229                                 obj->cur.cache.clip.h);
230              if ((w > 0) && (h > 0))
231                obj->layer->evas->engine.func->output_redraws_rect_add(obj->layer->evas->engine.data.output,
232                                                                       x, y, w, h);
233              /* get updates and clip to previous clip */
234              x = r->x;
235              y = r->y;
236              w = r->w;
237              h = r->h;
238              RECTS_CLIP_TO_RECT(x, y, w, h,
239                                 obj->prev.cache.clip.x,
240                                 obj->prev.cache.clip.y,
241                                 obj->prev.cache.clip.w,
242                                 obj->prev.cache.clip.h);
243              if ((w > 0) && (h > 0))
244                obj->layer->evas->engine.func->output_redraws_rect_add(obj->layer->evas->engine.data.output,
245                                                                       x, y, w, h);
246           }
247         /* if the object is actually visible, take any parent clip changes */
248         if (is_v)
249           {
250              clipper = obj->cur.clipper;
251              while (clipper)
252                {
253                   EINA_LIST_FOREACH(clipper->clip.changes, l, r)
254                     {
255                        /* get updates and clip to current clip */
256                        x = r->x; y = r->y; w = r->w; h = r->h;
257                        RECTS_CLIP_TO_RECT(x, y, w, h,
258                                           obj->cur.cache.clip.x,
259                                           obj->cur.cache.clip.y,
260                                           obj->cur.cache.clip.w,
261                                           obj->cur.cache.clip.h);
262                        if ((w > 0) && (h > 0))
263                          obj->layer->evas->engine.func->output_redraws_rect_add(obj->layer->evas->engine.data.output,
264                                                                                 x, y, w, h);
265                        /* get updates and clip to previous clip */
266                        x = r->x; y = r->y; w = r->w; h = r->h;
267                        RECTS_CLIP_TO_RECT(x, y, w, h,
268                                           obj->prev.cache.clip.x,
269                                           obj->prev.cache.clip.y,
270                                           obj->prev.cache.clip.w,
271                                           obj->prev.cache.clip.h);
272                        if ((w > 0) && (h > 0))
273                          obj->layer->evas->engine.func->output_redraws_rect_add(obj->layer->evas->engine.data.output,
274                                                                                 x, y, w, h);
275                     }
276                   clipper = clipper->cur.clipper;
277                }
278           }
279      }
280    else
281      {
282         evas_object_clip_changes_clean(obj);
283         EINA_ARRAY_ITER_NEXT(rects, i, r, it)
284           obj->clip.changes = eina_list_append(obj->clip.changes, r);
285         eina_array_clean(rects);
286      }
287
288  end:
289    EINA_ARRAY_ITER_NEXT(rects, i, r, it)
290      eina_rectangle_free(r);
291    eina_array_clean(rects);
292 }
293
294 int
295 evas_object_was_in_output_rect(Evas_Object *obj, int x, int y, int w, int h)
296 {
297    if (obj->smart.smart) return 0;
298    /* assumes coords have been recalced */
299    if ((RECTS_INTERSECT(x, y, w, h,
300                         obj->prev.cache.clip.x,
301                         obj->prev.cache.clip.y,
302                         obj->prev.cache.clip.w,
303                         obj->prev.cache.clip.h)))
304      return 1;
305    return 0;
306 }
307
308 int
309 evas_object_was_opaque(Evas_Object *obj)
310 {
311    if (obj->smart.smart) return 0;
312    if (obj->prev.cache.clip.a == 255)
313      {
314         if (obj->func->was_opaque)
315           return obj->func->was_opaque(obj);
316         return 1;
317      }
318    return 0;
319 }
320
321 int
322 evas_object_is_inside(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
323 {
324    if (obj->smart.smart) return 0;
325    if (obj->func->is_inside)
326      return obj->func->is_inside(obj, x, y);
327    return 0;
328 }
329
330 int
331 evas_object_was_inside(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
332 {
333    if (obj->smart.smart) return 0;
334    if (obj->func->was_inside)
335      return obj->func->was_inside(obj, x, y);
336    return 0;
337 }
338 /* routines apps will call */
339
340 /**
341  * Deletes the given evas object and frees its memory.
342  *
343  * The object's 'free' callback is called when this function is called.
344  * If the object currently has the focus, its 'focus out' callback is
345  * also called.
346  *
347  * @param   obj The given evas object.
348  * @ingroup Evas_Object_Group_Basic
349  */
350 EAPI void
351 evas_object_del(Evas_Object *obj)
352 {
353    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
354    return;
355    MAGIC_CHECK_END();
356
357    if (obj->delete_me) return;
358
359 #ifdef EVAS_FRAME_QUEUING
360    evas_common_frameq_flush();
361 #endif
362
363    _evas_object_event_new();
364
365    evas_object_event_callback_call(obj, EVAS_CALLBACK_DEL, NULL);
366    _evas_post_event_callback_call(obj->layer->evas);
367    if (obj->name) evas_object_name_set(obj, NULL);
368    if (!obj->layer)
369      {
370         evas_object_free(obj, 1);
371         return;
372      }
373    if (obj->focused)
374      {
375         obj->focused = 0;
376         obj->layer->evas->focused = NULL;
377         _evas_object_event_new();
378         evas_object_event_callback_call(obj, EVAS_CALLBACK_FOCUS_OUT, NULL);
379         _evas_post_event_callback_call(obj->layer->evas);
380      }
381    obj->layer->evas->pointer.mouse_grabbed -= obj->mouse_grabbed;
382    obj->mouse_grabbed = 0;
383    obj->mouse_in = 0;
384    evas_object_hide(obj);
385    evas_object_grabs_cleanup(obj);
386    while (obj->clip.clipees) evas_object_clip_unset(obj->clip.clipees->data);
387    while (obj->proxy.proxies)
388            evas_object_image_source_unset(obj->proxy.proxies->data);
389    if (obj->cur.clipper) evas_object_clip_unset(obj);
390    if (obj->smart.smart) evas_object_smart_del(obj);
391    evas_object_map_set(obj, NULL);
392    _evas_object_event_new();
393    evas_object_event_callback_call(obj, EVAS_CALLBACK_FREE, NULL);
394    _evas_post_event_callback_call(obj->layer->evas);
395    evas_object_smart_cleanup(obj);
396    obj->delete_me = 1;
397    evas_object_change(obj);
398 }
399
400 /**
401  * Moves the given evas object to the given location.
402  * @param   obj The given evas object.
403  * @param   x   X position to move the object to, in canvas units.
404  * @param   y   Y position to move the object to, in canvas units.
405  * @ingroup Evas_Object_Group_Basic
406  */
407 EAPI void
408 evas_object_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
409 {
410    int is, was = 0, pass = 0;
411
412    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
413    return;
414    MAGIC_CHECK_END();
415    if (obj->delete_me) return;
416    if (evas_object_intercept_call_move(obj, x, y)) return;
417    if (obj->doing.in_move > 0)
418      {
419         WRN("evas_object_move() called on object %p when in the middle of moving the same object", obj);
420         return;
421      }
422    if ((obj->cur.geometry.x == x) && (obj->cur.geometry.y == y)) return;
423    if (obj->layer->evas->events_frozen <= 0)
424      {
425         pass = evas_event_passes_through(obj);
426         if (!pass)
427           was = evas_object_is_in_output_rect(obj,
428                                               obj->layer->evas->pointer.x,
429                                               obj->layer->evas->pointer.y, 1, 1);
430      }
431    obj->doing.in_move++;
432    if (obj->smart.smart)
433      {
434        if (obj->smart.smart->smart_class->move)
435           obj->smart.smart->smart_class->move(obj, x, y);
436      }
437    obj->cur.geometry.x = x;
438    obj->cur.geometry.y = y;
439 ////   obj->cur.cache.geometry.validity = 0;
440    evas_object_change(obj);
441    evas_object_clip_dirty(obj);
442    obj->doing.in_move--;
443    if (obj->layer->evas->events_frozen <= 0)
444      {
445         evas_object_recalc_clippees(obj);
446         if (!pass)
447           {
448              if (!obj->smart.smart)
449                {
450                   is = evas_object_is_in_output_rect(obj,
451                                                      obj->layer->evas->pointer.x,
452                                                      obj->layer->evas->pointer.y, 1, 1);
453                   if ((is ^ was) && obj->cur.visible)
454                     evas_event_feed_mouse_move(obj->layer->evas,
455                                                obj->layer->evas->pointer.x,
456                                                obj->layer->evas->pointer.y,
457                                                obj->layer->evas->last_timestamp,
458                                                NULL);
459                }
460           }
461      }
462    evas_object_inform_call_move(obj);
463 }
464
465 /**
466  * Changes the size of the given evas object.
467  * @param   obj The given evas object.
468  * @param   w   The new width of the evas object.
469  * @param   h   The new height of the evas object.
470  *
471  * @note Be aware that resizing an object changes its drawing area,
472  *       but that does imply the object is rescaled! For instance,
473  *       images are filled inside their drawing area using the
474  *       specifications of evas_object_image_fill_set(), thus to scale
475  *       the image to match exactly your drawing area, you need to
476  *       change the evas_object_image_fill_set() as well. Consider the
477  *       following example:
478  *       @code
479  *       // rescale image to fill exactly its area without tiling:
480  *       evas_object_resize(img, w, h);
481  *       evas_object_image_fill_set(img, 0, 0, w, h);
482  *       @endcode
483  *       This is more evident in images, but text, textblock, lines
484  *       and polygons will behave similarly. Check their specific APIs
485  *       to know how to achieve your desired behavior.
486  *
487  * @ingroup Evas_Object_Group_Basic
488  */
489 EAPI void
490 evas_object_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
491 {
492    int is, was = 0, pass = 0;
493
494    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
495    return;
496    MAGIC_CHECK_END();
497    if (obj->delete_me) return;
498    if (w < 0) w = 0; if (h < 0) h = 0;
499    if (evas_object_intercept_call_resize(obj, w, h)) return;
500    if (obj->doing.in_resize > 0)
501      {
502         WRN("evas_object_resize() called on object %p when in the middle of resizing the same object", obj);
503         return;
504      }
505    if ((obj->cur.geometry.w == w) && (obj->cur.geometry.h == h)) return;
506    if (obj->layer->evas->events_frozen <= 0)
507      {
508         pass = evas_event_passes_through(obj);
509         if (!pass)
510           was = evas_object_is_in_output_rect(obj,
511                                               obj->layer->evas->pointer.x,
512                                               obj->layer->evas->pointer.y, 1, 1);
513      }
514    obj->doing.in_resize++;
515    if (obj->smart.smart)
516      {
517        if (obj->smart.smart->smart_class->resize)
518           obj->smart.smart->smart_class->resize(obj, w, h);
519      }
520    obj->cur.geometry.w = w;
521    obj->cur.geometry.h = h;
522 ////   obj->cur.cache.geometry.validity = 0;
523    evas_object_change(obj);
524    evas_object_clip_dirty(obj);
525    obj->doing.in_resize--;
526    /* NB: evas_object_recalc_clippees was here previously ( < 08/07/2009) */
527    if (obj->layer->evas->events_frozen <= 0)
528      {
529         /* NB: If this creates glitches on screen then move to above position */
530         evas_object_recalc_clippees(obj);
531
532         //   if (obj->func->coords_recalc) obj->func->coords_recalc(obj);
533         if (!pass)
534           {
535              if (!obj->smart.smart)
536                {
537                   is = evas_object_is_in_output_rect(obj,
538                                                      obj->layer->evas->pointer.x,
539                                                      obj->layer->evas->pointer.y, 1, 1);
540                   if ((is ^ was) && (obj->cur.visible))
541                     evas_event_feed_mouse_move(obj->layer->evas,
542                                                obj->layer->evas->pointer.x,
543                                                obj->layer->evas->pointer.y,
544                                                obj->layer->evas->last_timestamp,
545                                                NULL);
546                }
547           }
548      }
549    evas_object_inform_call_resize(obj);
550 }
551
552 /**
553  * Retrieves the position and rectangular size of the given evas object.
554  *
555  * Note that if any of @p x, @p y, @p w or @p h are @c NULL, the @c NULL
556  * parameters are ignored.
557  *
558  * @param obj The given evas object.
559  * @param   x   Pointer to an integer in which to store the X coordinate of
560  *              the object.
561  * @param   y   Pointer to an integer in which to store the Y coordinate of
562  *              the object.
563  * @param   w   Pointer to an integer in which to store the width of the
564  *              object.
565  * @param   h   Pointer to an integer in which to store the height of the
566  *              object.
567  * @ingroup Evas_Object_Group_Basic
568  */
569 EAPI void
570 evas_object_geometry_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
571 {
572    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
573    if (x) *x = 0; if (y) *y = 0; if (w) *w = 0; if (h) *h = 0;
574    return;
575    MAGIC_CHECK_END();
576    if (obj->delete_me)
577      {
578         if (x) *x = 0; if (y) *y = 0; if (w) *w = 0; if (h) *h = 0;
579         return;
580      }
581    if (x) *x = obj->cur.geometry.x;
582    if (y) *y = obj->cur.geometry.y;
583    if (w) *w = obj->cur.geometry.w;
584    if (h) *h = obj->cur.geometry.h;
585 }
586
587 /**
588  * @addtogroup Evas_Object_Group_Size_Hints
589  * @{
590  */
591
592 static void
593 _evas_object_size_hint_alloc(Evas_Object *obj)
594 {
595    if (obj->size_hints) return;
596
597    EVAS_MEMPOOL_INIT(_mp_sh, "evas_size_hints", Evas_Size_Hints, 512, );
598    obj->size_hints = EVAS_MEMPOOL_ALLOC(_mp_sh, Evas_Size_Hints);
599    if (!obj->size_hints) return;
600    EVAS_MEMPOOL_PREP(_mp_sh, obj->size_hints, Evas_Size_Hints);
601    obj->size_hints->max.w = -1;
602    obj->size_hints->max.h = -1;
603    obj->size_hints->align.x = 0.5;
604    obj->size_hints->align.y = 0.5;
605 }
606
607 /**
608  * Retrieves the size hint for the minimum size.
609  *
610  * This is not a size enforcement in any way, it's just a hint that should
611  * be used whenever appropriate.
612  *
613  * Note that if any of @p w or @p h are @c NULL, the @c NULL
614  * parameters are ignored.
615  *
616  * @param obj The given evas object.
617  * @param   w Pointer to an integer in which to store the minimum width.
618  * @param   h Pointer to an integer in which to store the minimum height.
619  */
620 EAPI void
621 evas_object_size_hint_min_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
622 {
623    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
624    if (w) *w = 0; if (h) *h = 0;
625    return;
626    MAGIC_CHECK_END();
627    if ((!obj->size_hints) || obj->delete_me)
628      {
629         if (w) *w = 0; if (h) *h = 0;
630         return;
631      }
632    if (w) *w = obj->size_hints->min.w;
633    if (h) *h = obj->size_hints->min.h;
634 }
635
636 /**
637  * Sets the size hint for the minimum size.
638  *
639  * This is not a size enforcement in any way, it's just a hint that should
640  * be used whenever appropriate.
641  *
642  * Value 0 is considered unset.
643  *
644  * @param obj The given evas object.
645  * @param   w Integer to use as the minimum width hint.
646  * @param   h Integer to use as the minimum height hint.
647  */
648 EAPI void
649 evas_object_size_hint_min_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
650 {
651    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
652    return;
653    MAGIC_CHECK_END();
654    if (obj->delete_me)
655      return;
656    _evas_object_size_hint_alloc(obj);
657    if ((obj->size_hints->min.w == w) && (obj->size_hints->min.h == h)) return;
658    obj->size_hints->min.w = w;
659    obj->size_hints->min.h = h;
660
661    evas_object_inform_call_changed_size_hints(obj);
662 }
663
664 /**
665  * Retrieves the size hint for the maximum size.
666  *
667  * This is not a size enforcement in any way, it's just a hint that should
668  * be used whenever appropriate.
669  *
670  * Note that if any of @p w or @p h are @c NULL, the @c NULL
671  * parameters are ignored.
672  *
673  * @param obj The given evas object.
674  * @param   w Pointer to an integer in which to store the maximum width.
675  * @param   h Pointer to an integer in which to store the maximum height.
676  */
677 EAPI void
678 evas_object_size_hint_max_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
679 {
680    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
681    if (w) *w = -1; if (h) *h = -1;
682    return;
683    MAGIC_CHECK_END();
684    if ((!obj->size_hints) || obj->delete_me)
685      {
686         if (w) *w = -1; if (h) *h = -1;
687         return;
688      }
689    if (w) *w = obj->size_hints->max.w;
690    if (h) *h = obj->size_hints->max.h;
691 }
692
693 /**
694  * Sets the size hint for the maximum size.
695  *
696  * This is not a size enforcement in any way, it's just a hint that should
697  * be used whenever appropriate.
698  *
699  * Value -1 is considered unset.
700  *
701  * @param obj The given evas object.
702  * @param   w Integer to use as the maximum width hint.
703  * @param   h Integer to use as the maximum height hint.
704  */
705 EAPI void
706 evas_object_size_hint_max_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
707 {
708    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
709    return;
710    MAGIC_CHECK_END();
711    if (obj->delete_me)
712      return;
713    _evas_object_size_hint_alloc(obj);
714    if ((obj->size_hints->max.w == w) && (obj->size_hints->max.h == h)) return;
715    obj->size_hints->max.w = w;
716    obj->size_hints->max.h = h;
717
718    evas_object_inform_call_changed_size_hints(obj);
719 }
720
721 /**
722  * Retrieves the size request hint.
723  *
724  * This is not a size enforcement in any way, it's just a hint that should
725  * be used whenever appropriate.
726  *
727  * Note that if any of @p w or @p h are @c NULL, the @c NULL
728  * parameters are ignored.
729  *
730  * @param obj The given evas object.
731  * @param   w Pointer to an integer in which to store the requested width.
732  * @param   h Pointer to an integer in which to store the requested height.
733  */
734 EAPI void
735 evas_object_size_hint_request_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
736 {
737    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
738    if (w) *w = 0; if (h) *h = 0;
739    return;
740    MAGIC_CHECK_END();
741    if ((!obj->size_hints) || obj->delete_me)
742      {
743         if (w) *w = 0; if (h) *h = 0;
744         return;
745      }
746    if (w) *w = obj->size_hints->request.w;
747    if (h) *h = obj->size_hints->request.h;
748 }
749
750 /**
751  * Sets the requested size hint.
752  *
753  * This is not a size enforcement in any way, it's just a hint that should
754  * be used whenever appropriate.
755  *
756  * Value 0 is considered unset.
757  *
758  * @param obj The given evas object.
759  * @param   w Integer to use as the preferred width hint.
760  * @param   h Integer to use as the preferred height hint.
761  */
762 EAPI void
763 evas_object_size_hint_request_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
764 {
765    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
766    return;
767    MAGIC_CHECK_END();
768    if (obj->delete_me)
769      return;
770    _evas_object_size_hint_alloc(obj);
771    if ((obj->size_hints->request.w == w) && (obj->size_hints->request.h == h)) return;
772    obj->size_hints->request.w = w;
773    obj->size_hints->request.h = h;
774
775    evas_object_inform_call_changed_size_hints(obj);
776 }
777
778 /**
779  * Retrieves the size aspect control hint.
780  *
781  * This is not a size enforcement in any way, it's just a hint that should
782  * be used whenever appropriate.
783  *
784  * Note that if any of @p aspect, @p w or @p h are @c NULL, the @c NULL
785  * parameters are ignored.
786  *
787  * @param    obj The given evas object.
788  * @param aspect Returns the hint on how size should be calculated.
789  * @param      w Pointer to an integer in which to store the aspect width.
790  * @param      h Pointer to an integer in which to store the aspect height.
791  */
792 EAPI void
793 evas_object_size_hint_aspect_get(const Evas_Object *obj, Evas_Aspect_Control *aspect, Evas_Coord *w, Evas_Coord *h)
794 {
795    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
796    if (aspect) *aspect = EVAS_ASPECT_CONTROL_NONE;
797    if (w) *w = 0; if (h) *h = 0;
798    return;
799    MAGIC_CHECK_END();
800    if ((!obj->size_hints) || obj->delete_me)
801      {
802         if (aspect) *aspect = EVAS_ASPECT_CONTROL_NONE;
803         if (w) *w = 0; if (h) *h = 0;
804         return;
805      }
806    if (aspect) *aspect = obj->size_hints->aspect.mode;
807    if (w) *w = obj->size_hints->aspect.size.w;
808    if (h) *h = obj->size_hints->aspect.size.h;
809 }
810
811 /**
812  * Sets the size aspect control hint.
813  *
814  * This is not a size enforcement in any way, it's just a hint that should
815  * be used whenever appropriate.
816  *
817  * @param    obj The given evas object.
818  * @param aspect Hint on how to calculate size.
819  * @param      w Integer to use as aspect width hint.
820  * @param      h Integer to use as aspect height hint.
821  */
822 EAPI void
823 evas_object_size_hint_aspect_set(Evas_Object *obj, Evas_Aspect_Control aspect, Evas_Coord w, Evas_Coord h)
824 {
825    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
826    return;
827    MAGIC_CHECK_END();
828    if (obj->delete_me)
829      return;
830    _evas_object_size_hint_alloc(obj);
831    if ((obj->size_hints->aspect.mode == aspect) && (obj->size_hints->aspect.size.w == w) && (obj->size_hints->aspect.size.h == h)) return;
832    obj->size_hints->aspect.mode = aspect;
833    obj->size_hints->aspect.size.w = w;
834    obj->size_hints->aspect.size.h = h;
835
836    evas_object_inform_call_changed_size_hints(obj);
837 }
838
839 /**
840  * Retrieves the size align control hint.
841  *
842  * This is not a size enforcement in any way, it's just a hint that should
843  * be used whenever appropriate.
844  *
845  * Note that if any of @p x or @p y are @c NULL, the @c NULL
846  * parameters are ignored.
847  *
848  * @param    obj The given evas object.
849  * @param      x Pointer to a double in which to store the align x.
850  * @param      y Pointer to a double in which to store the align y.
851  */
852 EAPI void
853 evas_object_size_hint_align_get(const Evas_Object *obj, double *x, double *y)
854 {
855    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
856    if (x) *x = 0.5; if (y) *y = 0.5;
857    return;
858    MAGIC_CHECK_END();
859    if ((!obj->size_hints) || obj->delete_me)
860      {
861         if (x) *x = 0.5; if (y) *y = 0.5;
862         return;
863      }
864    if (x) *x = obj->size_hints->align.x;
865    if (y) *y = obj->size_hints->align.y;
866 }
867
868 /**
869  * Sets the size align control hint.
870  *
871  * This is not a size enforcement in any way, it's just a hint that should
872  * be used whenever appropriate.
873  *
874  * Accepted values are in the 0.0 to 1.0 range, with the special value
875  * -1.0 used to specify "justify" or "fill" by some users. See
876  * documentation of possible users.
877  *
878  * @param    obj The given evas object.
879  * @param      x Double (0.0..1.0 or -1.0) to use as align x hint.
880  * @param      y Double (0.0..1.0 or -1.0) to use as align y hint.
881  */
882 EAPI void
883 evas_object_size_hint_align_set(Evas_Object *obj, double x, double y)
884 {
885    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
886    return;
887    MAGIC_CHECK_END();
888    if (obj->delete_me)
889      return;
890    _evas_object_size_hint_alloc(obj);
891    if ((obj->size_hints->align.x == x) && (obj->size_hints->align.y == y)) return;
892    obj->size_hints->align.x = x;
893    obj->size_hints->align.y = y;
894
895    evas_object_inform_call_changed_size_hints(obj);
896 }
897
898 /**
899  * Retrieves the size weight control hint.
900  *
901  * This is not a size enforcement in any way, it's just a hint that should
902  * be used whenever appropriate.
903  *
904  * Note that if any of @p x or @p y are @c NULL, the @c NULL
905  * parameters are ignored.
906  *
907  * Accepted values are zero or positive values. Some users might use
908  * this hint as a boolean, but some might consider it as a proportion,
909  * see documentation of possible users.
910  *
911  * @param    obj The given evas object.
912  * @param      x Pointer to a double in which to store the weight x.
913  * @param      y Pointer to a double in which to store the weight y.
914  */
915 EAPI void
916 evas_object_size_hint_weight_get(const Evas_Object *obj, double *x, double *y)
917 {
918    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
919    if (x) *x = 0.0; if (y) *y = 0.0;
920    return;
921    MAGIC_CHECK_END();
922    if ((!obj->size_hints) || obj->delete_me)
923      {
924         if (x) *x = 0.0; if (y) *y = 0.0;
925         return;
926      }
927    if (x) *x = obj->size_hints->weight.x;
928    if (y) *y = obj->size_hints->weight.y;
929 }
930
931 /**
932  * Sets the size weight control hint.
933  *
934  * This is not a size enforcement in any way, it's just a hint that should
935  * be used whenever appropriate.
936  *
937  * @param    obj The given evas object.
938  * @param      x Double (0.0-1.0) to use as weight x hint.
939  * @param      y Double (0.0-1.0) to use as weight y hint.
940  */
941 EAPI void
942 evas_object_size_hint_weight_set(Evas_Object *obj, double x, double y)
943 {
944    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
945    return;
946    MAGIC_CHECK_END();
947    if (obj->delete_me)
948      return;
949    _evas_object_size_hint_alloc(obj);
950    if ((obj->size_hints->weight.x == x) && (obj->size_hints->weight.y == y)) return;
951    obj->size_hints->weight.x = x;
952    obj->size_hints->weight.y = y;
953
954    evas_object_inform_call_changed_size_hints(obj);
955 }
956
957 /**
958  * Retrieves the size padding control hint.
959  *
960  * This is not a size enforcement in any way, it's just a hint that should
961  * be used whenever appropriate.
962  *
963  * Note that if any of @p l, @p r, @p t or @p b are @c NULL, the @c
964  * NULL parameters are ignored.
965  *
966  * @param    obj The given evas object.
967  * @param      l Pointer to an integer in which to store left padding.
968  * @param      r Pointer to an integer in which to store right padding.
969  * @param      t Pointer to an integer in which to store top padding.
970  * @param      b Pointer to an integer in which to store bottom padding.
971  */
972 EAPI void
973 evas_object_size_hint_padding_get(const Evas_Object *obj, Evas_Coord *l, Evas_Coord *r, Evas_Coord *t, Evas_Coord *b)
974 {
975    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
976    if (l) *l = 0; if (r) *r = 0;
977    if (t) *t = 0; if (b) *b = 0;
978    return;
979    MAGIC_CHECK_END();
980    if ((!obj->size_hints) || obj->delete_me)
981      {
982         if (l) *l = 0; if (r) *r = 0;
983         if (t) *t = 0; if (b) *b = 0;
984         return;
985      }
986    if (l) *l = obj->size_hints->padding.l;
987    if (r) *r = obj->size_hints->padding.r;
988    if (t) *t = obj->size_hints->padding.t;
989    if (b) *b = obj->size_hints->padding.b;
990 }
991
992 /**
993  * Sets the size padding control hint.
994  *
995  * This is not a size enforcement in any way, it's just a hint that should
996  * be used whenever appropriate.
997  *
998  * @param    obj The given evas object.
999  * @param      l Integer to specify left padding.
1000  * @param      r Integer to specify right padding.
1001  * @param      t Integer to specify top padding.
1002  * @param      b Integer to specify bottom padding.
1003  */
1004 EAPI void
1005 evas_object_size_hint_padding_set(Evas_Object *obj, Evas_Coord l, Evas_Coord r, Evas_Coord t, Evas_Coord b)
1006 {
1007    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1008    return;
1009    MAGIC_CHECK_END();
1010    if (obj->delete_me)
1011      return;
1012    _evas_object_size_hint_alloc(obj);
1013    if ((obj->size_hints->padding.l == l) && (obj->size_hints->padding.r == r) && (obj->size_hints->padding.t == t) && (obj->size_hints->padding.b == b)) return;
1014    obj->size_hints->padding.l = l;
1015    obj->size_hints->padding.r = r;
1016    obj->size_hints->padding.t = t;
1017    obj->size_hints->padding.b = b;
1018
1019    evas_object_inform_call_changed_size_hints(obj);
1020 }
1021
1022
1023 /**
1024  * @}
1025  */
1026
1027 /**
1028  * Makes the given evas object visible.
1029  * @param   obj The given evas object.
1030  * @ingroup Evas_Object_Group_Basic
1031  */
1032 EAPI void
1033 evas_object_show(Evas_Object *obj)
1034 {
1035    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1036    return;
1037    MAGIC_CHECK_END();
1038    if (obj->delete_me) return;
1039    if (evas_object_intercept_call_show(obj)) return;
1040    if (obj->smart.smart)
1041      {
1042        if (obj->smart.smart->smart_class->show)
1043           obj->smart.smart->smart_class->show(obj);
1044      }
1045    if (obj->cur.visible)
1046      {
1047         return;
1048      }
1049    obj->cur.visible = 1;
1050    evas_object_change(obj);
1051    evas_object_clip_dirty(obj);
1052    if (obj->layer->evas->events_frozen <= 0)
1053      {
1054         evas_object_clip_across_clippees_check(obj);
1055         evas_object_recalc_clippees(obj);
1056         if (!evas_event_passes_through(obj))
1057           {
1058              if (!obj->smart.smart)
1059                {
1060                   if (evas_object_is_in_output_rect(obj,
1061                                                     obj->layer->evas->pointer.x,
1062                                                     obj->layer->evas->pointer.y, 1, 1))
1063                     evas_event_feed_mouse_move(obj->layer->evas,
1064                                                obj->layer->evas->pointer.x,
1065                                                obj->layer->evas->pointer.y,
1066                                                obj->layer->evas->last_timestamp,
1067                                                NULL);
1068                }
1069           }
1070      }
1071    evas_object_inform_call_show(obj);
1072 }
1073
1074 /**
1075  * Makes the given evas object invisible.
1076  * @param   obj The given evas object.
1077  *
1078  * @note the hidden objects will not be checked for changes and will
1079  *       not catch events. That is, they are much ligher than an
1080  *       object that is invisible due indirect effects, such as
1081  *       clipped or out-of-viewport.
1082  *
1083  * @ingroup Evas_Object_Group_Basic
1084  */
1085 EAPI void
1086 evas_object_hide(Evas_Object *obj)
1087 {
1088    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1089    return;
1090    MAGIC_CHECK_END();
1091    if (obj->delete_me) return;
1092    if (evas_object_intercept_call_hide(obj)) return;
1093    if (obj->smart.smart)
1094      {
1095        if (obj->smart.smart->smart_class->hide)
1096           obj->smart.smart->smart_class->hide(obj);
1097      }
1098    if (!obj->cur.visible)
1099      {
1100         return;
1101      }
1102    obj->cur.visible = 0;
1103    evas_object_change(obj);
1104    evas_object_clip_dirty(obj);
1105    if (obj->layer->evas->events_frozen <= 0)
1106      {
1107         evas_object_clip_across_clippees_check(obj);
1108         evas_object_recalc_clippees(obj);
1109         if (!evas_event_passes_through(obj))
1110           {
1111              if ((!obj->smart.smart) ||
1112                  ((obj->cur.map) && (obj->cur.map->count == 4) && (obj->cur.usemap)))
1113                {
1114                   if (evas_object_is_in_output_rect(obj,
1115                                                     obj->layer->evas->pointer.x,
1116                                                     obj->layer->evas->pointer.y, 1, 1))
1117                     evas_event_feed_mouse_move(obj->layer->evas,
1118                                                obj->layer->evas->pointer.x,
1119                                                obj->layer->evas->pointer.y,
1120                                                obj->layer->evas->last_timestamp,
1121                                                NULL);
1122                   if (obj->delete_me) return;
1123                   if (obj->mouse_grabbed > 0)
1124                     {
1125 //                     if (obj->layer->evas->pointer.mouse_grabbed >= obj->mouse_grabbed)
1126                          obj->layer->evas->pointer.mouse_grabbed -= obj->mouse_grabbed;
1127                     }
1128                   if ((obj->mouse_in) || (obj->mouse_grabbed > 0))
1129                     {
1130                        obj->layer->evas->pointer.object.in = eina_list_remove(obj->layer->evas->pointer.object.in, obj);
1131                     }
1132                   obj->mouse_grabbed = 0;
1133                   if (obj->layer->evas->events_frozen > 0)
1134                     {
1135                        obj->mouse_in = 0;
1136                        return;
1137                     }
1138                   if (obj->mouse_in)
1139                     {
1140                        Evas_Event_Mouse_Out ev;
1141
1142                        _evas_object_event_new();
1143
1144                        obj->mouse_in = 0;
1145                        ev.buttons = obj->layer->evas->pointer.button;
1146                        ev.output.x = obj->layer->evas->pointer.x;
1147                        ev.output.y = obj->layer->evas->pointer.y;
1148                        ev.canvas.x = obj->layer->evas->pointer.x;
1149                        ev.canvas.y = obj->layer->evas->pointer.y;
1150                        ev.data = NULL;
1151                        ev.modifiers = &(obj->layer->evas->modifiers);
1152                        ev.locks = &(obj->layer->evas->locks);
1153                        ev.timestamp = obj->layer->evas->last_timestamp;
1154                        ev.event_flags = EVAS_EVENT_FLAG_NONE;
1155                        evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_OUT, &ev);
1156                        _evas_post_event_callback_call(obj->layer->evas);
1157                     }
1158                }
1159           }
1160      }
1161    else
1162      {
1163         if ((obj->mouse_in) || (obj->mouse_grabbed > 0))
1164           obj->layer->evas->pointer.object.in = eina_list_remove(obj->layer->evas->pointer.object.in, obj);
1165         obj->mouse_grabbed = 0;
1166         obj->mouse_in = 0;
1167      }
1168    evas_object_inform_call_hide(obj);
1169 }
1170
1171 /**
1172  * Retrieves whether or not the given evas object is visible.
1173  * @param   obj The given evas object.
1174  * @return  @c 1 if the object is visible.  @c 0 otherwise.
1175  * @ingroup Evas_Object_Group_Basic
1176  */
1177 EAPI Eina_Bool
1178 evas_object_visible_get(const Evas_Object *obj)
1179 {
1180    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1181    return 0;
1182    MAGIC_CHECK_END();
1183    if (obj->delete_me) return 0;
1184    return obj->cur.visible;
1185 }
1186
1187 /**
1188  * Sets the general colour of the given evas object to the given colour.
1189  * @param obj The given evas object.
1190  * @param r   The red component of the given colour.
1191  * @param g   The green component of the given colour.
1192  * @param b   The blue component of the given colour.
1193  * @param a   The alpha component of the given colour.
1194  * @ingroup Evas_Object_Group_Basic
1195  */
1196 EAPI void
1197 evas_object_color_set(Evas_Object *obj, int r, int g, int b, int a)
1198 {
1199    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1200    return;
1201    MAGIC_CHECK_END();
1202    if (obj->delete_me) return;
1203    if (r > 255) r = 255; if (r < 0) r = 0;
1204    if (g > 255) g = 255; if (g < 0) g = 0;
1205    if (b > 255) b = 255; if (b < 0) b = 0;
1206    if (a > 255) a = 255; if (a < 0) a = 0;
1207    if (evas_object_intercept_call_color_set(obj, r, g, b, a)) return;
1208    if (obj->smart.smart)
1209      {
1210        if (obj->smart.smart->smart_class->color_set)
1211           obj->smart.smart->smart_class->color_set(obj, r, g, b, a);
1212      }
1213    if ((obj->cur.color.r == r) &&
1214        (obj->cur.color.g == g) &&
1215        (obj->cur.color.b == b) &&
1216        (obj->cur.color.a == a)) return;
1217    obj->cur.color.r = r;
1218    obj->cur.color.g = g;
1219    obj->cur.color.b = b;
1220    evas_object_clip_dirty(obj);
1221    if ((obj->cur.color.a == 0) && (a == 0) && (obj->cur.render_op == EVAS_RENDER_BLEND)) return;
1222    obj->cur.color.a = a;
1223    evas_object_change(obj);
1224 }
1225
1226 /**
1227  * Retrieves the general colour of the given evas object.
1228  *
1229  * Note that if any of @p r, @p g, @p b or @p a are @c NULL, then the
1230  * @c NULL parameters are ignored.
1231  *
1232  * @param   obj The given evas object.
1233  * @param   r   Pointer to an integer in which to store the red component of
1234  *              the colour.
1235  * @param   g   Pointer to an integer in which to store the green component of
1236  *              the colour.
1237  * @param   b   Pointer to an integer in which to store the blue component of
1238  *              the colour.
1239  * @param   a   Pointer to an integer in which to store the alpha component of
1240  *              the colour.
1241  * @ingroup Evas_Object_Group_Basic
1242  */
1243 EAPI void
1244 evas_object_color_get(const Evas_Object *obj, int *r, int *g, int *b, int *a)
1245 {
1246    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1247    if (r) *r = 0; if (g) *g = 0; if (b) *b = 0; if (a) *a = 0;
1248    return;
1249    MAGIC_CHECK_END();
1250    if (obj->delete_me)
1251      {
1252         if (r) *r = 0; if (g) *g = 0; if (b) *b = 0; if (a) *a = 0;
1253         return;
1254      }
1255    if (r) *r = obj->cur.color.r;
1256    if (g) *g = obj->cur.color.g;
1257    if (b) *b = obj->cur.color.b;
1258    if (a) *a = obj->cur.color.a;
1259 }
1260
1261 /**
1262  * Sets whether or not the given evas object is to be drawn anti-aliased.
1263  *
1264  * @param   obj The given evas object.
1265  * @param   anti_alias 1 if the object is to be anti_aliased, 0 otherwise.
1266  * @ingroup Evas_Object_Group_Extras
1267  */
1268 EAPI void
1269 evas_object_anti_alias_set(Evas_Object *obj, Eina_Bool anti_alias)
1270 {
1271    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1272    return;
1273    MAGIC_CHECK_END();
1274    if (obj->delete_me) return;
1275    anti_alias = !!anti_alias;
1276    if (obj->cur.anti_alias == anti_alias)return;
1277    obj->cur.anti_alias = anti_alias;
1278    evas_object_change(obj);
1279 }
1280
1281
1282 /**
1283  * Retrieves whether or not the given evas object is to be drawn anti_aliased.
1284  * @param   obj The given evas object.
1285  * @return  @c 1 if the object is to be anti_aliased.  @c 0 otherwise.
1286  * @ingroup Evas_Object_Group_Extras
1287  */
1288 EAPI Eina_Bool
1289 evas_object_anti_alias_get(const Evas_Object *obj)
1290 {
1291    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1292    return 0;
1293    MAGIC_CHECK_END();
1294    if (obj->delete_me) return 0;
1295    return obj->cur.anti_alias;
1296 }
1297
1298 /**
1299  * Sets the scaling factor for an evas object. Does not affect all objects.
1300  *
1301  * @param   obj The given evas object.
1302  * @param   scale The scaling factor. 1.0 == none.
1303  * @ingroup Evas_Object_Group_Extras
1304  */
1305 EAPI void
1306 evas_object_scale_set(Evas_Object *obj, double scale)
1307 {
1308    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1309    return;
1310    MAGIC_CHECK_END();
1311    if (obj->delete_me) return;
1312    if (obj->cur.scale == scale) return;
1313    obj->cur.scale = scale;
1314    evas_object_change(obj);
1315    if (obj->func->scale_update) obj->func->scale_update(obj);
1316 }
1317
1318
1319 /**
1320  * Retrieves the scaling factor for the given evas object.
1321  * @param   obj The given evas object.
1322  * @return  The scaling factor.
1323  *
1324  * @ingroup Evas_Object_Group_Extras
1325  */
1326 EAPI double
1327 evas_object_scale_get(const Evas_Object *obj)
1328 {
1329    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1330    return 0;
1331    MAGIC_CHECK_END();
1332    if (obj->delete_me) return 1.0;
1333    return obj->cur.scale;
1334 }
1335
1336 /**
1337  * Sets the render_op to be used for rendering the evas object.
1338  * @param   obj The given evas object.
1339  * @param   render_op one of the Evas_Render_Op values.
1340  * @ingroup Evas_Object_Group_Extras
1341  */
1342 EAPI void
1343 evas_object_render_op_set(Evas_Object *obj, Evas_Render_Op render_op)
1344 {
1345    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1346    return;
1347    MAGIC_CHECK_END();
1348    if (obj->delete_me) return;
1349    if ((Evas_Render_Op)obj->cur.render_op == render_op)
1350       return;
1351    obj->cur.render_op = render_op;
1352    evas_object_change(obj);
1353 }
1354
1355 /**
1356  * Retrieves the current value of the operation used for rendering the evas object.
1357  * @param   obj The given evas object.
1358  * @return  one of the enumerated values in Evas_Render_Op.
1359  * @ingroup Evas_Object_Group_Extras
1360  */
1361 EAPI Evas_Render_Op
1362 evas_object_render_op_get(const Evas_Object *obj)
1363 {
1364    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1365    return 0;
1366    MAGIC_CHECK_END();
1367    if (obj->delete_me) return EVAS_RENDER_BLEND;
1368    return obj->cur.render_op;
1369 }
1370
1371 /**
1372  * Retrieves the evas that the given evas object is on.
1373  * @param   obj The given evas object.
1374  * @return  The evas that the object is on.
1375  * @ingroup Evas_Object_Group_Basic
1376  */
1377 EAPI Evas *
1378 evas_object_evas_get(const Evas_Object *obj)
1379 {
1380    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1381    return NULL;
1382    MAGIC_CHECK_END();
1383    if (obj->delete_me) return NULL;
1384    return obj->layer->evas;
1385 }
1386
1387 /**
1388  * @addtogroup Evas_Object_Group_Find
1389  * @{
1390  */
1391
1392 /**
1393  * Retrieves the top object at the given position (x,y)
1394  * @param   e The given evas object.
1395  * @param   x The horizontal coordinate
1396  * @param   y The vertical coordinate
1397  * @param   include_pass_events_objects Boolean Flag to include or not
1398  * pass events objects
1399  * @param   include_hidden_objects Boolean Flag to include or not hidden objects
1400  * @return  The evas object that is over all others objects at the given position.
1401  */
1402 EAPI Evas_Object *
1403 evas_object_top_at_xy_get(const Evas *e, Evas_Coord x, Evas_Coord y, Eina_Bool include_pass_events_objects, Eina_Bool include_hidden_objects)
1404 {
1405    Evas_Layer *lay;
1406    int xx, yy;
1407
1408    MAGIC_CHECK(e, Evas, MAGIC_EVAS);
1409    return NULL;
1410    MAGIC_CHECK_END();
1411    xx = x;
1412    yy = y;
1413 ////   xx = evas_coord_world_x_to_screen(e, x);
1414 ////   yy = evas_coord_world_y_to_screen(e, y);
1415    EINA_INLIST_REVERSE_FOREACH((EINA_INLIST_GET(e->layers)), lay)
1416      {
1417         Evas_Object *obj;
1418
1419         EINA_INLIST_REVERSE_FOREACH(get_layer_objects(lay), obj)
1420           {
1421              if (obj->delete_me) continue;
1422              if ((!include_pass_events_objects) && (evas_event_passes_through(obj))) continue;
1423              if ((!include_hidden_objects) && (!obj->cur.visible)) continue;
1424              evas_object_clip_recalc(obj);
1425              if ((evas_object_is_in_output_rect(obj, xx, yy, 1, 1)) &&
1426                  (!obj->clip.clipees))
1427                return obj;
1428           }
1429      }
1430    return NULL;
1431 }
1432
1433 /**
1434  * Retrieves the top object at mouse pointer position
1435  * @param   e The given evas object.
1436  * @return The evas object that is over all others objects at the
1437  * pointer position.
1438  */
1439 EAPI Evas_Object *
1440 evas_object_top_at_pointer_get(const Evas *e)
1441 {
1442 ////   return evas_object_top_at_xy_get(e, e->pointer.canvas_x, e->pointer.canvas_y, 0, 0);
1443    return evas_object_top_at_xy_get(e, e->pointer.x, e->pointer.y, 1, 1);
1444 }
1445
1446 /**
1447  * Retrieves the top object in the given rectangle region
1448  * @param   e The given evas object.
1449  * @param   x The horizontal coordinate.
1450  * @param   y The vertical coordinate.
1451  * @param   w The width size.
1452  * @param   h The height size.
1453  * @param   include_pass_events_objects Boolean Flag to include or not pass events objects
1454  * @param   include_hidden_objects Boolean Flag to include or not hidden objects
1455  * @return  The evas object that is over all others objects at the pointer position.
1456  *
1457  */
1458 EAPI Evas_Object *
1459 evas_object_top_in_rectangle_get(const Evas *e, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h, Eina_Bool include_pass_events_objects, Eina_Bool include_hidden_objects)
1460 {
1461    Evas_Layer *lay;
1462    int xx, yy, ww, hh;
1463
1464    MAGIC_CHECK(e, Evas, MAGIC_EVAS);
1465    return NULL;
1466    MAGIC_CHECK_END();
1467    xx = x;
1468    yy = y;
1469    ww = w;
1470    hh = h;
1471 ////   xx = evas_coord_world_x_to_screen(e, x);
1472 ////   yy = evas_coord_world_y_to_screen(e, y);
1473 ////   ww = evas_coord_world_x_to_screen(e, w);
1474 ////   hh = evas_coord_world_y_to_screen(e, h);
1475    if (ww < 1) ww = 1;
1476    if (hh < 1) hh = 1;
1477    EINA_INLIST_REVERSE_FOREACH((EINA_INLIST_GET(e->layers)), lay)
1478      {
1479         Evas_Object *obj;
1480
1481         EINA_INLIST_REVERSE_FOREACH(get_layer_objects(lay), obj)
1482           {
1483              if (obj->delete_me) continue;
1484              if ((!include_pass_events_objects) && (evas_event_passes_through(obj))) continue;
1485              if ((!include_hidden_objects) && (!obj->cur.visible)) continue;
1486              evas_object_clip_recalc(obj);
1487              if ((evas_object_is_in_output_rect(obj, xx, yy, ww, hh)) &&
1488                  (!obj->clip.clipees))
1489                return obj;
1490           }
1491      }
1492    return NULL;
1493 }
1494
1495 /**
1496  * Retrieves the objects at the given position
1497  * @param   e The given evas object.
1498  * @param   x The horizontal coordinate.
1499  * @param   y The vertical coordinate.
1500  * @param include_pass_events_objects Boolean Flag to include or not
1501  * pass events objects
1502  * @param   include_hidden_objects Boolean Flag to include or not hidden objects
1503  * @return  The list of evas objects at the pointer position.
1504  *
1505  */
1506 EAPI Eina_List *
1507 evas_objects_at_xy_get(const Evas *e, Evas_Coord x, Evas_Coord y, Eina_Bool include_pass_events_objects, Eina_Bool include_hidden_objects)
1508 {
1509    Eina_List *in = NULL;
1510    Evas_Layer *lay;
1511    int xx, yy;
1512
1513    MAGIC_CHECK(e, Evas, MAGIC_EVAS);
1514    return NULL;
1515    MAGIC_CHECK_END();
1516    xx = x;
1517    yy = y;
1518 ////   xx = evas_coord_world_x_to_screen(e, x);
1519 ////   yy = evas_coord_world_y_to_screen(e, y);
1520    EINA_INLIST_REVERSE_FOREACH((EINA_INLIST_GET(e->layers)), lay)
1521      {
1522         Evas_Object *obj;
1523
1524         EINA_INLIST_REVERSE_FOREACH(get_layer_objects(lay), obj)
1525           {
1526              if (obj->delete_me) continue;
1527              if ((!include_pass_events_objects) && (evas_event_passes_through(obj))) continue;
1528              if ((!include_hidden_objects) && (!obj->cur.visible)) continue;
1529              evas_object_clip_recalc(obj);
1530              if ((evas_object_is_in_output_rect(obj, xx, yy, 1, 1)) &&
1531                  (!obj->clip.clipees))
1532                in = eina_list_prepend(in, obj);
1533           }
1534      }
1535    return in;
1536 }
1537
1538 /**
1539  * To be documented.
1540  *
1541  * FIXME: To be fixed.
1542  */
1543 /**
1544  * Retrieves the objects in the given rectangle region
1545  * @param   e The given evas object.
1546  * @param   x The horizontal coordinate.
1547  * @param   y The vertical coordinate.
1548  * @param   w The width size.
1549  * @param   h The height size.
1550  * @param   include_pass_events_objects Boolean Flag to include or not pass events objects
1551  * @param   include_hidden_objects Boolean Flag to include or not hidden objects
1552  * @return  The list of evas object in the rectangle region.
1553  *
1554  */
1555 EAPI Eina_List *
1556 evas_objects_in_rectangle_get(const Evas *e, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h, Eina_Bool include_pass_events_objects, Eina_Bool include_hidden_objects)
1557 {
1558    Eina_List *in = NULL;
1559    Evas_Layer *lay;
1560    int xx, yy, ww, hh;
1561
1562    MAGIC_CHECK(e, Evas, MAGIC_EVAS);
1563    return NULL;
1564    MAGIC_CHECK_END();
1565    xx = x;
1566    yy = y;
1567    ww = w;
1568    hh = h;
1569 ////   xx = evas_coord_world_x_to_screen(e, x);
1570 ////   yy = evas_coord_world_y_to_screen(e, y);
1571 ////   ww = evas_coord_world_x_to_screen(e, w);
1572 ////   hh = evas_coord_world_y_to_screen(e, h);
1573    if (ww < 1) ww = 1;
1574    if (hh < 1) hh = 1;
1575    EINA_INLIST_REVERSE_FOREACH((EINA_INLIST_GET(e->layers)), lay)
1576      {
1577         Evas_Object *obj;
1578
1579         EINA_INLIST_REVERSE_FOREACH(get_layer_objects(lay), obj)
1580           {
1581              if (obj->delete_me) continue;
1582              if ((!include_pass_events_objects) && (evas_event_passes_through(obj))) continue;
1583              if ((!include_hidden_objects) && (!obj->cur.visible)) continue;
1584              evas_object_clip_recalc(obj);
1585              if ((evas_object_is_in_output_rect(obj, xx, yy, ww, hh)) &&
1586                  (!obj->clip.clipees))
1587                in = eina_list_prepend(in, obj);
1588           }
1589      }
1590    return in;
1591 }
1592
1593 /**
1594  * @}
1595  */
1596
1597 /**
1598  * Retrieves the name of the type of the given evas object.
1599  * @param   obj The given object.
1600  * @return  The name.
1601  * @ingroup Evas_Object_Group_Basic
1602  */
1603 EAPI const char *
1604 evas_object_type_get(const Evas_Object *obj)
1605 {
1606    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1607    return NULL;
1608    MAGIC_CHECK_END();
1609    if (obj->delete_me) return "";
1610    return obj->type;
1611 }
1612
1613 /**
1614  * Set whether to use a precise (usually expensive) point collision detection.
1615  * @param obj The given object.
1616  * @param precise wheter to use a precise point collision detection or not
1617  * The default value is false.
1618  * @ingroup Evas_Object_Group_Extras
1619  */
1620 EAPI void
1621 evas_object_precise_is_inside_set(Evas_Object *obj, Eina_Bool precise)
1622 {
1623    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1624    return;
1625    MAGIC_CHECK_END();
1626    obj->precise_is_inside = precise;
1627 }
1628
1629 /**
1630  * Determine whether an object is set to use a precise point collision
1631  * detection.
1632  * @param obj The given object.
1633  * @ingroup Evas_Object_Group_Extras
1634  */
1635 EAPI Eina_Bool
1636 evas_object_precise_is_inside_get(const Evas_Object *obj)
1637 {
1638    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1639    return 0;
1640    MAGIC_CHECK_END();
1641    return obj->precise_is_inside;
1642 }
1643
1644 /**
1645  * Set a hint flag on the object that this is used as a static "clipper".
1646  * 
1647  * This is a hint to evas that this object is used as a big static clipper
1648  * and shouldnt be moved with children and otherwise considered specially. The
1649  * Default is off.
1650  * 
1651  * @param obj The given object.
1652  * @param is_static_clip The static clip flag (on or off)
1653  * @ingroup Evas_Object_Group_Extras
1654  */
1655 EAPI void
1656 evas_object_static_clip_set(Evas_Object *obj, Eina_Bool is_static_clip)
1657 {
1658    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1659    return;
1660    MAGIC_CHECK_END();
1661    obj->is_static_clip = is_static_clip;
1662 }
1663
1664 /**
1665  * Get static "clipper" hint flag.
1666  * 
1667  * @see evas_object_static_clip_set()
1668  * 
1669  * @param obj The given object.
1670  * @return The static clip flag (on or off)
1671  * @ingroup Evas_Object_Group_Extras
1672  */
1673 EAPI Eina_Bool
1674 evas_object_static_clip_get(const Evas_Object *obj)
1675 {
1676    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1677    return 0;
1678    MAGIC_CHECK_END();
1679    return obj->is_static_clip;
1680 }
1681