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, 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);
25 obj->magic = MAGIC_OBJ;
27 obj->prev.scale = 1.0;
28 obj->is_frame = EINA_FALSE;
34 evas_object_free(Evas_Object *obj, int clean_layer)
36 int was_smart_child = 0;
38 #if 0 // filtering disabled
39 evas_filter_free(obj);
41 if (!strcmp(obj->type, "image")) evas_object_image_video_surface_set(obj, NULL);
42 evas_object_map_set(obj, NULL);
43 evas_object_grabs_cleanup(obj);
44 evas_object_intercept_cleanup(obj);
45 if (obj->smart.parent) was_smart_child = 1;
46 evas_object_smart_cleanup(obj);
48 if (!was_smart_child) evas_object_release(obj, clean_layer);
49 if (obj->clip.clipees)
50 eina_list_free(obj->clip.clipees);
51 evas_object_clip_changes_clean(obj);
52 evas_object_event_callback_all_del(obj);
53 evas_object_event_callback_cleanup(obj);
54 while (obj->data.elements)
58 node = obj->data.elements->data;
59 obj->data.elements = eina_list_remove(obj->data.elements, node);
65 EVAS_MEMPOOL_FREE(_mp_sh, obj->size_hints);
67 EVAS_MEMPOOL_FREE(_mp_obj, obj);
71 evas_object_change(Evas_Object *obj)
77 if (obj->layer->evas->nochange)
79 // printf("nochange %p\n", obj);
83 // printf("ch %p\n", obj);
84 obj->layer->evas->changed = 1;
85 if (obj->changed_move)
88 obj->changed_move = EINA_FALSE;
89 if (!obj->changed_nomove) obj->changed_move_only = EINA_TRUE;
90 if (obj->changed) return;
94 obj->changed_move_only = EINA_FALSE;
95 obj->changed_nomove = EINA_TRUE;
96 if (obj->changed) return;
99 evas_render_object_recalc(obj);
100 /* set changed flag on all objects this one clips too */
101 if (!((movch) && (obj->is_static_clip)))
103 EINA_LIST_FOREACH(obj->clip.clipees, l, obj2)
104 evas_object_change(obj2);
106 EINA_LIST_FOREACH(obj->proxy.proxies, l, obj2)
108 evas_object_change(obj2);
110 if (obj->smart.parent) evas_object_change(obj->smart.parent);
114 evas_object_render_pre_visible_change(Eina_Array *rects, Evas_Object *obj, int is_v, int was_v)
116 if (obj->smart.smart) return;
117 if (is_v == was_v) return;
121 obj->cur.cache.clip.x,
122 obj->cur.cache.clip.y,
123 obj->cur.cache.clip.w,
124 obj->cur.cache.clip.h);
129 obj->prev.cache.clip.x,
130 obj->prev.cache.clip.y,
131 obj->prev.cache.clip.w,
132 obj->prev.cache.clip.h);
137 evas_object_render_pre_clipper_change(Eina_Array *rects, Evas_Object *obj)
139 if (obj->smart.smart) return;
140 if (obj->cur.clipper == obj->prev.clipper) return;
141 if ((obj->cur.clipper) && (obj->prev.clipper))
143 /* get difference rects between clippers */
144 evas_rects_return_difference_rects(rects,
145 obj->cur.clipper->cur.cache.clip.x,
146 obj->cur.clipper->cur.cache.clip.y,
147 obj->cur.clipper->cur.cache.clip.w,
148 obj->cur.clipper->cur.cache.clip.h,
149 obj->prev.clipper->prev.cache.clip.x,
150 obj->prev.clipper->prev.cache.clip.y,
151 obj->prev.clipper->prev.cache.clip.w,
152 obj->prev.clipper->prev.cache.clip.h);
154 else if (obj->cur.clipper)
156 evas_rects_return_difference_rects(rects,
161 //// rl = evas_rects_return_difference_rects(obj->cur.cache.geometry.x,
162 //// obj->cur.cache.geometry.y,
163 //// obj->cur.cache.geometry.w,
164 //// obj->cur.cache.geometry.h,
165 obj->cur.clipper->cur.cache.clip.x,
166 obj->cur.clipper->cur.cache.clip.y,
167 obj->cur.clipper->cur.cache.clip.w,
168 obj->cur.clipper->cur.cache.clip.h);
170 else if (obj->prev.clipper)
172 evas_rects_return_difference_rects(rects,
173 obj->prev.geometry.x,
174 obj->prev.geometry.y,
175 obj->prev.geometry.w,
176 obj->prev.geometry.h,
177 //// rl = evas_rects_return_difference_rects(obj->prev.cache.geometry.x,
178 //// obj->prev.cache.geometry.y,
179 //// obj->prev.cache.geometry.w,
180 //// obj->prev.cache.geometry.h,
181 obj->prev.clipper->prev.cache.clip.x,
182 obj->prev.clipper->prev.cache.clip.y,
183 obj->prev.clipper->prev.cache.clip.w,
184 obj->prev.clipper->prev.cache.clip.h);
189 evas_object_render_pre_prev_cur_add(Eina_Array *rects, Evas_Object *obj)
192 obj->cur.cache.clip.x,
193 obj->cur.cache.clip.y,
194 obj->cur.cache.clip.w,
195 obj->cur.cache.clip.h);
197 obj->prev.cache.clip.x,
198 obj->prev.cache.clip.y,
199 obj->prev.cache.clip.w,
200 obj->prev.cache.clip.h);
206 obj->cur.geometry.h);
207 //// obj->cur.cache.geometry.x,
208 //// obj->cur.cache.geometry.y,
209 //// obj->cur.cache.geometry.w,
210 //// obj->cur.cache.geometry.h);
212 obj->prev.geometry.x,
213 obj->prev.geometry.y,
214 obj->prev.geometry.w,
215 obj->prev.geometry.h);
216 //// obj->prev.cache.geometry.x,
217 //// obj->prev.cache.geometry.y,
218 //// obj->prev.cache.geometry.w,
219 //// obj->prev.cache.geometry.h);
224 evas_object_clip_changes_clean(Evas_Object *obj)
228 EINA_LIST_FREE(obj->clip.changes, r)
229 eina_rectangle_free(r);
233 evas_object_render_pre_effect_updates(Eina_Array *rects, Evas_Object *obj, int is_v, int was_v __UNUSED__)
236 Evas_Object *clipper;
239 Eina_Array_Iterator it;
242 if (obj->smart.smart) goto end;
243 /* FIXME: was_v isn't used... why? */
244 if (!obj->clip.clipees)
246 EINA_ARRAY_ITER_NEXT(rects, i, r, it)
248 /* get updates and clip to current clip */
253 RECTS_CLIP_TO_RECT(x, y, w, h,
254 obj->cur.cache.clip.x,
255 obj->cur.cache.clip.y,
256 obj->cur.cache.clip.w,
257 obj->cur.cache.clip.h);
258 if ((w > 0) && (h > 0))
259 obj->layer->evas->engine.func->output_redraws_rect_add(obj->layer->evas->engine.data.output,
261 /* get updates and clip to previous clip */
266 RECTS_CLIP_TO_RECT(x, y, w, h,
267 obj->prev.cache.clip.x,
268 obj->prev.cache.clip.y,
269 obj->prev.cache.clip.w,
270 obj->prev.cache.clip.h);
271 if ((w > 0) && (h > 0))
272 obj->layer->evas->engine.func->output_redraws_rect_add(obj->layer->evas->engine.data.output,
275 /* if the object is actually visible, take any parent clip changes */
278 clipper = obj->cur.clipper;
281 EINA_LIST_FOREACH(clipper->clip.changes, l, r)
283 /* get updates and clip to current clip */
284 x = r->x; y = r->y; w = r->w; h = r->h;
285 RECTS_CLIP_TO_RECT(x, y, w, h,
286 obj->cur.cache.clip.x,
287 obj->cur.cache.clip.y,
288 obj->cur.cache.clip.w,
289 obj->cur.cache.clip.h);
290 if ((w > 0) && (h > 0))
291 obj->layer->evas->engine.func->output_redraws_rect_add(obj->layer->evas->engine.data.output,
293 /* get updates and clip to previous clip */
294 x = r->x; y = r->y; w = r->w; h = r->h;
295 RECTS_CLIP_TO_RECT(x, y, w, h,
296 obj->prev.cache.clip.x,
297 obj->prev.cache.clip.y,
298 obj->prev.cache.clip.w,
299 obj->prev.cache.clip.h);
300 if ((w > 0) && (h > 0))
301 obj->layer->evas->engine.func->output_redraws_rect_add(obj->layer->evas->engine.data.output,
304 clipper = clipper->cur.clipper;
310 evas_object_clip_changes_clean(obj);
311 EINA_ARRAY_ITER_NEXT(rects, i, r, it)
312 obj->clip.changes = eina_list_append(obj->clip.changes, r);
313 eina_array_clean(rects);
317 EINA_ARRAY_ITER_NEXT(rects, i, r, it)
318 eina_rectangle_free(r);
319 eina_array_clean(rects);
323 evas_object_was_in_output_rect(Evas_Object *obj, int x, int y, int w, int h)
325 if (obj->smart.smart) return 0;
326 /* assumes coords have been recalced */
327 if ((RECTS_INTERSECT(x, y, w, h,
328 obj->prev.cache.clip.x,
329 obj->prev.cache.clip.y,
330 obj->prev.cache.clip.w,
331 obj->prev.cache.clip.h)))
337 evas_object_was_opaque(Evas_Object *obj)
339 if (obj->smart.smart) return 0;
340 if (obj->prev.cache.clip.a == 255)
342 if (obj->func->was_opaque)
343 return obj->func->was_opaque(obj);
350 evas_object_is_inside(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
352 if (obj->smart.smart) return 0;
353 if (obj->func->is_inside)
354 return obj->func->is_inside(obj, x, y);
359 evas_object_was_inside(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
361 if (obj->smart.smart) return 0;
362 if (obj->func->was_inside)
363 return obj->func->was_inside(obj, x, y);
366 /* routines apps will call */
369 evas_object_ref(Evas_Object *obj)
371 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
378 evas_object_unref(Evas_Object *obj)
380 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
383 if (obj->ref == 0) return;
385 if ((obj->del_ref) && (obj->ref == 0)) evas_object_del(obj);
389 evas_object_ref_get(const Evas_Object *obj)
391 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
398 evas_object_del(Evas_Object *obj)
400 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
404 if (obj->delete_me) return;
408 obj->del_ref = EINA_TRUE;
412 evas_object_hide(obj);
415 obj->focused = EINA_FALSE;
416 obj->layer->evas->focused = NULL;
417 _evas_object_event_new();
418 evas_object_event_callback_call(obj, EVAS_CALLBACK_FOCUS_OUT, NULL, _evas_event_counter);
419 _evas_post_event_callback_call(obj->layer->evas);
421 _evas_object_event_new();
422 evas_object_event_callback_call(obj, EVAS_CALLBACK_DEL, NULL, _evas_event_counter);
423 _evas_post_event_callback_call(obj->layer->evas);
424 if (obj->mouse_grabbed > 0)
425 obj->layer->evas->pointer.mouse_grabbed -= obj->mouse_grabbed;
426 if ((obj->mouse_in) || (obj->mouse_grabbed > 0))
427 obj->layer->evas->pointer.object.in = eina_list_remove(obj->layer->evas->pointer.object.in, obj);
428 obj->mouse_grabbed = 0;
430 if (obj->name) evas_object_name_set(obj, NULL);
433 evas_object_free(obj, 1);
436 evas_object_grabs_cleanup(obj);
437 while (obj->clip.clipees)
438 evas_object_clip_unset(obj->clip.clipees->data);
439 while (obj->proxy.proxies)
440 evas_object_image_source_unset(obj->proxy.proxies->data);
441 if (obj->cur.clipper) evas_object_clip_unset(obj);
442 evas_object_map_set(obj, NULL);
443 if (obj->smart.smart) evas_object_smart_del(obj);
444 _evas_object_event_new();
445 evas_object_event_callback_call(obj, EVAS_CALLBACK_FREE, NULL, _evas_event_counter);
446 _evas_post_event_callback_call(obj->layer->evas);
447 evas_object_smart_cleanup(obj);
449 evas_object_change(obj);
453 evas_object_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
455 int is, was = 0, pass = 0, freeze = 0;
458 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
461 if (obj->delete_me) return;
470 evas_output_framespace_get(obj->layer->evas, &fx, &fy, NULL, NULL);
471 if (!obj->smart.parent)
478 if (evas_object_intercept_call_move(obj, nx, ny)) return;
480 if (obj->doing.in_move > 0)
482 WRN("evas_object_move() called on object %p when in the middle of moving the same object", obj);
486 if ((obj->cur.geometry.x == nx) && (obj->cur.geometry.y == ny)) return;
488 if (obj->layer->evas->events_frozen <= 0)
490 pass = evas_event_passes_through(obj);
491 freeze = evas_event_freezes_through(obj);
492 if ((!pass) && (!freeze))
493 was = evas_object_is_in_output_rect(obj,
494 obj->layer->evas->pointer.x,
495 obj->layer->evas->pointer.y, 1, 1);
497 obj->doing.in_move++;
499 if (obj->smart.smart)
501 if (obj->smart.smart->smart_class->move)
502 obj->smart.smart->smart_class->move(obj, nx, ny);
505 obj->cur.geometry.x = nx;
506 obj->cur.geometry.y = ny;
508 //// obj->cur.cache.geometry.validity = 0;
509 obj->changed_move = EINA_TRUE;
510 evas_object_change(obj);
511 evas_object_clip_dirty(obj);
512 obj->doing.in_move--;
513 if (obj->layer->evas->events_frozen <= 0)
515 evas_object_recalc_clippees(obj);
518 if (!obj->smart.smart)
520 is = evas_object_is_in_output_rect(obj,
521 obj->layer->evas->pointer.x,
522 obj->layer->evas->pointer.y, 1, 1);
523 if ((is ^ was) && obj->cur.visible)
524 evas_event_feed_mouse_move(obj->layer->evas,
525 obj->layer->evas->pointer.x,
526 obj->layer->evas->pointer.y,
527 obj->layer->evas->last_timestamp,
532 evas_object_inform_call_move(obj);
536 evas_object_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
538 int is, was = 0, pass = 0, freeze =0;
541 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
544 if (obj->delete_me) return;
545 if (w < 0) w = 0; if (h < 0) h = 0;
553 evas_output_framespace_get(obj->layer->evas, NULL, NULL, &fw, &fh);
554 if (!obj->smart.parent)
563 if (evas_object_intercept_call_resize(obj, nw, nh)) return;
565 if (obj->doing.in_resize > 0)
567 WRN("evas_object_resize() called on object %p when in the middle of resizing the same object", obj);
571 if ((obj->cur.geometry.w == nw) && (obj->cur.geometry.h == nh)) return;
573 if (obj->layer->evas->events_frozen <= 0)
575 pass = evas_event_passes_through(obj);
576 freeze = evas_event_freezes_through(obj);
577 if ((!pass) && (!freeze))
578 was = evas_object_is_in_output_rect(obj,
579 obj->layer->evas->pointer.x,
580 obj->layer->evas->pointer.y, 1, 1);
582 obj->doing.in_resize++;
584 if (obj->smart.smart)
586 if (obj->smart.smart->smart_class->resize)
587 obj->smart.smart->smart_class->resize(obj, nw, nh);
590 obj->cur.geometry.w = nw;
591 obj->cur.geometry.h = nh;
593 //// obj->cur.cache.geometry.validity = 0;
594 evas_object_change(obj);
595 evas_object_clip_dirty(obj);
596 obj->doing.in_resize--;
597 /* NB: evas_object_recalc_clippees was here previously ( < 08/07/2009) */
598 if (obj->layer->evas->events_frozen <= 0)
600 /* NB: If this creates glitches on screen then move to above position */
601 evas_object_recalc_clippees(obj);
603 // if (obj->func->coords_recalc) obj->func->coords_recalc(obj);
606 if (!obj->smart.smart)
608 is = evas_object_is_in_output_rect(obj,
609 obj->layer->evas->pointer.x,
610 obj->layer->evas->pointer.y, 1, 1);
611 if ((is ^ was) && (obj->cur.visible))
612 evas_event_feed_mouse_move(obj->layer->evas,
613 obj->layer->evas->pointer.x,
614 obj->layer->evas->pointer.y,
615 obj->layer->evas->last_timestamp,
620 evas_object_inform_call_resize(obj);
624 evas_object_geometry_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
626 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
627 if (x) *x = 0; if (y) *y = 0; if (w) *w = 0; if (h) *h = 0;
632 if (x) *x = 0; if (y) *y = 0; if (w) *w = 0; if (h) *h = 0;
636 if (x) *x = obj->cur.geometry.x;
637 if (y) *y = obj->cur.geometry.y;
638 if (w) *w = obj->cur.geometry.w;
639 if (h) *h = obj->cur.geometry.h;
643 _evas_object_size_hint_alloc(Evas_Object *obj)
645 if (obj->size_hints) return;
647 EVAS_MEMPOOL_INIT(_mp_sh, "evas_size_hints", Evas_Size_Hints, 512, );
648 obj->size_hints = EVAS_MEMPOOL_ALLOC(_mp_sh, Evas_Size_Hints);
649 if (!obj->size_hints) return;
650 EVAS_MEMPOOL_PREP(_mp_sh, obj->size_hints, Evas_Size_Hints);
651 obj->size_hints->max.w = -1;
652 obj->size_hints->max.h = -1;
653 obj->size_hints->align.x = 0.5;
654 obj->size_hints->align.y = 0.5;
658 evas_object_size_hint_min_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
660 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
661 if (w) *w = 0; if (h) *h = 0;
664 if ((!obj->size_hints) || obj->delete_me)
666 if (w) *w = 0; if (h) *h = 0;
669 if (w) *w = obj->size_hints->min.w;
670 if (h) *h = obj->size_hints->min.h;
674 evas_object_size_hint_min_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
676 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
681 _evas_object_size_hint_alloc(obj);
682 if ((obj->size_hints->min.w == w) && (obj->size_hints->min.h == h)) return;
683 obj->size_hints->min.w = w;
684 obj->size_hints->min.h = h;
686 evas_object_inform_call_changed_size_hints(obj);
690 evas_object_size_hint_max_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
692 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
693 if (w) *w = -1; if (h) *h = -1;
696 if ((!obj->size_hints) || obj->delete_me)
698 if (w) *w = -1; if (h) *h = -1;
701 if (w) *w = obj->size_hints->max.w;
702 if (h) *h = obj->size_hints->max.h;
706 evas_object_size_hint_max_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
708 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
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;
718 evas_object_inform_call_changed_size_hints(obj);
722 evas_object_size_hint_request_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
724 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
725 if (w) *w = 0; if (h) *h = 0;
728 if ((!obj->size_hints) || obj->delete_me)
730 if (w) *w = 0; if (h) *h = 0;
733 if (w) *w = obj->size_hints->request.w;
734 if (h) *h = obj->size_hints->request.h;
738 evas_object_size_hint_request_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
740 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
745 _evas_object_size_hint_alloc(obj);
746 if ((obj->size_hints->request.w == w) && (obj->size_hints->request.h == h)) return;
747 obj->size_hints->request.w = w;
748 obj->size_hints->request.h = h;
750 evas_object_inform_call_changed_size_hints(obj);
754 evas_object_size_hint_aspect_get(const Evas_Object *obj, Evas_Aspect_Control *aspect, Evas_Coord *w, Evas_Coord *h)
756 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
757 if (aspect) *aspect = EVAS_ASPECT_CONTROL_NONE;
758 if (w) *w = 0; if (h) *h = 0;
761 if ((!obj->size_hints) || obj->delete_me)
763 if (aspect) *aspect = EVAS_ASPECT_CONTROL_NONE;
764 if (w) *w = 0; if (h) *h = 0;
767 if (aspect) *aspect = obj->size_hints->aspect.mode;
768 if (w) *w = obj->size_hints->aspect.size.w;
769 if (h) *h = obj->size_hints->aspect.size.h;
773 evas_object_size_hint_aspect_set(Evas_Object *obj, Evas_Aspect_Control aspect, Evas_Coord w, Evas_Coord h)
775 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
780 _evas_object_size_hint_alloc(obj);
781 if ((obj->size_hints->aspect.mode == aspect) && (obj->size_hints->aspect.size.w == w) && (obj->size_hints->aspect.size.h == h)) return;
782 obj->size_hints->aspect.mode = aspect;
783 obj->size_hints->aspect.size.w = w;
784 obj->size_hints->aspect.size.h = h;
786 evas_object_inform_call_changed_size_hints(obj);
790 evas_object_size_hint_align_get(const Evas_Object *obj, double *x, double *y)
792 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
793 if (x) *x = 0.5; if (y) *y = 0.5;
796 if ((!obj->size_hints) || obj->delete_me)
798 if (x) *x = 0.5; if (y) *y = 0.5;
801 if (x) *x = obj->size_hints->align.x;
802 if (y) *y = obj->size_hints->align.y;
806 evas_object_size_hint_align_set(Evas_Object *obj, double x, double y)
808 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
813 _evas_object_size_hint_alloc(obj);
814 if ((obj->size_hints->align.x == x) && (obj->size_hints->align.y == y)) return;
815 obj->size_hints->align.x = x;
816 obj->size_hints->align.y = y;
818 evas_object_inform_call_changed_size_hints(obj);
822 evas_object_size_hint_weight_get(const Evas_Object *obj, double *x, double *y)
824 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
825 if (x) *x = 0.0; if (y) *y = 0.0;
828 if ((!obj->size_hints) || obj->delete_me)
830 if (x) *x = 0.0; if (y) *y = 0.0;
833 if (x) *x = obj->size_hints->weight.x;
834 if (y) *y = obj->size_hints->weight.y;
838 evas_object_size_hint_weight_set(Evas_Object *obj, double x, double y)
840 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
845 _evas_object_size_hint_alloc(obj);
846 if ((obj->size_hints->weight.x == x) && (obj->size_hints->weight.y == y)) return;
847 obj->size_hints->weight.x = x;
848 obj->size_hints->weight.y = y;
850 evas_object_inform_call_changed_size_hints(obj);
854 evas_object_size_hint_padding_get(const Evas_Object *obj, Evas_Coord *l, Evas_Coord *r, Evas_Coord *t, Evas_Coord *b)
856 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
857 if (l) *l = 0; if (r) *r = 0;
858 if (t) *t = 0; if (b) *b = 0;
861 if ((!obj->size_hints) || obj->delete_me)
863 if (l) *l = 0; if (r) *r = 0;
864 if (t) *t = 0; if (b) *b = 0;
867 if (l) *l = obj->size_hints->padding.l;
868 if (r) *r = obj->size_hints->padding.r;
869 if (t) *t = obj->size_hints->padding.t;
870 if (b) *b = obj->size_hints->padding.b;
874 evas_object_size_hint_padding_set(Evas_Object *obj, Evas_Coord l, Evas_Coord r, Evas_Coord t, Evas_Coord b)
876 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
881 _evas_object_size_hint_alloc(obj);
882 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;
883 obj->size_hints->padding.l = l;
884 obj->size_hints->padding.r = r;
885 obj->size_hints->padding.t = t;
886 obj->size_hints->padding.b = b;
888 evas_object_inform_call_changed_size_hints(obj);
892 evas_object_show(Evas_Object *obj)
894 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
897 if (obj->delete_me) return;
898 if (evas_object_intercept_call_show(obj)) return;
899 if (obj->smart.smart)
901 if (obj->smart.smart->smart_class->show)
902 obj->smart.smart->smart_class->show(obj);
904 if (obj->cur.visible)
908 obj->cur.visible = 1;
909 evas_object_change(obj);
910 evas_object_clip_dirty(obj);
911 if (obj->layer->evas->events_frozen <= 0)
913 evas_object_clip_across_clippees_check(obj);
914 evas_object_recalc_clippees(obj);
915 if ((!evas_event_passes_through(obj)) &&
916 (!evas_event_freezes_through(obj)))
918 if (!obj->smart.smart)
920 if (evas_object_is_in_output_rect(obj,
921 obj->layer->evas->pointer.x,
922 obj->layer->evas->pointer.y, 1, 1))
923 evas_event_feed_mouse_move(obj->layer->evas,
924 obj->layer->evas->pointer.x,
925 obj->layer->evas->pointer.y,
926 obj->layer->evas->last_timestamp,
931 evas_object_inform_call_show(obj);
935 evas_object_hide(Evas_Object *obj)
937 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
940 if (obj->delete_me) return;
941 if (evas_object_intercept_call_hide(obj)) return;
942 if (obj->smart.smart)
944 if (obj->smart.smart->smart_class->hide)
945 obj->smart.smart->smart_class->hide(obj);
947 if (!obj->cur.visible)
951 obj->cur.visible = 0;
952 evas_object_change(obj);
953 evas_object_clip_dirty(obj);
954 if (obj->layer->evas->events_frozen <= 0)
956 evas_object_clip_across_clippees_check(obj);
957 evas_object_recalc_clippees(obj);
958 if ((!evas_event_passes_through(obj)) &&
959 (!evas_event_freezes_through(obj)))
961 if ((!obj->smart.smart) ||
962 ((obj->cur.map) && (obj->cur.map->count == 4) && (obj->cur.usemap)))
964 if (!obj->mouse_grabbed)
966 if (evas_object_is_in_output_rect(obj,
967 obj->layer->evas->pointer.x,
968 obj->layer->evas->pointer.y, 1, 1))
969 evas_event_feed_mouse_move(obj->layer->evas,
970 obj->layer->evas->pointer.x,
971 obj->layer->evas->pointer.y,
972 obj->layer->evas->last_timestamp,
975 /* this is at odds to handling events when an obj is moved out of the mouse
976 * ore resized out or clipped out. if mouse is grabbed - regardless of
977 * visibility, mouse move events should keep happening and mouse up.
978 * for better or worse it's at least consistent.
979 if (obj->delete_me) return;
980 if (obj->mouse_grabbed > 0)
981 obj->layer->evas->pointer.mouse_grabbed -= obj->mouse_grabbed;
982 if ((obj->mouse_in) || (obj->mouse_grabbed > 0))
983 obj->layer->evas->pointer.object.in = eina_list_remove(obj->layer->evas->pointer.object.in, obj);
984 obj->mouse_grabbed = 0;
985 if (obj->layer->evas->events_frozen > 0)
992 Evas_Event_Mouse_Out ev;
994 _evas_object_event_new();
997 ev.buttons = obj->layer->evas->pointer.button;
998 ev.output.x = obj->layer->evas->pointer.x;
999 ev.output.y = obj->layer->evas->pointer.y;
1000 ev.canvas.x = obj->layer->evas->pointer.x;
1001 ev.canvas.y = obj->layer->evas->pointer.y;
1003 ev.modifiers = &(obj->layer->evas->modifiers);
1004 ev.locks = &(obj->layer->evas->locks);
1005 ev.timestamp = obj->layer->evas->last_timestamp;
1006 ev.event_flags = EVAS_EVENT_FLAG_NONE;
1007 evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_OUT, &ev);
1008 _evas_post_event_callback_call(obj->layer->evas);
1017 if (obj->mouse_grabbed > 0)
1018 obj->layer->evas->pointer.mouse_grabbed -= obj->mouse_grabbed;
1019 if ((obj->mouse_in) || (obj->mouse_grabbed > 0))
1020 obj->layer->evas->pointer.object.in = eina_list_remove(obj->layer->evas->pointer.object.in, obj);
1021 obj->mouse_grabbed = 0;
1025 evas_object_inform_call_hide(obj);
1029 evas_object_visible_get(const Evas_Object *obj)
1031 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1034 if (obj->delete_me) return 0;
1035 return obj->cur.visible;
1039 evas_object_color_set(Evas_Object *obj, int r, int g, int b, int a)
1041 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1044 if (obj->delete_me) return;
1045 if (r > 255) r = 255; if (r < 0) r = 0;
1046 if (g > 255) g = 255; if (g < 0) g = 0;
1047 if (b > 255) b = 255; if (b < 0) b = 0;
1048 if (a > 255) a = 255; if (a < 0) a = 0;
1052 ERR("Evas only handles pre multiplied colors!");
1057 ERR("Evas only handles pre multiplied colors!");
1062 ERR("Evas only handles pre multiplied colors!");
1065 if (evas_object_intercept_call_color_set(obj, r, g, b, a)) return;
1066 if (obj->smart.smart)
1068 if (obj->smart.smart->smart_class->color_set)
1069 obj->smart.smart->smart_class->color_set(obj, r, g, b, a);
1071 if ((obj->cur.color.r == r) &&
1072 (obj->cur.color.g == g) &&
1073 (obj->cur.color.b == b) &&
1074 (obj->cur.color.a == a)) return;
1075 obj->cur.color.r = r;
1076 obj->cur.color.g = g;
1077 obj->cur.color.b = b;
1078 evas_object_clip_dirty(obj);
1079 if ((obj->cur.color.a == 0) && (a == 0) && (obj->cur.render_op == EVAS_RENDER_BLEND)) return;
1080 obj->cur.color.a = a;
1081 evas_object_change(obj);
1085 evas_object_color_get(const Evas_Object *obj, int *r, int *g, int *b, int *a)
1087 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1088 if (r) *r = 0; if (g) *g = 0; if (b) *b = 0; if (a) *a = 0;
1093 if (r) *r = 0; if (g) *g = 0; if (b) *b = 0; if (a) *a = 0;
1096 if (r) *r = obj->cur.color.r;
1097 if (g) *g = obj->cur.color.g;
1098 if (b) *b = obj->cur.color.b;
1099 if (a) *a = obj->cur.color.a;
1103 evas_object_anti_alias_set(Evas_Object *obj, Eina_Bool anti_alias)
1105 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1108 if (obj->delete_me) return;
1109 anti_alias = !!anti_alias;
1110 if (obj->cur.anti_alias == anti_alias)return;
1111 obj->cur.anti_alias = anti_alias;
1112 evas_object_change(obj);
1116 evas_object_anti_alias_get(const Evas_Object *obj)
1118 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1121 if (obj->delete_me) return 0;
1122 return obj->cur.anti_alias;
1126 evas_object_scale_set(Evas_Object *obj, double scale)
1128 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1131 if (obj->delete_me) return;
1132 if (obj->cur.scale == scale) return;
1133 obj->cur.scale = scale;
1134 evas_object_change(obj);
1135 if (obj->func->scale_update) obj->func->scale_update(obj);
1139 evas_object_scale_get(const Evas_Object *obj)
1141 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1144 if (obj->delete_me) return 1.0;
1145 return obj->cur.scale;
1149 evas_object_render_op_set(Evas_Object *obj, Evas_Render_Op render_op)
1151 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1154 if (obj->delete_me) return;
1155 if (obj->cur.render_op == render_op) return;
1156 obj->cur.render_op = render_op;
1157 evas_object_change(obj);
1161 evas_object_render_op_get(const Evas_Object *obj)
1163 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1166 if (obj->delete_me) return EVAS_RENDER_BLEND;
1167 return obj->cur.render_op;
1171 evas_object_evas_get(const Evas_Object *obj)
1173 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1176 if (obj->delete_me) return NULL;
1177 return obj->layer->evas;
1181 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)
1186 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
1191 //// xx = evas_coord_world_x_to_screen(e, x);
1192 //// yy = evas_coord_world_y_to_screen(e, y);
1193 EINA_INLIST_REVERSE_FOREACH((EINA_INLIST_GET(e->layers)), lay)
1197 EINA_INLIST_REVERSE_FOREACH(get_layer_objects(lay), obj)
1199 if (obj->delete_me) continue;
1200 if ((!include_pass_events_objects) &&
1201 (evas_event_passes_through(obj))) continue;
1202 if ((!include_hidden_objects) && (!obj->cur.visible)) continue;
1203 evas_object_clip_recalc(obj);
1204 if ((evas_object_is_in_output_rect(obj, xx, yy, 1, 1)) &&
1205 (!obj->clip.clipees))
1213 evas_object_top_at_pointer_get(const Evas *e)
1215 return evas_object_top_at_xy_get(e, e->pointer.x, e->pointer.y, EINA_TRUE,
1220 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)
1225 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
1232 //// xx = evas_coord_world_x_to_screen(e, x);
1233 //// yy = evas_coord_world_y_to_screen(e, y);
1234 //// ww = evas_coord_world_x_to_screen(e, w);
1235 //// hh = evas_coord_world_y_to_screen(e, h);
1238 EINA_INLIST_REVERSE_FOREACH((EINA_INLIST_GET(e->layers)), lay)
1242 EINA_INLIST_REVERSE_FOREACH(get_layer_objects(lay), obj)
1244 if (obj->delete_me) continue;
1245 if ((!include_pass_events_objects) &&
1246 (evas_event_passes_through(obj))) continue;
1247 if ((!include_hidden_objects) && (!obj->cur.visible)) continue;
1248 evas_object_clip_recalc(obj);
1249 if ((evas_object_is_in_output_rect(obj, xx, yy, ww, hh)) &&
1250 (!obj->clip.clipees))
1258 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)
1260 Eina_List *in = NULL;
1264 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
1269 //// xx = evas_coord_world_x_to_screen(e, x);
1270 //// yy = evas_coord_world_y_to_screen(e, y);
1271 EINA_INLIST_REVERSE_FOREACH((EINA_INLIST_GET(e->layers)), lay)
1275 EINA_INLIST_REVERSE_FOREACH(get_layer_objects(lay), obj)
1277 if (obj->delete_me) continue;
1278 if ((!include_pass_events_objects) &&
1279 (evas_event_passes_through(obj))) continue;
1280 if ((!include_hidden_objects) && (!obj->cur.visible)) continue;
1281 evas_object_clip_recalc(obj);
1282 if ((evas_object_is_in_output_rect(obj, xx, yy, 1, 1)) &&
1283 (!obj->clip.clipees))
1284 in = eina_list_prepend(in, obj);
1291 * Retrieves the objects in the given rectangle region
1292 * @param e The given evas object.
1293 * @param x The horizontal coordinate.
1294 * @param y The vertical coordinate.
1295 * @param w The width size.
1296 * @param h The height size.
1297 * @param include_pass_events_objects Boolean Flag to include or not pass events objects
1298 * @param include_hidden_objects Boolean Flag to include or not hidden objects
1299 * @return The list of evas object in the rectangle region.
1303 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)
1305 Eina_List *in = NULL;
1309 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
1316 //// xx = evas_coord_world_x_to_screen(e, x);
1317 //// yy = evas_coord_world_y_to_screen(e, y);
1318 //// ww = evas_coord_world_x_to_screen(e, w);
1319 //// hh = evas_coord_world_y_to_screen(e, h);
1322 EINA_INLIST_REVERSE_FOREACH((EINA_INLIST_GET(e->layers)), lay)
1326 EINA_INLIST_REVERSE_FOREACH(get_layer_objects(lay), obj)
1328 if (obj->delete_me) continue;
1329 if ((!include_pass_events_objects) &&
1330 (evas_event_passes_through(obj))) continue;
1331 if ((!include_hidden_objects) && (!obj->cur.visible)) continue;
1332 evas_object_clip_recalc(obj);
1333 if ((evas_object_is_in_output_rect(obj, xx, yy, ww, hh)) &&
1334 (!obj->clip.clipees))
1335 in = eina_list_prepend(in, obj);
1342 evas_object_type_get(const Evas_Object *obj)
1344 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1347 if (obj->delete_me) return "";
1352 evas_object_precise_is_inside_set(Evas_Object *obj, Eina_Bool precise)
1354 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1357 obj->precise_is_inside = precise;
1361 evas_object_precise_is_inside_get(const Evas_Object *obj)
1363 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1366 return obj->precise_is_inside;
1370 evas_object_static_clip_set(Evas_Object *obj, Eina_Bool is_static_clip)
1372 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1375 obj->is_static_clip = is_static_clip;
1379 evas_object_static_clip_get(const Evas_Object *obj)
1381 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1384 return obj->is_static_clip;
1388 evas_object_is_frame_object_set(Evas_Object *obj, Eina_Bool is_frame)
1390 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1393 obj->is_frame = is_frame;
1397 evas_object_is_frame_object_get(Evas_Object *obj)
1399 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1402 return obj->is_frame;