1 #include "evas_common.h"
2 #include "evas_private.h"
8 get_layer_objects(Evas_Layer *l)
10 if ((!l) || (!l->objects)) return NULL;
11 return (EINA_INLIST_GET(l->objects));
14 /* evas internal stuff */
16 evas_object_new(Evas *e __UNUSED__)
20 EVAS_MEMPOOL_INIT(_mp_obj, "evas_object", Evas_Object, 32, NULL);
21 obj = EVAS_MEMPOOL_ALLOC(_mp_obj, Evas_Object);
22 if (!obj) return NULL;
23 EVAS_MEMPOOL_PREP(_mp_obj, obj, Evas_Object);
25 obj->magic = MAGIC_OBJ;
27 obj->prev.scale = 1.0;
28 obj->is_frame = EINA_FALSE;
34 evas_object_change_reset(Evas_Object *obj)
36 obj->changed = EINA_FALSE;
37 obj->changed_move = EINA_FALSE;
38 obj->changed_color = EINA_FALSE;
39 obj->changed_map = EINA_FALSE;
40 obj->changed_pchange = EINA_FALSE;
44 evas_object_cur_prev(Evas_Object *obj)
46 if (!obj->prev.valid_map && (obj->prev.map == obj->cur.map))
49 if (obj->cur.map != obj->prev.map)
51 if (obj->cache_map) evas_map_free(obj->cache_map);
52 obj->cache_map = obj->prev.map;
58 evas_object_free(Evas_Object *obj, int clean_layer)
60 int was_smart_child = 0;
62 #if 0 // filtering disabled
63 evas_filter_free(obj);
65 if (!strcmp(obj->type, "image")) evas_object_image_video_surface_set(obj, NULL);
66 evas_object_map_set(obj, NULL);
67 if (obj->prev.map) evas_map_free(obj->prev.map);
68 if (obj->cache_map) evas_map_free(obj->cache_map);
69 evas_object_grabs_cleanup(obj);
70 evas_object_intercept_cleanup(obj);
71 if (obj->smart.parent) was_smart_child = 1;
72 evas_object_smart_cleanup(obj);
74 if (!was_smart_child) evas_object_release(obj, clean_layer);
75 if (obj->clip.clipees)
76 eina_list_free(obj->clip.clipees);
77 evas_object_clip_changes_clean(obj);
78 evas_object_event_callback_all_del(obj);
79 evas_object_event_callback_cleanup(obj);
80 while (obj->data.elements)
84 node = obj->data.elements->data;
85 obj->data.elements = eina_list_remove(obj->data.elements, node);
91 EVAS_MEMPOOL_FREE(_mp_sh, obj->size_hints);
93 EVAS_MEMPOOL_FREE(_mp_obj, obj);
97 evas_object_change(Evas_Object *obj)
101 Eina_Bool movch = EINA_FALSE;
103 if (obj->layer->evas->nochange) return;
104 obj->layer->evas->changed = EINA_TRUE;
106 if (obj->changed_move)
109 obj->changed_move = EINA_FALSE;
112 if (obj->changed) return;
114 evas_render_object_recalc(obj);
115 /* set changed flag on all objects this one clips too */
116 if (!((movch) && (obj->is_static_clip)))
118 EINA_LIST_FOREACH(obj->clip.clipees, l, obj2)
119 evas_object_change(obj2);
121 EINA_LIST_FOREACH(obj->proxy.proxies, l, obj2)
123 evas_object_change(obj2);
125 if (obj->smart.parent) evas_object_change(obj->smart.parent);
129 evas_object_render_pre_visible_change(Eina_Array *rects, Evas_Object *obj, int is_v, int was_v)
131 if (obj->smart.smart) return;
132 if (is_v == was_v) return;
136 obj->cur.cache.clip.x,
137 obj->cur.cache.clip.y,
138 obj->cur.cache.clip.w,
139 obj->cur.cache.clip.h);
144 obj->prev.cache.clip.x,
145 obj->prev.cache.clip.y,
146 obj->prev.cache.clip.w,
147 obj->prev.cache.clip.h);
152 evas_object_render_pre_clipper_change(Eina_Array *rects, Evas_Object *obj)
154 if (obj->smart.smart) return;
155 if (obj->cur.clipper == obj->prev.clipper) return;
156 if ((obj->cur.clipper) && (obj->prev.clipper))
158 /* get difference rects between clippers */
159 evas_rects_return_difference_rects(rects,
160 obj->cur.clipper->cur.cache.clip.x,
161 obj->cur.clipper->cur.cache.clip.y,
162 obj->cur.clipper->cur.cache.clip.w,
163 obj->cur.clipper->cur.cache.clip.h,
164 obj->prev.clipper->prev.cache.clip.x,
165 obj->prev.clipper->prev.cache.clip.y,
166 obj->prev.clipper->prev.cache.clip.w,
167 obj->prev.clipper->prev.cache.clip.h);
169 else if (obj->cur.clipper)
171 evas_rects_return_difference_rects(rects,
176 //// rl = evas_rects_return_difference_rects(obj->cur.cache.geometry.x,
177 //// obj->cur.cache.geometry.y,
178 //// obj->cur.cache.geometry.w,
179 //// obj->cur.cache.geometry.h,
180 obj->cur.clipper->cur.cache.clip.x,
181 obj->cur.clipper->cur.cache.clip.y,
182 obj->cur.clipper->cur.cache.clip.w,
183 obj->cur.clipper->cur.cache.clip.h);
185 else if (obj->prev.clipper)
187 evas_rects_return_difference_rects(rects,
188 obj->prev.geometry.x,
189 obj->prev.geometry.y,
190 obj->prev.geometry.w,
191 obj->prev.geometry.h,
192 //// rl = evas_rects_return_difference_rects(obj->prev.cache.geometry.x,
193 //// obj->prev.cache.geometry.y,
194 //// obj->prev.cache.geometry.w,
195 //// obj->prev.cache.geometry.h,
196 obj->prev.clipper->prev.cache.clip.x,
197 obj->prev.clipper->prev.cache.clip.y,
198 obj->prev.clipper->prev.cache.clip.w,
199 obj->prev.clipper->prev.cache.clip.h);
204 evas_object_render_pre_prev_cur_add(Eina_Array *rects, Evas_Object *obj)
207 obj->cur.cache.clip.x,
208 obj->cur.cache.clip.y,
209 obj->cur.cache.clip.w,
210 obj->cur.cache.clip.h);
212 obj->prev.cache.clip.x,
213 obj->prev.cache.clip.y,
214 obj->prev.cache.clip.w,
215 obj->prev.cache.clip.h);
221 obj->cur.geometry.h);
222 //// obj->cur.cache.geometry.x,
223 //// obj->cur.cache.geometry.y,
224 //// obj->cur.cache.geometry.w,
225 //// obj->cur.cache.geometry.h);
227 obj->prev.geometry.x,
228 obj->prev.geometry.y,
229 obj->prev.geometry.w,
230 obj->prev.geometry.h);
231 //// obj->prev.cache.geometry.x,
232 //// obj->prev.cache.geometry.y,
233 //// obj->prev.cache.geometry.w,
234 //// obj->prev.cache.geometry.h);
239 evas_object_clip_changes_clean(Evas_Object *obj)
243 EINA_LIST_FREE(obj->clip.changes, r)
244 eina_rectangle_free(r);
248 evas_object_render_pre_effect_updates(Eina_Array *rects, Evas_Object *obj, int is_v, int was_v __UNUSED__)
251 Evas_Object *clipper;
254 Eina_Array_Iterator it;
257 if (obj->smart.smart) goto end;
258 /* FIXME: was_v isn't used... why? */
259 if (!obj->clip.clipees)
261 EINA_ARRAY_ITER_NEXT(rects, i, r, it)
263 /* get updates and clip to current clip */
268 RECTS_CLIP_TO_RECT(x, y, w, h,
269 obj->cur.cache.clip.x,
270 obj->cur.cache.clip.y,
271 obj->cur.cache.clip.w,
272 obj->cur.cache.clip.h);
273 if ((w > 0) && (h > 0))
274 obj->layer->evas->engine.func->output_redraws_rect_add(obj->layer->evas->engine.data.output,
276 /* get updates and clip to previous clip */
281 RECTS_CLIP_TO_RECT(x, y, w, h,
282 obj->prev.cache.clip.x,
283 obj->prev.cache.clip.y,
284 obj->prev.cache.clip.w,
285 obj->prev.cache.clip.h);
286 if ((w > 0) && (h > 0))
287 obj->layer->evas->engine.func->output_redraws_rect_add(obj->layer->evas->engine.data.output,
290 /* if the object is actually visible, take any parent clip changes */
293 clipper = obj->cur.clipper;
296 EINA_LIST_FOREACH(clipper->clip.changes, l, r)
298 /* get updates and clip to current clip */
299 x = r->x; y = r->y; w = r->w; h = r->h;
300 RECTS_CLIP_TO_RECT(x, y, w, h,
301 obj->cur.cache.clip.x,
302 obj->cur.cache.clip.y,
303 obj->cur.cache.clip.w,
304 obj->cur.cache.clip.h);
305 if ((w > 0) && (h > 0))
306 obj->layer->evas->engine.func->output_redraws_rect_add(obj->layer->evas->engine.data.output,
308 /* get updates and clip to previous clip */
309 x = r->x; y = r->y; w = r->w; h = r->h;
310 RECTS_CLIP_TO_RECT(x, y, w, h,
311 obj->prev.cache.clip.x,
312 obj->prev.cache.clip.y,
313 obj->prev.cache.clip.w,
314 obj->prev.cache.clip.h);
315 if ((w > 0) && (h > 0))
316 obj->layer->evas->engine.func->output_redraws_rect_add(obj->layer->evas->engine.data.output,
319 clipper = clipper->cur.clipper;
325 evas_object_clip_changes_clean(obj);
326 EINA_ARRAY_ITER_NEXT(rects, i, r, it)
327 obj->clip.changes = eina_list_append(obj->clip.changes, r);
328 eina_array_clean(rects);
332 EINA_ARRAY_ITER_NEXT(rects, i, r, it)
333 eina_rectangle_free(r);
334 eina_array_clean(rects);
338 evas_object_was_in_output_rect(Evas_Object *obj, int x, int y, int w, int h)
340 if (obj->smart.smart && !obj->prev.map && !obj->prev.usemap) return 0;
341 /* assumes coords have been recalced */
342 if ((RECTS_INTERSECT(x, y, w, h,
343 obj->prev.cache.clip.x,
344 obj->prev.cache.clip.y,
345 obj->prev.cache.clip.w,
346 obj->prev.cache.clip.h)))
352 evas_object_was_opaque(Evas_Object *obj)
354 if (obj->smart.smart) return 0;
355 if (obj->prev.cache.clip.a == 255)
357 if (obj->func->was_opaque)
358 return obj->func->was_opaque(obj);
365 evas_object_is_inside(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
367 if (obj->smart.smart) return 0;
368 if (obj->func->is_inside)
369 return obj->func->is_inside(obj, x, y);
374 evas_object_was_inside(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
376 if (obj->smart.smart) return 0;
377 if (obj->func->was_inside)
378 return obj->func->was_inside(obj, x, y);
381 /* routines apps will call */
384 evas_object_ref(Evas_Object *obj)
386 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
393 evas_object_unref(Evas_Object *obj)
395 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
398 if (obj->ref == 0) return;
400 if ((obj->del_ref) && (obj->ref == 0)) evas_object_del(obj);
404 evas_object_ref_get(const Evas_Object *obj)
406 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
413 evas_object_del(Evas_Object *obj)
415 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
419 if (obj->delete_me) return;
423 obj->del_ref = EINA_TRUE;
427 evas_object_hide(obj);
430 obj->focused = EINA_FALSE;
431 obj->layer->evas->focused = NULL;
432 _evas_object_event_new();
433 evas_object_event_callback_call(obj, EVAS_CALLBACK_FOCUS_OUT, NULL, _evas_event_counter);
434 _evas_post_event_callback_call(obj->layer->evas);
436 _evas_object_event_new();
437 evas_object_event_callback_call(obj, EVAS_CALLBACK_DEL, NULL, _evas_event_counter);
438 _evas_post_event_callback_call(obj->layer->evas);
439 if (obj->mouse_grabbed > 0)
440 obj->layer->evas->pointer.mouse_grabbed -= obj->mouse_grabbed;
441 if ((obj->mouse_in) || (obj->mouse_grabbed > 0))
442 obj->layer->evas->pointer.object.in = eina_list_remove(obj->layer->evas->pointer.object.in, obj);
443 obj->mouse_grabbed = 0;
445 if (obj->name) evas_object_name_set(obj, NULL);
448 evas_object_free(obj, 1);
451 evas_object_grabs_cleanup(obj);
452 while (obj->clip.clipees)
453 evas_object_clip_unset(obj->clip.clipees->data);
454 while (obj->proxy.proxies)
455 evas_object_image_source_unset(obj->proxy.proxies->data);
456 if (obj->cur.clipper) evas_object_clip_unset(obj);
457 evas_object_map_set(obj, NULL);
458 if (obj->smart.smart) evas_object_smart_del(obj);
459 _evas_object_event_new();
460 evas_object_event_callback_call(obj, EVAS_CALLBACK_FREE, NULL, _evas_event_counter);
461 _evas_post_event_callback_call(obj->layer->evas);
462 evas_object_smart_cleanup(obj);
464 evas_object_change(obj);
468 evas_object_update_bounding_box(Evas_Object *obj)
470 Eina_Bool propagate = EINA_FALSE;
471 Eina_Bool computeminmax = EINA_FALSE;
472 Evas_Coord x, y, w, h;
473 Evas_Coord px, py, pw, ph;
476 if (!obj->smart.parent) return ;
477 if (obj->child_has_map) return ; /* Disable bounding box computation for this object and its parent */
478 /* We could also remove object that are not visible from the bounding box, use the clipping information
479 to reduce the bounding of the object they are clipping, but for the moment this will do it's jobs */
480 noclip = !(obj->clip.clipees || obj->is_static_clip);
482 if (obj->smart.smart)
484 x = obj->cur.bounding_box.x;
485 y = obj->cur.bounding_box.y;
486 w = obj->cur.bounding_box.w;
487 h = obj->cur.bounding_box.h;
488 px = obj->prev.bounding_box.x;
489 py = obj->prev.bounding_box.y;
490 pw = obj->prev.bounding_box.w;
491 ph = obj->prev.bounding_box.h;
495 x = obj->cur.geometry.x;
496 y = obj->cur.geometry.y;
497 w = obj->cur.geometry.w;
498 h = obj->cur.geometry.h;
499 px = obj->prev.geometry.x;
500 py = obj->prev.geometry.y;
501 pw = obj->prev.geometry.w;
502 ph = obj->prev.geometry.h;
505 /* We are not yet trying to find the smallest bounding box, but we want to find a good approximation quickly.
506 * That's why we initialiaze min and max search to geometry of the parent object.
509 if (obj->smart.parent->cur.valid_bounding_box)
511 /* Update left limit */
512 if (noclip && x < obj->smart.parent->cur.bounding_box.x)
514 obj->smart.parent->cur.bounding_box.w += obj->smart.parent->cur.bounding_box.x - x;
515 obj->smart.parent->cur.bounding_box.x = x;
516 propagate = EINA_TRUE;
518 else if ((px == obj->smart.parent->prev.bounding_box.x && x > obj->smart.parent->cur.bounding_box.x)
519 || (!noclip && x == obj->smart.parent->cur.bounding_box.x))
521 computeminmax = EINA_TRUE;
524 /* Update top limit */
525 if (noclip && y < obj->smart.parent->cur.bounding_box.y)
527 obj->smart.parent->cur.bounding_box.h += obj->smart.parent->cur.bounding_box.x - x;
528 obj->smart.parent->cur.bounding_box.y = y;
529 propagate = EINA_TRUE;
531 else if ((py == obj->smart.parent->prev.bounding_box.y && y > obj->smart.parent->cur.bounding_box.y)
532 || (!noclip && y == obj->smart.parent->cur.bounding_box.y))
534 computeminmax = EINA_TRUE;
537 /* Update right limit */
538 if (noclip && x + w > obj->smart.parent->cur.bounding_box.x + obj->smart.parent->cur.bounding_box.w)
540 obj->smart.parent->cur.bounding_box.w = x + w - obj->smart.parent->cur.bounding_box.x;
541 propagate = EINA_TRUE;
543 else if ((px + pw == obj->smart.parent->prev.bounding_box.x + obj->smart.parent->prev.bounding_box.w &&
544 x + w < obj->smart.parent->cur.bounding_box.x + obj->smart.parent->cur.bounding_box.w)
545 || (!noclip && x + w == obj->smart.parent->cur.bounding_box.x + obj->smart.parent->cur.bounding_box.w))
547 computeminmax = EINA_TRUE;
550 /* Update bottom limit */
551 if (noclip && y + h > obj->smart.parent->cur.bounding_box.y + obj->smart.parent->cur.bounding_box.h)
553 obj->smart.parent->cur.bounding_box.h = y + h - obj->smart.parent->cur.bounding_box.y;
554 propagate = EINA_TRUE;
556 else if ((py + ph == obj->smart.parent->prev.bounding_box.y + obj->smart.parent->prev.bounding_box.h &&
557 y + h < obj->smart.parent->cur.bounding_box.y + obj->smart.parent->cur.bounding_box.h) ||
558 (!noclip && y + h == obj->smart.parent->cur.bounding_box.y + obj->smart.parent->cur.bounding_box.h))
560 computeminmax = EINA_TRUE;
565 evas_object_smart_need_bounding_box_update(obj->smart.parent);
572 obj->smart.parent->cur.bounding_box.x = x;
573 obj->smart.parent->cur.bounding_box.y = y;
574 obj->smart.parent->cur.bounding_box.w = w;
575 obj->smart.parent->cur.bounding_box.h = h;
576 obj->smart.parent->cur.valid_bounding_box = EINA_TRUE;
577 propagate = EINA_TRUE;
582 evas_object_update_bounding_box(obj->smart.parent);
586 evas_object_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
588 int is, was = 0, pass = 0, freeze = 0;
591 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
594 if (obj->delete_me) return;
601 if ((!obj->smart.parent) && (obj->smart.smart))
605 evas_output_framespace_get(obj->layer->evas,
606 &fx, &fy, NULL, NULL);
612 if (evas_object_intercept_call_move(obj, nx, ny)) return;
614 if (obj->doing.in_move > 0)
616 WRN("evas_object_move() called on object %p when in the middle of moving the same object", obj);
620 if ((obj->cur.geometry.x == nx) && (obj->cur.geometry.y == ny)) return;
622 if (obj->layer->evas->events_frozen <= 0)
624 pass = evas_event_passes_through(obj);
625 freeze = evas_event_freezes_through(obj);
626 if ((!pass) && (!freeze))
627 was = evas_object_is_in_output_rect(obj,
628 obj->layer->evas->pointer.x,
629 obj->layer->evas->pointer.y, 1, 1);
631 obj->doing.in_move++;
633 if (obj->smart.smart)
635 if (obj->smart.smart->smart_class->move)
636 obj->smart.smart->smart_class->move(obj, nx, ny);
639 obj->cur.geometry.x = nx;
640 obj->cur.geometry.y = ny;
642 evas_object_update_bounding_box(obj);
644 //// obj->cur.cache.geometry.validity = 0;
645 obj->changed_move = EINA_TRUE;
646 evas_object_change(obj);
647 evas_object_clip_dirty(obj);
648 obj->doing.in_move--;
649 if (obj->layer->evas->events_frozen <= 0)
651 evas_object_recalc_clippees(obj);
654 if (!obj->smart.smart)
656 is = evas_object_is_in_output_rect(obj,
657 obj->layer->evas->pointer.x,
658 obj->layer->evas->pointer.y, 1, 1);
659 if ((is ^ was) && obj->cur.visible)
660 evas_event_feed_mouse_move(obj->layer->evas,
661 obj->layer->evas->pointer.x,
662 obj->layer->evas->pointer.y,
663 obj->layer->evas->last_timestamp,
668 evas_object_inform_call_move(obj);
672 evas_object_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
674 int is, was = 0, pass = 0, freeze =0;
676 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
679 if (obj->delete_me) return;
680 if (w < 0) w = 0; if (h < 0) h = 0;
682 if (evas_object_intercept_call_resize(obj, w, h)) return;
684 if (obj->doing.in_resize > 0)
686 WRN("evas_object_resize() called on object %p when in the middle of resizing the same object", obj);
690 if ((obj->cur.geometry.w == w) && (obj->cur.geometry.h == h)) return;
692 if (obj->layer->evas->events_frozen <= 0)
694 pass = evas_event_passes_through(obj);
695 freeze = evas_event_freezes_through(obj);
696 if ((!pass) && (!freeze))
697 was = evas_object_is_in_output_rect(obj,
698 obj->layer->evas->pointer.x,
699 obj->layer->evas->pointer.y, 1, 1);
701 obj->doing.in_resize++;
703 if (obj->smart.smart)
705 if (obj->smart.smart->smart_class->resize)
706 obj->smart.smart->smart_class->resize(obj, w, h);
709 obj->cur.geometry.w = w;
710 obj->cur.geometry.h = h;
712 evas_object_update_bounding_box(obj);
714 //// obj->cur.cache.geometry.validity = 0;
715 evas_object_change(obj);
716 evas_object_clip_dirty(obj);
717 obj->doing.in_resize--;
718 /* NB: evas_object_recalc_clippees was here previously ( < 08/07/2009) */
719 if (obj->layer->evas->events_frozen <= 0)
721 /* NB: If this creates glitches on screen then move to above position */
722 evas_object_recalc_clippees(obj);
724 // if (obj->func->coords_recalc) obj->func->coords_recalc(obj);
727 if (!obj->smart.smart)
729 is = evas_object_is_in_output_rect(obj,
730 obj->layer->evas->pointer.x,
731 obj->layer->evas->pointer.y, 1, 1);
732 if ((is ^ was) && (obj->cur.visible))
733 evas_event_feed_mouse_move(obj->layer->evas,
734 obj->layer->evas->pointer.x,
735 obj->layer->evas->pointer.y,
736 obj->layer->evas->last_timestamp,
741 evas_object_inform_call_resize(obj);
745 evas_object_geometry_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
749 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
750 if (x) *x = 0; if (y) *y = 0; if (w) *w = 0; if (h) *h = 0;
755 if (x) *x = 0; if (y) *y = 0; if (w) *w = 0; if (h) *h = 0;
759 nx = obj->cur.geometry.x;
760 ny = obj->cur.geometry.y;
766 evas_output_framespace_get(obj->layer->evas,
767 &fx, &fy, NULL, NULL);
769 if ((!obj->smart.parent) && (obj->smart.smart))
771 if (nx > 0) nx -= fx;
772 if (ny > 0) ny -= fy;
774 else if ((obj->smart.parent) && (!obj->smart.smart))
776 if (nx > 0) nx -= fx;
777 if (ny > 0) ny -= fy;
783 if (w) *w = obj->cur.geometry.w;
784 if (h) *h = obj->cur.geometry.h;
788 _evas_object_size_hint_alloc(Evas_Object *obj)
790 if (obj->size_hints) return;
792 EVAS_MEMPOOL_INIT(_mp_sh, "evas_size_hints", Evas_Size_Hints, 32, );
793 obj->size_hints = EVAS_MEMPOOL_ALLOC(_mp_sh, Evas_Size_Hints);
794 if (!obj->size_hints) return;
795 EVAS_MEMPOOL_PREP(_mp_sh, obj->size_hints, Evas_Size_Hints);
796 obj->size_hints->max.w = -1;
797 obj->size_hints->max.h = -1;
798 obj->size_hints->align.x = 0.5;
799 obj->size_hints->align.y = 0.5;
803 evas_object_size_hint_min_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
805 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
806 if (w) *w = 0; if (h) *h = 0;
809 if ((!obj->size_hints) || obj->delete_me)
811 if (w) *w = 0; if (h) *h = 0;
814 if (w) *w = obj->size_hints->min.w;
815 if (h) *h = obj->size_hints->min.h;
819 evas_object_size_hint_min_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
821 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
826 _evas_object_size_hint_alloc(obj);
827 if ((obj->size_hints->min.w == w) && (obj->size_hints->min.h == h)) return;
828 obj->size_hints->min.w = w;
829 obj->size_hints->min.h = h;
831 evas_object_inform_call_changed_size_hints(obj);
835 evas_object_size_hint_max_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
837 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
838 if (w) *w = -1; if (h) *h = -1;
841 if ((!obj->size_hints) || obj->delete_me)
843 if (w) *w = -1; if (h) *h = -1;
846 if (w) *w = obj->size_hints->max.w;
847 if (h) *h = obj->size_hints->max.h;
851 evas_object_size_hint_max_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
853 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
858 _evas_object_size_hint_alloc(obj);
859 if ((obj->size_hints->max.w == w) && (obj->size_hints->max.h == h)) return;
860 obj->size_hints->max.w = w;
861 obj->size_hints->max.h = h;
863 evas_object_inform_call_changed_size_hints(obj);
867 evas_object_size_hint_request_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
869 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
870 if (w) *w = 0; if (h) *h = 0;
873 if ((!obj->size_hints) || obj->delete_me)
875 if (w) *w = 0; if (h) *h = 0;
878 if (w) *w = obj->size_hints->request.w;
879 if (h) *h = obj->size_hints->request.h;
883 evas_object_size_hint_request_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
885 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
890 _evas_object_size_hint_alloc(obj);
891 if ((obj->size_hints->request.w == w) && (obj->size_hints->request.h == h)) return;
892 obj->size_hints->request.w = w;
893 obj->size_hints->request.h = h;
895 evas_object_inform_call_changed_size_hints(obj);
899 evas_object_size_hint_aspect_get(const Evas_Object *obj, Evas_Aspect_Control *aspect, Evas_Coord *w, Evas_Coord *h)
901 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
902 if (aspect) *aspect = EVAS_ASPECT_CONTROL_NONE;
903 if (w) *w = 0; if (h) *h = 0;
906 if ((!obj->size_hints) || obj->delete_me)
908 if (aspect) *aspect = EVAS_ASPECT_CONTROL_NONE;
909 if (w) *w = 0; if (h) *h = 0;
912 if (aspect) *aspect = obj->size_hints->aspect.mode;
913 if (w) *w = obj->size_hints->aspect.size.w;
914 if (h) *h = obj->size_hints->aspect.size.h;
918 evas_object_size_hint_aspect_set(Evas_Object *obj, Evas_Aspect_Control aspect, Evas_Coord w, Evas_Coord h)
920 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
925 _evas_object_size_hint_alloc(obj);
926 if ((obj->size_hints->aspect.mode == aspect) && (obj->size_hints->aspect.size.w == w) && (obj->size_hints->aspect.size.h == h)) return;
927 obj->size_hints->aspect.mode = aspect;
928 obj->size_hints->aspect.size.w = w;
929 obj->size_hints->aspect.size.h = h;
931 evas_object_inform_call_changed_size_hints(obj);
935 evas_object_size_hint_align_get(const Evas_Object *obj, double *x, double *y)
937 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
938 if (x) *x = 0.5; if (y) *y = 0.5;
941 if ((!obj->size_hints) || obj->delete_me)
943 if (x) *x = 0.5; if (y) *y = 0.5;
946 if (x) *x = obj->size_hints->align.x;
947 if (y) *y = obj->size_hints->align.y;
951 evas_object_size_hint_align_set(Evas_Object *obj, double x, double y)
953 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
958 _evas_object_size_hint_alloc(obj);
959 if ((obj->size_hints->align.x == x) && (obj->size_hints->align.y == y)) return;
960 obj->size_hints->align.x = x;
961 obj->size_hints->align.y = y;
963 evas_object_inform_call_changed_size_hints(obj);
967 evas_object_size_hint_weight_get(const Evas_Object *obj, double *x, double *y)
969 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
970 if (x) *x = 0.0; if (y) *y = 0.0;
973 if ((!obj->size_hints) || obj->delete_me)
975 if (x) *x = 0.0; if (y) *y = 0.0;
978 if (x) *x = obj->size_hints->weight.x;
979 if (y) *y = obj->size_hints->weight.y;
983 evas_object_size_hint_weight_set(Evas_Object *obj, double x, double y)
985 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
990 _evas_object_size_hint_alloc(obj);
991 if ((obj->size_hints->weight.x == x) && (obj->size_hints->weight.y == y)) return;
992 obj->size_hints->weight.x = x;
993 obj->size_hints->weight.y = y;
995 evas_object_inform_call_changed_size_hints(obj);
999 evas_object_size_hint_padding_get(const Evas_Object *obj, Evas_Coord *l, Evas_Coord *r, Evas_Coord *t, Evas_Coord *b)
1001 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1002 if (l) *l = 0; if (r) *r = 0;
1003 if (t) *t = 0; if (b) *b = 0;
1006 if ((!obj->size_hints) || obj->delete_me)
1008 if (l) *l = 0; if (r) *r = 0;
1009 if (t) *t = 0; if (b) *b = 0;
1012 if (l) *l = obj->size_hints->padding.l;
1013 if (r) *r = obj->size_hints->padding.r;
1014 if (t) *t = obj->size_hints->padding.t;
1015 if (b) *b = obj->size_hints->padding.b;
1019 evas_object_size_hint_padding_set(Evas_Object *obj, Evas_Coord l, Evas_Coord r, Evas_Coord t, Evas_Coord b)
1021 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1026 _evas_object_size_hint_alloc(obj);
1027 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;
1028 obj->size_hints->padding.l = l;
1029 obj->size_hints->padding.r = r;
1030 obj->size_hints->padding.t = t;
1031 obj->size_hints->padding.b = b;
1033 evas_object_inform_call_changed_size_hints(obj);
1037 evas_object_show(Evas_Object *obj)
1039 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1042 if (obj->delete_me) return;
1043 if (evas_object_intercept_call_show(obj)) return;
1044 if (obj->smart.smart)
1046 if (obj->smart.smart->smart_class->show)
1047 obj->smart.smart->smart_class->show(obj);
1049 if (obj->cur.visible)
1053 obj->cur.visible = 1;
1054 evas_object_change(obj);
1055 evas_object_clip_dirty(obj);
1056 if (obj->layer->evas->events_frozen <= 0)
1058 evas_object_clip_across_clippees_check(obj);
1059 evas_object_recalc_clippees(obj);
1060 if ((!evas_event_passes_through(obj)) &&
1061 (!evas_event_freezes_through(obj)))
1063 if (!obj->smart.smart)
1065 if (evas_object_is_in_output_rect(obj,
1066 obj->layer->evas->pointer.x,
1067 obj->layer->evas->pointer.y, 1, 1))
1068 evas_event_feed_mouse_move(obj->layer->evas,
1069 obj->layer->evas->pointer.x,
1070 obj->layer->evas->pointer.y,
1071 obj->layer->evas->last_timestamp,
1076 evas_object_inform_call_show(obj);
1080 evas_object_hide(Evas_Object *obj)
1082 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1085 if (obj->delete_me) return;
1086 if (evas_object_intercept_call_hide(obj)) return;
1087 if (obj->smart.smart)
1089 if (obj->smart.smart->smart_class->hide)
1090 obj->smart.smart->smart_class->hide(obj);
1092 if (!obj->cur.visible)
1096 obj->cur.visible = 0;
1097 evas_object_change(obj);
1098 evas_object_clip_dirty(obj);
1099 if (obj->layer->evas->events_frozen <= 0)
1101 evas_object_clip_across_clippees_check(obj);
1102 evas_object_recalc_clippees(obj);
1103 if ((!evas_event_passes_through(obj)) &&
1104 (!evas_event_freezes_through(obj)))
1106 if ((!obj->smart.smart) ||
1107 ((obj->cur.map) && (obj->cur.map->count == 4) && (obj->cur.usemap)))
1109 if (!obj->mouse_grabbed)
1111 if (evas_object_is_in_output_rect(obj,
1112 obj->layer->evas->pointer.x,
1113 obj->layer->evas->pointer.y, 1, 1))
1114 evas_event_feed_mouse_move(obj->layer->evas,
1115 obj->layer->evas->pointer.x,
1116 obj->layer->evas->pointer.y,
1117 obj->layer->evas->last_timestamp,
1120 /* this is at odds to handling events when an obj is moved out of the mouse
1121 * ore resized out or clipped out. if mouse is grabbed - regardless of
1122 * visibility, mouse move events should keep happening and mouse up.
1123 * for better or worse it's at least consistent.
1124 if (obj->delete_me) return;
1125 if (obj->mouse_grabbed > 0)
1126 obj->layer->evas->pointer.mouse_grabbed -= obj->mouse_grabbed;
1127 if ((obj->mouse_in) || (obj->mouse_grabbed > 0))
1128 obj->layer->evas->pointer.object.in = eina_list_remove(obj->layer->evas->pointer.object.in, obj);
1129 obj->mouse_grabbed = 0;
1130 if (obj->layer->evas->events_frozen > 0)
1137 Evas_Event_Mouse_Out ev;
1139 _evas_object_event_new();
1142 ev.buttons = obj->layer->evas->pointer.button;
1143 ev.output.x = obj->layer->evas->pointer.x;
1144 ev.output.y = obj->layer->evas->pointer.y;
1145 ev.canvas.x = obj->layer->evas->pointer.x;
1146 ev.canvas.y = obj->layer->evas->pointer.y;
1148 ev.modifiers = &(obj->layer->evas->modifiers);
1149 ev.locks = &(obj->layer->evas->locks);
1150 ev.timestamp = obj->layer->evas->last_timestamp;
1151 ev.event_flags = EVAS_EVENT_FLAG_NONE;
1152 evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_OUT, &ev);
1153 _evas_post_event_callback_call(obj->layer->evas);
1162 if (obj->mouse_grabbed > 0)
1163 obj->layer->evas->pointer.mouse_grabbed -= obj->mouse_grabbed;
1164 if ((obj->mouse_in) || (obj->mouse_grabbed > 0))
1165 obj->layer->evas->pointer.object.in = eina_list_remove(obj->layer->evas->pointer.object.in, obj);
1166 obj->mouse_grabbed = 0;
1170 evas_object_inform_call_hide(obj);
1174 evas_object_visible_get(const Evas_Object *obj)
1176 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1179 if (obj->delete_me) return 0;
1180 return obj->cur.visible;
1184 evas_object_color_set(Evas_Object *obj, int r, int g, int b, int a)
1186 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1189 if (obj->delete_me) return;
1190 if (r > 255) r = 255; if (r < 0) r = 0;
1191 if (g > 255) g = 255; if (g < 0) g = 0;
1192 if (b > 255) b = 255; if (b < 0) b = 0;
1193 if (a > 255) a = 255; if (a < 0) a = 0;
1197 ERR("Evas only handles pre multiplied colors!");
1202 ERR("Evas only handles pre multiplied colors!");
1207 ERR("Evas only handles pre multiplied colors!");
1210 if (evas_object_intercept_call_color_set(obj, r, g, b, a)) return;
1211 if (obj->smart.smart)
1213 if (obj->smart.smart->smart_class->color_set)
1214 obj->smart.smart->smart_class->color_set(obj, r, g, b, a);
1216 if ((obj->cur.color.r == r) &&
1217 (obj->cur.color.g == g) &&
1218 (obj->cur.color.b == b) &&
1219 (obj->cur.color.a == a)) return;
1220 obj->cur.color.r = r;
1221 obj->cur.color.g = g;
1222 obj->cur.color.b = b;
1223 evas_object_clip_dirty(obj);
1225 if ((obj->cur.color.a == 0) && (a == 0) && (obj->cur.render_op == EVAS_RENDER_BLEND)) return;
1226 obj->cur.color.a = a;
1227 obj->changed_color = EINA_TRUE;
1228 evas_object_change(obj);
1232 evas_object_color_get(const Evas_Object *obj, int *r, int *g, int *b, int *a)
1234 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1235 if (r) *r = 0; if (g) *g = 0; if (b) *b = 0; if (a) *a = 0;
1240 if (r) *r = 0; if (g) *g = 0; if (b) *b = 0; if (a) *a = 0;
1243 if (r) *r = obj->cur.color.r;
1244 if (g) *g = obj->cur.color.g;
1245 if (b) *b = obj->cur.color.b;
1246 if (a) *a = obj->cur.color.a;
1250 evas_object_anti_alias_set(Evas_Object *obj, Eina_Bool anti_alias)
1252 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1255 if (obj->delete_me) return;
1256 anti_alias = !!anti_alias;
1257 if (obj->cur.anti_alias == anti_alias)return;
1258 obj->cur.anti_alias = anti_alias;
1259 evas_object_change(obj);
1263 evas_object_anti_alias_get(const Evas_Object *obj)
1265 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1268 if (obj->delete_me) return 0;
1269 return obj->cur.anti_alias;
1273 evas_object_scale_set(Evas_Object *obj, double scale)
1275 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1278 if (obj->delete_me) return;
1279 if (obj->cur.scale == scale) return;
1280 obj->cur.scale = scale;
1281 evas_object_change(obj);
1282 if (obj->func->scale_update) obj->func->scale_update(obj);
1286 evas_object_scale_get(const Evas_Object *obj)
1288 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1291 if (obj->delete_me) return 1.0;
1292 return obj->cur.scale;
1296 evas_object_render_op_set(Evas_Object *obj, Evas_Render_Op render_op)
1298 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1301 if (obj->delete_me) return;
1302 if (obj->cur.render_op == render_op) return;
1303 obj->cur.render_op = render_op;
1304 evas_object_change(obj);
1308 evas_object_render_op_get(const Evas_Object *obj)
1310 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1313 if (obj->delete_me) return EVAS_RENDER_BLEND;
1314 return obj->cur.render_op;
1318 evas_object_evas_get(const Evas_Object *obj)
1320 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1323 if (obj->delete_me) return NULL;
1324 return obj->layer->evas;
1328 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)
1333 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
1338 //// xx = evas_coord_world_x_to_screen(e, x);
1339 //// yy = evas_coord_world_y_to_screen(e, y);
1340 EINA_INLIST_REVERSE_FOREACH((EINA_INLIST_GET(e->layers)), lay)
1344 EINA_INLIST_REVERSE_FOREACH(get_layer_objects(lay), obj)
1346 if (obj->delete_me) continue;
1347 if ((!include_pass_events_objects) &&
1348 (evas_event_passes_through(obj))) continue;
1349 if ((!include_hidden_objects) && (!obj->cur.visible)) continue;
1350 evas_object_clip_recalc(obj);
1351 if ((evas_object_is_in_output_rect(obj, xx, yy, 1, 1)) &&
1352 (!obj->clip.clipees))
1360 evas_object_top_at_pointer_get(const Evas *e)
1362 return evas_object_top_at_xy_get(e, e->pointer.x, e->pointer.y, EINA_TRUE,
1367 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)
1372 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
1379 //// xx = evas_coord_world_x_to_screen(e, x);
1380 //// yy = evas_coord_world_y_to_screen(e, y);
1381 //// ww = evas_coord_world_x_to_screen(e, w);
1382 //// hh = evas_coord_world_y_to_screen(e, h);
1385 EINA_INLIST_REVERSE_FOREACH((EINA_INLIST_GET(e->layers)), lay)
1389 EINA_INLIST_REVERSE_FOREACH(get_layer_objects(lay), obj)
1391 if (obj->delete_me) continue;
1392 if ((!include_pass_events_objects) &&
1393 (evas_event_passes_through(obj))) continue;
1394 if ((!include_hidden_objects) && (!obj->cur.visible)) continue;
1395 evas_object_clip_recalc(obj);
1396 if ((evas_object_is_in_output_rect(obj, xx, yy, ww, hh)) &&
1397 (!obj->clip.clipees))
1405 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)
1407 Eina_List *in = NULL;
1411 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
1416 //// xx = evas_coord_world_x_to_screen(e, x);
1417 //// yy = evas_coord_world_y_to_screen(e, y);
1418 EINA_INLIST_REVERSE_FOREACH((EINA_INLIST_GET(e->layers)), lay)
1422 EINA_INLIST_REVERSE_FOREACH(get_layer_objects(lay), obj)
1424 if (obj->delete_me) continue;
1425 if ((!include_pass_events_objects) &&
1426 (evas_event_passes_through(obj))) continue;
1427 if ((!include_hidden_objects) && (!obj->cur.visible)) continue;
1428 evas_object_clip_recalc(obj);
1429 if ((evas_object_is_in_output_rect(obj, xx, yy, 1, 1)) &&
1430 (!obj->clip.clipees))
1431 in = eina_list_prepend(in, obj);
1438 * Retrieves the objects in the given rectangle region
1439 * @param e The given evas object.
1440 * @param x The horizontal coordinate.
1441 * @param y The vertical coordinate.
1442 * @param w The width size.
1443 * @param h The height size.
1444 * @param include_pass_events_objects Boolean Flag to include or not pass events objects
1445 * @param include_hidden_objects Boolean Flag to include or not hidden objects
1446 * @return The list of evas object in the rectangle region.
1450 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)
1452 Eina_List *in = NULL;
1456 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
1463 //// xx = evas_coord_world_x_to_screen(e, x);
1464 //// yy = evas_coord_world_y_to_screen(e, y);
1465 //// ww = evas_coord_world_x_to_screen(e, w);
1466 //// hh = evas_coord_world_y_to_screen(e, h);
1469 EINA_INLIST_REVERSE_FOREACH((EINA_INLIST_GET(e->layers)), lay)
1473 EINA_INLIST_REVERSE_FOREACH(get_layer_objects(lay), obj)
1475 if (obj->delete_me) continue;
1476 if ((!include_pass_events_objects) &&
1477 (evas_event_passes_through(obj))) continue;
1478 if ((!include_hidden_objects) && (!obj->cur.visible)) continue;
1479 evas_object_clip_recalc(obj);
1480 if ((evas_object_is_in_output_rect(obj, xx, yy, ww, hh)) &&
1481 (!obj->clip.clipees))
1482 in = eina_list_prepend(in, obj);
1489 evas_object_type_get(const Evas_Object *obj)
1491 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1494 if (obj->delete_me) return "";
1499 evas_object_precise_is_inside_set(Evas_Object *obj, Eina_Bool precise)
1501 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1504 obj->precise_is_inside = precise;
1508 evas_object_precise_is_inside_get(const Evas_Object *obj)
1510 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1513 return obj->precise_is_inside;
1517 evas_object_static_clip_set(Evas_Object *obj, Eina_Bool is_static_clip)
1519 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1522 obj->is_static_clip = is_static_clip;
1526 evas_object_static_clip_get(const Evas_Object *obj)
1528 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1531 return obj->is_static_clip;
1535 evas_object_is_frame_object_set(Evas_Object *obj, Eina_Bool is_frame)
1537 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1540 obj->is_frame = is_frame;
1544 evas_object_is_frame_object_get(Evas_Object *obj)
1546 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1549 return obj->is_frame;