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)
48 if (obj->prev.map != obj->cur.map)
49 evas_map_free(obj->prev.map);
50 if (obj->cache_map == obj->prev.map)
51 obj->cache_map = NULL;
55 if (obj->cur.map != obj->prev.map)
57 if (obj->cache_map) evas_map_free(obj->cache_map);
58 obj->cache_map = obj->prev.map;
64 evas_object_free(Evas_Object *obj, int clean_layer)
66 int was_smart_child = 0;
68 #if 0 // filtering disabled
69 evas_filter_free(obj);
71 if (!strcmp(obj->type, "image")) evas_object_image_video_surface_set(obj, NULL);
72 evas_object_map_set(obj, NULL);
73 if (obj->prev.map) evas_map_free(obj->prev.map);
74 if (obj->cache_map) evas_map_free(obj->cache_map);
77 obj->layer->evas->engine.func->image_map_surface_free
78 (obj->layer->evas->engine.data.output,
80 obj->map.surface = NULL;
82 evas_object_grabs_cleanup(obj);
83 evas_object_intercept_cleanup(obj);
84 if (obj->smart.parent) was_smart_child = 1;
85 evas_object_smart_cleanup(obj);
87 if (!was_smart_child) evas_object_release(obj, clean_layer);
88 if (obj->clip.clipees)
89 eina_list_free(obj->clip.clipees);
90 evas_object_clip_changes_clean(obj);
91 evas_object_event_callback_all_del(obj);
92 evas_object_event_callback_cleanup(obj);
98 while (obj->data.elements)
100 Evas_Data_Node *node;
102 node = obj->data.elements->data;
103 obj->data.elements = eina_list_remove(obj->data.elements, node);
109 EVAS_MEMPOOL_FREE(_mp_sh, obj->size_hints);
111 EVAS_MEMPOOL_FREE(_mp_obj, obj);
115 evas_object_change(Evas_Object *obj)
119 Eina_Bool movch = EINA_FALSE;
121 if (obj->layer->evas->nochange) return;
122 obj->layer->evas->changed = EINA_TRUE;
124 if (obj->changed_move)
127 obj->changed_move = EINA_FALSE;
130 if (obj->changed) return;
132 evas_render_object_recalc(obj);
133 /* set changed flag on all objects this one clips too */
134 if (!((movch) && (obj->is_static_clip)))
136 EINA_LIST_FOREACH(obj->clip.clipees, l, obj2)
137 evas_object_change(obj2);
139 EINA_LIST_FOREACH(obj->proxy.proxies, l, obj2)
141 evas_object_change(obj2);
143 if (obj->smart.parent) evas_object_change(obj->smart.parent);
147 evas_object_render_pre_visible_change(Eina_Array *rects, Evas_Object *obj, int is_v, int was_v)
149 if (obj->smart.smart) return;
150 if (is_v == was_v) return;
154 obj->cur.cache.clip.x,
155 obj->cur.cache.clip.y,
156 obj->cur.cache.clip.w,
157 obj->cur.cache.clip.h);
162 obj->prev.cache.clip.x,
163 obj->prev.cache.clip.y,
164 obj->prev.cache.clip.w,
165 obj->prev.cache.clip.h);
170 evas_object_render_pre_clipper_change(Eina_Array *rects, Evas_Object *obj)
172 if (obj->smart.smart) return;
173 if (obj->cur.clipper == obj->prev.clipper) return;
174 if ((obj->cur.clipper) && (obj->prev.clipper))
176 /* get difference rects between clippers */
177 evas_rects_return_difference_rects(rects,
178 obj->cur.clipper->cur.cache.clip.x,
179 obj->cur.clipper->cur.cache.clip.y,
180 obj->cur.clipper->cur.cache.clip.w,
181 obj->cur.clipper->cur.cache.clip.h,
182 obj->prev.clipper->prev.cache.clip.x,
183 obj->prev.clipper->prev.cache.clip.y,
184 obj->prev.clipper->prev.cache.clip.w,
185 obj->prev.clipper->prev.cache.clip.h);
187 else if (obj->cur.clipper)
189 evas_rects_return_difference_rects(rects,
194 //// rl = evas_rects_return_difference_rects(obj->cur.cache.geometry.x,
195 //// obj->cur.cache.geometry.y,
196 //// obj->cur.cache.geometry.w,
197 //// obj->cur.cache.geometry.h,
198 obj->cur.clipper->cur.cache.clip.x,
199 obj->cur.clipper->cur.cache.clip.y,
200 obj->cur.clipper->cur.cache.clip.w,
201 obj->cur.clipper->cur.cache.clip.h);
203 else if (obj->prev.clipper)
205 evas_rects_return_difference_rects(rects,
206 obj->prev.geometry.x,
207 obj->prev.geometry.y,
208 obj->prev.geometry.w,
209 obj->prev.geometry.h,
210 //// rl = evas_rects_return_difference_rects(obj->prev.cache.geometry.x,
211 //// obj->prev.cache.geometry.y,
212 //// obj->prev.cache.geometry.w,
213 //// obj->prev.cache.geometry.h,
214 obj->prev.clipper->prev.cache.clip.x,
215 obj->prev.clipper->prev.cache.clip.y,
216 obj->prev.clipper->prev.cache.clip.w,
217 obj->prev.clipper->prev.cache.clip.h);
222 evas_object_render_pre_prev_cur_add(Eina_Array *rects, Evas_Object *obj)
225 obj->cur.cache.clip.x,
226 obj->cur.cache.clip.y,
227 obj->cur.cache.clip.w,
228 obj->cur.cache.clip.h);
230 obj->prev.cache.clip.x,
231 obj->prev.cache.clip.y,
232 obj->prev.cache.clip.w,
233 obj->prev.cache.clip.h);
239 obj->cur.geometry.h);
240 //// obj->cur.cache.geometry.x,
241 //// obj->cur.cache.geometry.y,
242 //// obj->cur.cache.geometry.w,
243 //// obj->cur.cache.geometry.h);
245 obj->prev.geometry.x,
246 obj->prev.geometry.y,
247 obj->prev.geometry.w,
248 obj->prev.geometry.h);
249 //// obj->prev.cache.geometry.x,
250 //// obj->prev.cache.geometry.y,
251 //// obj->prev.cache.geometry.w,
252 //// obj->prev.cache.geometry.h);
257 evas_object_clip_changes_clean(Evas_Object *obj)
261 EINA_LIST_FREE(obj->clip.changes, r)
262 eina_rectangle_free(r);
266 evas_object_render_pre_effect_updates(Eina_Array *rects, Evas_Object *obj, int is_v, int was_v __UNUSED__)
269 Evas_Object *clipper;
272 Eina_Array_Iterator it;
275 if (obj->smart.smart) goto end;
276 /* FIXME: was_v isn't used... why? */
277 if (!obj->clip.clipees)
279 EINA_ARRAY_ITER_NEXT(rects, i, r, it)
281 /* get updates and clip to current clip */
286 RECTS_CLIP_TO_RECT(x, y, w, h,
287 obj->cur.cache.clip.x,
288 obj->cur.cache.clip.y,
289 obj->cur.cache.clip.w,
290 obj->cur.cache.clip.h);
291 if ((w > 0) && (h > 0))
292 obj->layer->evas->engine.func->output_redraws_rect_add(obj->layer->evas->engine.data.output,
294 /* get updates and clip to previous clip */
299 RECTS_CLIP_TO_RECT(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 if ((w > 0) && (h > 0))
305 obj->layer->evas->engine.func->output_redraws_rect_add(obj->layer->evas->engine.data.output,
308 /* if the object is actually visible, take any parent clip changes */
311 clipper = obj->cur.clipper;
314 EINA_LIST_FOREACH(clipper->clip.changes, l, r)
316 /* get updates and clip to current clip */
317 x = r->x; y = r->y; w = r->w; h = r->h;
318 RECTS_CLIP_TO_RECT(x, y, w, h,
319 obj->cur.cache.clip.x,
320 obj->cur.cache.clip.y,
321 obj->cur.cache.clip.w,
322 obj->cur.cache.clip.h);
323 if ((w > 0) && (h > 0))
324 obj->layer->evas->engine.func->output_redraws_rect_add(obj->layer->evas->engine.data.output,
326 /* get updates and clip to previous clip */
327 x = r->x; y = r->y; w = r->w; h = r->h;
328 RECTS_CLIP_TO_RECT(x, y, w, h,
329 obj->prev.cache.clip.x,
330 obj->prev.cache.clip.y,
331 obj->prev.cache.clip.w,
332 obj->prev.cache.clip.h);
333 if ((w > 0) && (h > 0))
334 obj->layer->evas->engine.func->output_redraws_rect_add(obj->layer->evas->engine.data.output,
337 clipper = clipper->cur.clipper;
343 evas_object_clip_changes_clean(obj);
344 EINA_ARRAY_ITER_NEXT(rects, i, r, it)
345 obj->clip.changes = eina_list_append(obj->clip.changes, r);
346 eina_array_clean(rects);
350 EINA_ARRAY_ITER_NEXT(rects, i, r, it)
351 eina_rectangle_free(r);
352 eina_array_clean(rects);
356 evas_object_was_in_output_rect(Evas_Object *obj, int x, int y, int w, int h)
358 if (obj->smart.smart && !obj->prev.map && !obj->prev.usemap) return 0;
359 /* assumes coords have been recalced */
360 if ((RECTS_INTERSECT(x, y, w, h,
361 obj->prev.cache.clip.x,
362 obj->prev.cache.clip.y,
363 obj->prev.cache.clip.w,
364 obj->prev.cache.clip.h)))
370 evas_object_was_opaque(Evas_Object *obj)
372 if (obj->smart.smart) return 0;
373 if (obj->prev.cache.clip.a == 255)
375 if (obj->func->was_opaque)
376 return obj->func->was_opaque(obj);
383 evas_object_is_inside(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
385 if (obj->smart.smart) return 0;
386 if (obj->func->is_inside)
387 return obj->func->is_inside(obj, x, y);
392 evas_object_was_inside(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
394 if (obj->smart.smart) return 0;
395 if (obj->func->was_inside)
396 return obj->func->was_inside(obj, x, y);
399 /* routines apps will call */
402 evas_object_ref(Evas_Object *obj)
404 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
411 evas_object_unref(Evas_Object *obj)
413 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
416 if (obj->ref == 0) return;
418 if ((obj->del_ref) && (obj->ref == 0)) evas_object_del(obj);
422 evas_object_ref_get(const Evas_Object *obj)
424 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
431 evas_object_del(Evas_Object *obj)
434 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
438 if (obj->delete_me) return;
442 obj->del_ref = EINA_TRUE;
446 evas_object_hide(obj);
449 obj->focused = EINA_FALSE;
450 obj->layer->evas->focused = NULL;
451 _evas_object_event_new();
452 evas_object_event_callback_call(obj, EVAS_CALLBACK_FOCUS_OUT, NULL, _evas_event_counter);
453 _evas_post_event_callback_call(obj->layer->evas);
455 _evas_object_event_new();
456 evas_object_event_callback_call(obj, EVAS_CALLBACK_DEL, NULL, _evas_event_counter);
457 _evas_post_event_callback_call(obj->layer->evas);
458 if (obj->mouse_grabbed > 0)
459 obj->layer->evas->pointer.mouse_grabbed -= obj->mouse_grabbed;
460 if ((obj->mouse_in) || (obj->mouse_grabbed > 0))
461 obj->layer->evas->pointer.object.in = eina_list_remove(obj->layer->evas->pointer.object.in, obj);
462 obj->mouse_grabbed = 0;
464 if (obj->name) evas_object_name_set(obj, NULL);
467 evas_object_free(obj, 1);
470 evas_object_grabs_cleanup(obj);
471 while (obj->clip.clipees)
472 evas_object_clip_unset(obj->clip.clipees->data);
473 while (obj->proxy.proxies)
474 evas_object_image_source_unset(obj->proxy.proxies->data);
475 if (obj->cur.clipper) evas_object_clip_unset(obj);
476 evas_object_map_set(obj, NULL);
477 if (obj->smart.smart) evas_object_smart_del(obj);
478 _evas_object_event_new();
479 evas_object_event_callback_call(obj, EVAS_CALLBACK_FREE, NULL, _evas_event_counter);
480 _evas_post_event_callback_call(obj->layer->evas);
481 evas_object_smart_cleanup(obj);
483 evas_object_change(obj);
487 evas_object_update_bounding_box(Evas_Object *obj)
489 Eina_Bool propagate = EINA_FALSE;
490 Eina_Bool computeminmax = EINA_FALSE;
491 Evas_Coord x, y, w, h;
492 Evas_Coord px, py, pw, ph;
495 if (!obj->smart.parent) return ;
496 if (obj->child_has_map) return ; /* Disable bounding box computation for this object and its parent */
497 /* We could also remove object that are not visible from the bounding box, use the clipping information
498 to reduce the bounding of the object they are clipping, but for the moment this will do it's jobs */
499 noclip = !(obj->clip.clipees || obj->is_static_clip);
501 if (obj->smart.smart)
503 x = obj->cur.bounding_box.x;
504 y = obj->cur.bounding_box.y;
505 w = obj->cur.bounding_box.w;
506 h = obj->cur.bounding_box.h;
507 px = obj->prev.bounding_box.x;
508 py = obj->prev.bounding_box.y;
509 pw = obj->prev.bounding_box.w;
510 ph = obj->prev.bounding_box.h;
514 x = obj->cur.geometry.x;
515 y = obj->cur.geometry.y;
516 w = obj->cur.geometry.w;
517 h = obj->cur.geometry.h;
518 px = obj->prev.geometry.x;
519 py = obj->prev.geometry.y;
520 pw = obj->prev.geometry.w;
521 ph = obj->prev.geometry.h;
524 /* We are not yet trying to find the smallest bounding box, but we want to find a good approximation quickly.
525 * That's why we initialiaze min and max search to geometry of the parent object.
528 if (obj->smart.parent->cur.valid_bounding_box)
530 /* Update left limit */
531 if (noclip && x < obj->smart.parent->cur.bounding_box.x)
533 obj->smart.parent->cur.bounding_box.w += obj->smart.parent->cur.bounding_box.x - x;
534 obj->smart.parent->cur.bounding_box.x = x;
535 propagate = EINA_TRUE;
537 else if ((px == obj->smart.parent->prev.bounding_box.x && x > obj->smart.parent->cur.bounding_box.x)
538 || (!noclip && x == obj->smart.parent->cur.bounding_box.x))
540 computeminmax = EINA_TRUE;
543 /* Update top limit */
544 if (noclip && y < obj->smart.parent->cur.bounding_box.y)
546 obj->smart.parent->cur.bounding_box.h += obj->smart.parent->cur.bounding_box.x - x;
547 obj->smart.parent->cur.bounding_box.y = y;
548 propagate = EINA_TRUE;
550 else if ((py == obj->smart.parent->prev.bounding_box.y && y > obj->smart.parent->cur.bounding_box.y)
551 || (!noclip && y == obj->smart.parent->cur.bounding_box.y))
553 computeminmax = EINA_TRUE;
556 /* Update right limit */
557 if (noclip && x + w > obj->smart.parent->cur.bounding_box.x + obj->smart.parent->cur.bounding_box.w)
559 obj->smart.parent->cur.bounding_box.w = x + w - obj->smart.parent->cur.bounding_box.x;
560 propagate = EINA_TRUE;
562 else if ((px + pw == obj->smart.parent->prev.bounding_box.x + obj->smart.parent->prev.bounding_box.w &&
563 x + w < obj->smart.parent->cur.bounding_box.x + obj->smart.parent->cur.bounding_box.w)
564 || (!noclip && x + w == obj->smart.parent->cur.bounding_box.x + obj->smart.parent->cur.bounding_box.w))
566 computeminmax = EINA_TRUE;
569 /* Update bottom limit */
570 if (noclip && y + h > obj->smart.parent->cur.bounding_box.y + obj->smart.parent->cur.bounding_box.h)
572 obj->smart.parent->cur.bounding_box.h = y + h - obj->smart.parent->cur.bounding_box.y;
573 propagate = EINA_TRUE;
575 else if ((py + ph == obj->smart.parent->prev.bounding_box.y + obj->smart.parent->prev.bounding_box.h &&
576 y + h < obj->smart.parent->cur.bounding_box.y + obj->smart.parent->cur.bounding_box.h) ||
577 (!noclip && y + h == obj->smart.parent->cur.bounding_box.y + obj->smart.parent->cur.bounding_box.h))
579 computeminmax = EINA_TRUE;
584 evas_object_smart_need_bounding_box_update(obj->smart.parent);
591 obj->smart.parent->cur.bounding_box.x = x;
592 obj->smart.parent->cur.bounding_box.y = y;
593 obj->smart.parent->cur.bounding_box.w = w;
594 obj->smart.parent->cur.bounding_box.h = h;
595 obj->smart.parent->cur.valid_bounding_box = EINA_TRUE;
596 propagate = EINA_TRUE;
601 evas_object_update_bounding_box(obj->smart.parent);
605 evas_object_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
608 int is, was = 0, pass = 0, freeze = 0;
611 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
614 if (obj->delete_me) return;
619 evas = obj->layer->evas;
621 if ((!obj->is_frame) && (obj != evas->framespace.clip))
623 if ((!obj->smart.parent) && (obj->smart.smart))
625 nx += evas->framespace.x;
626 ny += evas->framespace.y;
630 if (evas_object_intercept_call_move(obj, nx, ny)) return;
632 if (obj->doing.in_move > 0)
634 WRN("evas_object_move() called on object %p when in the middle of moving the same object", obj);
638 if ((obj->cur.geometry.x == nx) && (obj->cur.geometry.y == ny)) return;
640 if (obj->layer->evas->events_frozen <= 0)
642 pass = evas_event_passes_through(obj);
643 freeze = evas_event_freezes_through(obj);
644 if ((!pass) && (!freeze))
645 was = evas_object_is_in_output_rect(obj,
646 obj->layer->evas->pointer.x,
647 obj->layer->evas->pointer.y, 1, 1);
649 obj->doing.in_move++;
651 if (obj->smart.smart)
653 if (obj->smart.smart->smart_class->move)
654 obj->smart.smart->smart_class->move(obj, nx, ny);
657 obj->cur.geometry.x = nx;
658 obj->cur.geometry.y = ny;
660 evas_object_update_bounding_box(obj);
662 //// obj->cur.cache.geometry.validity = 0;
663 obj->changed_move = EINA_TRUE;
664 evas_object_change(obj);
665 evas_object_clip_dirty(obj);
666 obj->doing.in_move--;
667 if (obj->layer->evas->events_frozen <= 0)
669 evas_object_recalc_clippees(obj);
672 if (!obj->smart.smart)
674 is = evas_object_is_in_output_rect(obj,
675 obj->layer->evas->pointer.x,
676 obj->layer->evas->pointer.y, 1, 1);
677 if ((is ^ was) && obj->cur.visible)
678 evas_event_feed_mouse_move(obj->layer->evas,
679 obj->layer->evas->pointer.x,
680 obj->layer->evas->pointer.y,
681 obj->layer->evas->last_timestamp,
686 evas_object_inform_call_move(obj);
690 evas_object_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
692 int is, was = 0, pass = 0, freeze =0;
694 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
697 if (obj->delete_me) return;
698 if (w < 0) w = 0; if (h < 0) h = 0;
700 if (evas_object_intercept_call_resize(obj, w, h)) return;
702 if (obj->doing.in_resize > 0)
704 WRN("evas_object_resize() called on object %p when in the middle of resizing the same object", obj);
708 if ((obj->cur.geometry.w == w) && (obj->cur.geometry.h == h)) return;
710 if (obj->layer->evas->events_frozen <= 0)
712 pass = evas_event_passes_through(obj);
713 freeze = evas_event_freezes_through(obj);
714 if ((!pass) && (!freeze))
715 was = evas_object_is_in_output_rect(obj,
716 obj->layer->evas->pointer.x,
717 obj->layer->evas->pointer.y, 1, 1);
719 obj->doing.in_resize++;
721 if (obj->smart.smart)
723 if (obj->smart.smart->smart_class->resize)
724 obj->smart.smart->smart_class->resize(obj, w, h);
727 obj->cur.geometry.w = w;
728 obj->cur.geometry.h = h;
730 evas_object_update_bounding_box(obj);
732 //// obj->cur.cache.geometry.validity = 0;
733 evas_object_change(obj);
734 evas_object_clip_dirty(obj);
735 obj->doing.in_resize--;
736 /* NB: evas_object_recalc_clippees was here previously ( < 08/07/2009) */
737 if (obj->layer->evas->events_frozen <= 0)
739 /* NB: If this creates glitches on screen then move to above position */
740 evas_object_recalc_clippees(obj);
742 // if (obj->func->coords_recalc) obj->func->coords_recalc(obj);
745 if (!obj->smart.smart)
747 is = evas_object_is_in_output_rect(obj,
748 obj->layer->evas->pointer.x,
749 obj->layer->evas->pointer.y, 1, 1);
750 if ((is ^ was) && (obj->cur.visible))
751 evas_event_feed_mouse_move(obj->layer->evas,
752 obj->layer->evas->pointer.x,
753 obj->layer->evas->pointer.y,
754 obj->layer->evas->last_timestamp,
759 evas_object_inform_call_resize(obj);
763 evas_object_geometry_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
768 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
769 if (x) *x = 0; if (y) *y = 0; if (w) *w = 0; if (h) *h = 0;
774 if (x) *x = 0; if (y) *y = 0; if (w) *w = 0; if (h) *h = 0;
778 nx = obj->cur.geometry.x;
779 ny = obj->cur.geometry.y;
781 evas = obj->layer->evas;
783 if ((!obj->is_frame) && (obj != evas->framespace.clip))
785 if ((!obj->smart.parent) && (obj->smart.smart))
787 if (nx > 0) nx -= evas->framespace.x;
788 if (ny > 0) ny -= evas->framespace.y;
794 if (w) *w = obj->cur.geometry.w;
795 if (h) *h = obj->cur.geometry.h;
799 _evas_object_size_hint_alloc(Evas_Object *obj)
801 if (obj->size_hints) return;
803 EVAS_MEMPOOL_INIT(_mp_sh, "evas_size_hints", Evas_Size_Hints, 32, );
804 obj->size_hints = EVAS_MEMPOOL_ALLOC(_mp_sh, Evas_Size_Hints);
805 if (!obj->size_hints) return;
806 EVAS_MEMPOOL_PREP(_mp_sh, obj->size_hints, Evas_Size_Hints);
807 obj->size_hints->max.w = -1;
808 obj->size_hints->max.h = -1;
809 obj->size_hints->align.x = 0.5;
810 obj->size_hints->align.y = 0.5;
811 obj->size_hints->dispmode = EVAS_DISPLAY_MODE_NONE;
814 EAPI Evas_Display_Mode
815 evas_object_size_hint_display_mode_get(const Evas_Object *obj)
817 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
818 return EVAS_DISPLAY_MODE_NONE;
820 if ((!obj->size_hints) || obj->delete_me)
821 return EVAS_DISPLAY_MODE_NONE;
822 return obj->size_hints->dispmode;
826 evas_object_size_hint_display_mode_set(Evas_Object *obj, Evas_Display_Mode dispmode)
828 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
833 _evas_object_size_hint_alloc(obj);
834 if (obj->size_hints->dispmode == dispmode) return;
835 obj->size_hints->dispmode = dispmode;
837 evas_object_inform_call_changed_size_hints(obj);
841 evas_object_size_hint_min_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
843 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
844 if (w) *w = 0; if (h) *h = 0;
847 if ((!obj->size_hints) || obj->delete_me)
849 if (w) *w = 0; if (h) *h = 0;
852 if (w) *w = obj->size_hints->min.w;
853 if (h) *h = obj->size_hints->min.h;
857 evas_object_size_hint_min_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
859 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
864 _evas_object_size_hint_alloc(obj);
865 if ((obj->size_hints->min.w == w) && (obj->size_hints->min.h == h)) return;
866 obj->size_hints->min.w = w;
867 obj->size_hints->min.h = h;
869 evas_object_inform_call_changed_size_hints(obj);
873 evas_object_size_hint_max_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
875 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
876 if (w) *w = -1; if (h) *h = -1;
879 if ((!obj->size_hints) || obj->delete_me)
881 if (w) *w = -1; if (h) *h = -1;
884 if (w) *w = obj->size_hints->max.w;
885 if (h) *h = obj->size_hints->max.h;
889 evas_object_size_hint_max_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
891 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
896 _evas_object_size_hint_alloc(obj);
897 if ((obj->size_hints->max.w == w) && (obj->size_hints->max.h == h)) return;
898 obj->size_hints->max.w = w;
899 obj->size_hints->max.h = h;
901 evas_object_inform_call_changed_size_hints(obj);
905 evas_object_size_hint_request_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
907 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
908 if (w) *w = 0; if (h) *h = 0;
911 if ((!obj->size_hints) || obj->delete_me)
913 if (w) *w = 0; if (h) *h = 0;
916 if (w) *w = obj->size_hints->request.w;
917 if (h) *h = obj->size_hints->request.h;
921 evas_object_size_hint_request_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
923 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
928 _evas_object_size_hint_alloc(obj);
929 if ((obj->size_hints->request.w == w) && (obj->size_hints->request.h == h)) return;
930 obj->size_hints->request.w = w;
931 obj->size_hints->request.h = h;
933 evas_object_inform_call_changed_size_hints(obj);
937 evas_object_size_hint_aspect_get(const Evas_Object *obj, Evas_Aspect_Control *aspect, Evas_Coord *w, Evas_Coord *h)
939 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
940 if (aspect) *aspect = EVAS_ASPECT_CONTROL_NONE;
941 if (w) *w = 0; if (h) *h = 0;
944 if ((!obj->size_hints) || obj->delete_me)
946 if (aspect) *aspect = EVAS_ASPECT_CONTROL_NONE;
947 if (w) *w = 0; if (h) *h = 0;
950 if (aspect) *aspect = obj->size_hints->aspect.mode;
951 if (w) *w = obj->size_hints->aspect.size.w;
952 if (h) *h = obj->size_hints->aspect.size.h;
956 evas_object_size_hint_aspect_set(Evas_Object *obj, Evas_Aspect_Control aspect, Evas_Coord w, Evas_Coord h)
958 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
963 _evas_object_size_hint_alloc(obj);
964 if ((obj->size_hints->aspect.mode == aspect) && (obj->size_hints->aspect.size.w == w) && (obj->size_hints->aspect.size.h == h)) return;
965 obj->size_hints->aspect.mode = aspect;
966 obj->size_hints->aspect.size.w = w;
967 obj->size_hints->aspect.size.h = h;
969 evas_object_inform_call_changed_size_hints(obj);
973 evas_object_size_hint_align_get(const Evas_Object *obj, double *x, double *y)
975 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
976 if (x) *x = 0.5; if (y) *y = 0.5;
979 if ((!obj->size_hints) || obj->delete_me)
981 if (x) *x = 0.5; if (y) *y = 0.5;
984 if (x) *x = obj->size_hints->align.x;
985 if (y) *y = obj->size_hints->align.y;
989 evas_object_size_hint_align_set(Evas_Object *obj, double x, double y)
991 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
996 _evas_object_size_hint_alloc(obj);
997 if ((obj->size_hints->align.x == x) && (obj->size_hints->align.y == y)) return;
998 obj->size_hints->align.x = x;
999 obj->size_hints->align.y = y;
1001 evas_object_inform_call_changed_size_hints(obj);
1005 evas_object_size_hint_weight_get(const Evas_Object *obj, double *x, double *y)
1007 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1008 if (x) *x = 0.0; if (y) *y = 0.0;
1011 if ((!obj->size_hints) || obj->delete_me)
1013 if (x) *x = 0.0; if (y) *y = 0.0;
1016 if (x) *x = obj->size_hints->weight.x;
1017 if (y) *y = obj->size_hints->weight.y;
1021 evas_object_size_hint_weight_set(Evas_Object *obj, double x, double y)
1023 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1028 _evas_object_size_hint_alloc(obj);
1029 if ((obj->size_hints->weight.x == x) && (obj->size_hints->weight.y == y)) return;
1030 obj->size_hints->weight.x = x;
1031 obj->size_hints->weight.y = y;
1033 evas_object_inform_call_changed_size_hints(obj);
1037 evas_object_size_hint_padding_get(const Evas_Object *obj, Evas_Coord *l, Evas_Coord *r, Evas_Coord *t, Evas_Coord *b)
1039 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1040 if (l) *l = 0; if (r) *r = 0;
1041 if (t) *t = 0; if (b) *b = 0;
1044 if ((!obj->size_hints) || obj->delete_me)
1046 if (l) *l = 0; if (r) *r = 0;
1047 if (t) *t = 0; if (b) *b = 0;
1050 if (l) *l = obj->size_hints->padding.l;
1051 if (r) *r = obj->size_hints->padding.r;
1052 if (t) *t = obj->size_hints->padding.t;
1053 if (b) *b = obj->size_hints->padding.b;
1057 evas_object_size_hint_padding_set(Evas_Object *obj, Evas_Coord l, Evas_Coord r, Evas_Coord t, Evas_Coord b)
1059 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1064 _evas_object_size_hint_alloc(obj);
1065 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;
1066 obj->size_hints->padding.l = l;
1067 obj->size_hints->padding.r = r;
1068 obj->size_hints->padding.t = t;
1069 obj->size_hints->padding.b = b;
1071 evas_object_inform_call_changed_size_hints(obj);
1075 evas_object_show(Evas_Object *obj)
1077 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1080 if (obj->delete_me) return;
1081 if (evas_object_intercept_call_show(obj)) return;
1082 if (obj->smart.smart)
1084 if (obj->smart.smart->smart_class->show)
1085 obj->smart.smart->smart_class->show(obj);
1087 if (obj->cur.visible)
1091 obj->cur.visible = 1;
1092 evas_object_change(obj);
1093 evas_object_clip_dirty(obj);
1094 if (obj->layer->evas->events_frozen <= 0)
1096 evas_object_clip_across_clippees_check(obj);
1097 evas_object_recalc_clippees(obj);
1098 if ((!evas_event_passes_through(obj)) &&
1099 (!evas_event_freezes_through(obj)))
1101 if (!obj->smart.smart)
1103 if (evas_object_is_in_output_rect(obj,
1104 obj->layer->evas->pointer.x,
1105 obj->layer->evas->pointer.y, 1, 1))
1106 evas_event_feed_mouse_move(obj->layer->evas,
1107 obj->layer->evas->pointer.x,
1108 obj->layer->evas->pointer.y,
1109 obj->layer->evas->last_timestamp,
1114 evas_object_inform_call_show(obj);
1118 evas_object_hide(Evas_Object *obj)
1120 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1123 if (obj->delete_me) return;
1124 if (evas_object_intercept_call_hide(obj)) return;
1125 if (obj->smart.smart)
1127 if (obj->smart.smart->smart_class->hide)
1128 obj->smart.smart->smart_class->hide(obj);
1130 if (!obj->cur.visible)
1134 obj->cur.visible = 0;
1135 evas_object_change(obj);
1136 evas_object_clip_dirty(obj);
1137 if (obj->layer->evas->events_frozen <= 0)
1139 evas_object_clip_across_clippees_check(obj);
1140 evas_object_recalc_clippees(obj);
1141 if ((!evas_event_passes_through(obj)) &&
1142 (!evas_event_freezes_through(obj)))
1144 if ((!obj->smart.smart) ||
1145 ((obj->cur.map) && (obj->cur.map->count == 4) && (obj->cur.usemap)))
1147 if (!obj->mouse_grabbed)
1149 if (evas_object_is_in_output_rect(obj,
1150 obj->layer->evas->pointer.x,
1151 obj->layer->evas->pointer.y, 1, 1))
1152 evas_event_feed_mouse_move(obj->layer->evas,
1153 obj->layer->evas->pointer.x,
1154 obj->layer->evas->pointer.y,
1155 obj->layer->evas->last_timestamp,
1158 /* this is at odds to handling events when an obj is moved out of the mouse
1159 * ore resized out or clipped out. if mouse is grabbed - regardless of
1160 * visibility, mouse move events should keep happening and mouse up.
1161 * for better or worse it's at least consistent.
1162 if (obj->delete_me) return;
1163 if (obj->mouse_grabbed > 0)
1164 obj->layer->evas->pointer.mouse_grabbed -= obj->mouse_grabbed;
1165 if ((obj->mouse_in) || (obj->mouse_grabbed > 0))
1166 obj->layer->evas->pointer.object.in = eina_list_remove(obj->layer->evas->pointer.object.in, obj);
1167 obj->mouse_grabbed = 0;
1168 if (obj->layer->evas->events_frozen > 0)
1175 Evas_Event_Mouse_Out ev;
1177 _evas_object_event_new();
1180 ev.buttons = obj->layer->evas->pointer.button;
1181 ev.output.x = obj->layer->evas->pointer.x;
1182 ev.output.y = obj->layer->evas->pointer.y;
1183 ev.canvas.x = obj->layer->evas->pointer.x;
1184 ev.canvas.y = obj->layer->evas->pointer.y;
1186 ev.modifiers = &(obj->layer->evas->modifiers);
1187 ev.locks = &(obj->layer->evas->locks);
1188 ev.timestamp = obj->layer->evas->last_timestamp;
1189 ev.event_flags = EVAS_EVENT_FLAG_NONE;
1190 evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_OUT, &ev);
1191 _evas_post_event_callback_call(obj->layer->evas);
1200 if (obj->mouse_grabbed > 0)
1201 obj->layer->evas->pointer.mouse_grabbed -= obj->mouse_grabbed;
1202 if ((obj->mouse_in) || (obj->mouse_grabbed > 0))
1203 obj->layer->evas->pointer.object.in = eina_list_remove(obj->layer->evas->pointer.object.in, obj);
1204 obj->mouse_grabbed = 0;
1208 evas_object_inform_call_hide(obj);
1212 evas_object_visible_get(const Evas_Object *obj)
1214 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1217 if (obj->delete_me) return 0;
1218 return obj->cur.visible;
1222 evas_object_color_set(Evas_Object *obj, int r, int g, int b, int a)
1224 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1227 if (obj->delete_me) return;
1228 if (r > 255) r = 255; if (r < 0) r = 0;
1229 if (g > 255) g = 255; if (g < 0) g = 0;
1230 if (b > 255) b = 255; if (b < 0) b = 0;
1231 if (a > 255) a = 255; if (a < 0) a = 0;
1235 ERR("Evas only handles pre multiplied colors!");
1240 ERR("Evas only handles pre multiplied colors!");
1245 ERR("Evas only handles pre multiplied colors!");
1248 if (evas_object_intercept_call_color_set(obj, r, g, b, a)) return;
1249 if (obj->smart.smart)
1251 if (obj->smart.smart->smart_class->color_set)
1252 obj->smart.smart->smart_class->color_set(obj, r, g, b, a);
1254 if ((obj->cur.color.r == r) &&
1255 (obj->cur.color.g == g) &&
1256 (obj->cur.color.b == b) &&
1257 (obj->cur.color.a == a)) return;
1258 obj->cur.color.r = r;
1259 obj->cur.color.g = g;
1260 obj->cur.color.b = b;
1261 evas_object_clip_dirty(obj);
1263 if ((obj->cur.color.a == 0) && (a == 0) && (obj->cur.render_op == EVAS_RENDER_BLEND)) return;
1264 obj->cur.color.a = a;
1265 obj->changed_color = EINA_TRUE;
1266 evas_object_change(obj);
1270 evas_object_color_get(const Evas_Object *obj, int *r, int *g, int *b, int *a)
1272 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1273 if (r) *r = 0; if (g) *g = 0; if (b) *b = 0; if (a) *a = 0;
1278 if (r) *r = 0; if (g) *g = 0; if (b) *b = 0; if (a) *a = 0;
1281 if (r) *r = obj->cur.color.r;
1282 if (g) *g = obj->cur.color.g;
1283 if (b) *b = obj->cur.color.b;
1284 if (a) *a = obj->cur.color.a;
1288 evas_object_anti_alias_set(Evas_Object *obj, Eina_Bool anti_alias)
1290 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1293 if (obj->delete_me) return;
1294 anti_alias = !!anti_alias;
1295 if (obj->cur.anti_alias == anti_alias)return;
1296 obj->cur.anti_alias = anti_alias;
1297 evas_object_change(obj);
1301 evas_object_anti_alias_get(const Evas_Object *obj)
1303 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1306 if (obj->delete_me) return 0;
1307 return obj->cur.anti_alias;
1311 evas_object_scale_set(Evas_Object *obj, double scale)
1313 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1316 if (obj->delete_me) return;
1317 if (obj->cur.scale == scale) return;
1318 obj->cur.scale = scale;
1319 evas_object_change(obj);
1320 if (obj->func->scale_update) obj->func->scale_update(obj);
1324 evas_object_scale_get(const Evas_Object *obj)
1326 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1329 if (obj->delete_me) return 1.0;
1330 return obj->cur.scale;
1334 evas_object_render_op_set(Evas_Object *obj, Evas_Render_Op render_op)
1336 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1339 if (obj->delete_me) return;
1340 if (obj->cur.render_op == render_op) return;
1341 obj->cur.render_op = render_op;
1342 evas_object_change(obj);
1346 evas_object_render_op_get(const Evas_Object *obj)
1348 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1351 if (obj->delete_me) return EVAS_RENDER_BLEND;
1352 return obj->cur.render_op;
1356 evas_object_evas_get(const Evas_Object *obj)
1358 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1361 if (obj->delete_me) return NULL;
1362 return obj->layer->evas;
1366 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)
1371 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
1376 //// xx = evas_coord_world_x_to_screen(e, x);
1377 //// yy = evas_coord_world_y_to_screen(e, y);
1378 EINA_INLIST_REVERSE_FOREACH((EINA_INLIST_GET(e->layers)), lay)
1382 EINA_INLIST_REVERSE_FOREACH(get_layer_objects(lay), obj)
1384 if (obj->delete_me) continue;
1385 if ((!include_pass_events_objects) &&
1386 (evas_event_passes_through(obj))) continue;
1387 if ((!include_hidden_objects) && (!obj->cur.visible)) continue;
1388 evas_object_clip_recalc(obj);
1389 if ((evas_object_is_in_output_rect(obj, xx, yy, 1, 1)) &&
1390 (!obj->clip.clipees))
1398 evas_object_top_at_pointer_get(const Evas *e)
1400 return evas_object_top_at_xy_get(e, e->pointer.x, e->pointer.y, EINA_TRUE,
1405 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)
1410 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
1417 //// xx = evas_coord_world_x_to_screen(e, x);
1418 //// yy = evas_coord_world_y_to_screen(e, y);
1419 //// ww = evas_coord_world_x_to_screen(e, w);
1420 //// hh = evas_coord_world_y_to_screen(e, h);
1423 EINA_INLIST_REVERSE_FOREACH((EINA_INLIST_GET(e->layers)), lay)
1427 EINA_INLIST_REVERSE_FOREACH(get_layer_objects(lay), obj)
1429 if (obj->delete_me) continue;
1430 if ((!include_pass_events_objects) &&
1431 (evas_event_passes_through(obj))) continue;
1432 if ((!include_hidden_objects) && (!obj->cur.visible)) continue;
1433 evas_object_clip_recalc(obj);
1434 if ((evas_object_is_in_output_rect(obj, xx, yy, ww, hh)) &&
1435 (!obj->clip.clipees))
1443 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)
1445 Eina_List *in = NULL;
1449 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
1454 //// xx = evas_coord_world_x_to_screen(e, x);
1455 //// yy = evas_coord_world_y_to_screen(e, y);
1456 EINA_INLIST_REVERSE_FOREACH((EINA_INLIST_GET(e->layers)), lay)
1460 EINA_INLIST_REVERSE_FOREACH(get_layer_objects(lay), obj)
1462 if (obj->delete_me) continue;
1463 if ((!include_pass_events_objects) &&
1464 (evas_event_passes_through(obj))) continue;
1465 if ((!include_hidden_objects) && (!obj->cur.visible)) continue;
1466 evas_object_clip_recalc(obj);
1467 if ((evas_object_is_in_output_rect(obj, xx, yy, 1, 1)) &&
1468 (!obj->clip.clipees))
1469 in = eina_list_prepend(in, obj);
1476 * Retrieves the objects in the given rectangle region
1477 * @param e The given evas object.
1478 * @param x The horizontal coordinate.
1479 * @param y The vertical coordinate.
1480 * @param w The width size.
1481 * @param h The height size.
1482 * @param include_pass_events_objects Boolean Flag to include or not pass events objects
1483 * @param include_hidden_objects Boolean Flag to include or not hidden objects
1484 * @return The list of evas object in the rectangle region.
1488 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)
1490 Eina_List *in = NULL;
1494 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
1501 //// xx = evas_coord_world_x_to_screen(e, x);
1502 //// yy = evas_coord_world_y_to_screen(e, y);
1503 //// ww = evas_coord_world_x_to_screen(e, w);
1504 //// hh = evas_coord_world_y_to_screen(e, h);
1507 EINA_INLIST_REVERSE_FOREACH((EINA_INLIST_GET(e->layers)), lay)
1511 EINA_INLIST_REVERSE_FOREACH(get_layer_objects(lay), obj)
1513 if (obj->delete_me) continue;
1514 if ((!include_pass_events_objects) &&
1515 (evas_event_passes_through(obj))) continue;
1516 if ((!include_hidden_objects) && (!obj->cur.visible)) continue;
1517 evas_object_clip_recalc(obj);
1518 if ((evas_object_is_in_output_rect(obj, xx, yy, ww, hh)) &&
1519 (!obj->clip.clipees))
1520 in = eina_list_prepend(in, obj);
1527 evas_object_type_get(const Evas_Object *obj)
1529 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1532 if (obj->delete_me) return "";
1537 evas_object_precise_is_inside_set(Evas_Object *obj, Eina_Bool precise)
1539 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1542 obj->precise_is_inside = precise;
1546 evas_object_precise_is_inside_get(const Evas_Object *obj)
1548 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1551 return obj->precise_is_inside;
1555 evas_object_static_clip_set(Evas_Object *obj, Eina_Bool is_static_clip)
1557 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1560 obj->is_static_clip = is_static_clip;
1564 evas_object_static_clip_get(const Evas_Object *obj)
1566 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1569 return obj->is_static_clip;
1573 evas_object_is_frame_object_set(Evas_Object *obj, Eina_Bool is_frame)
1575 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1578 obj->is_frame = is_frame;
1582 evas_object_is_frame_object_get(Evas_Object *obj)
1584 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1587 return obj->is_frame;