1 #include "evas_common.h"
2 #include "evas_private.h"
4 /* FIXME: this broken e17's mouse cursor - need to figure out why */
6 /* uncomment the next line if smart objects should be informed
7 * if they are moved to the position they are already in
8 * (e.g. if they are in 0,0 and you call evas_object_move(o, 0, 0)
10 //#define FORWARD_NOOP_MOVES_TO_SMART_OBJS
12 /* likewise, for resizes
14 //#define FORWARD_NOOP_RESIZES_TO_SMART_OBJS
16 static Evas_Object_List *
17 get_layer_objects_last(Evas_Layer *l)
19 if( !l || !l->objects ) return NULL;
21 return ((Evas_Object_List *)(l->objects))->last;
24 /* evas internal stuff */
30 obj = calloc(1, sizeof(Evas_Object));
31 if (!obj) return NULL;
33 obj->magic = MAGIC_OBJ;
39 evas_object_free(Evas_Object *obj, int clean_layer)
41 int was_smart_child = 0;
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 evas_list_free(obj->clip.clipees);
51 while (obj->clip.changes)
55 r = (Evas_Rectangle *)obj->clip.changes->data;
56 obj->clip.changes = evas_list_remove(obj->clip.changes, r);
59 evas_object_event_callback_all_del(obj);
60 evas_object_event_callback_cleanup(obj);
61 while (obj->data.elements)
65 node = obj->data.elements->data;
66 obj->data.elements = evas_list_remove(obj->data.elements, node);
70 if (obj->size_hints) free(obj->size_hints);
75 evas_object_change(Evas_Object *obj)
79 obj->layer->evas->changed = 1;
80 if (obj->changed) return;
81 evas_render_object_recalc(obj);
82 /* set changed flag on all objects this one clips too */
83 for (l = obj->clip.clipees; l; l = l->next)
84 evas_object_change((Evas_Object *)l->data);
85 if (obj->smart.parent) evas_object_change(obj->smart.parent);
89 evas_object_render_pre_visible_change(Evas_Rectangles *rects, Evas_Object *obj, int is_v, int was_v)
91 if (obj->smart.smart) return ;
92 if (is_v == was_v) return ;
96 obj->cur.cache.clip.x,
97 obj->cur.cache.clip.y,
98 obj->cur.cache.clip.w,
99 obj->cur.cache.clip.h);
104 obj->prev.cache.clip.x,
105 obj->prev.cache.clip.y,
106 obj->prev.cache.clip.w,
107 obj->prev.cache.clip.h);
112 evas_object_render_pre_clipper_change(Evas_Rectangles *rects, Evas_Object *obj)
114 if (obj->smart.smart) return ;
115 if (obj->cur.clipper == obj->prev.clipper) return ;
116 if ((obj->cur.clipper) && (obj->prev.clipper))
118 /* get difference rects between clippers */
119 evas_rects_return_difference_rects(rects,
120 obj->cur.clipper->cur.cache.clip.x,
121 obj->cur.clipper->cur.cache.clip.y,
122 obj->cur.clipper->cur.cache.clip.w,
123 obj->cur.clipper->cur.cache.clip.h,
124 obj->prev.clipper->prev.cache.clip.x,
125 obj->prev.clipper->prev.cache.clip.y,
126 obj->prev.clipper->prev.cache.clip.w,
127 obj->prev.clipper->prev.cache.clip.h);
129 else if (obj->cur.clipper)
131 evas_rects_return_difference_rects(rects,
136 //// rl = evas_rects_return_difference_rects(obj->cur.cache.geometry.x,
137 //// obj->cur.cache.geometry.y,
138 //// obj->cur.cache.geometry.w,
139 //// obj->cur.cache.geometry.h,
140 obj->cur.clipper->cur.cache.clip.x,
141 obj->cur.clipper->cur.cache.clip.y,
142 obj->cur.clipper->cur.cache.clip.w,
143 obj->cur.clipper->cur.cache.clip.h);
145 else if (obj->prev.clipper)
147 evas_rects_return_difference_rects(rects,
148 obj->prev.geometry.x,
149 obj->prev.geometry.y,
150 obj->prev.geometry.w,
151 obj->prev.geometry.h,
152 //// rl = evas_rects_return_difference_rects(obj->prev.cache.geometry.x,
153 //// obj->prev.cache.geometry.y,
154 //// obj->prev.cache.geometry.w,
155 //// obj->prev.cache.geometry.h,
156 obj->prev.clipper->prev.cache.clip.x,
157 obj->prev.clipper->prev.cache.clip.y,
158 obj->prev.clipper->prev.cache.clip.w,
159 obj->prev.clipper->prev.cache.clip.h);
164 evas_object_render_pre_prev_cur_add(Evas_Rectangles *rects, Evas_Object *obj)
170 obj->cur.geometry.h);
171 //// obj->cur.cache.geometry.x,
172 //// obj->cur.cache.geometry.y,
173 //// obj->cur.cache.geometry.w,
174 //// obj->cur.cache.geometry.h);
176 obj->prev.geometry.x,
177 obj->prev.geometry.y,
178 obj->prev.geometry.w,
179 obj->prev.geometry.h);
180 //// obj->prev.cache.geometry.x,
181 //// obj->prev.cache.geometry.y,
182 //// obj->prev.cache.geometry.w,
183 //// obj->prev.cache.geometry.h);
187 evas_object_render_pre_effect_updates(Evas_Rectangles *rects, Evas_Object *obj, int is_v, int was_v)
190 Evas_Object *clipper;
195 if (obj->smart.smart) goto end;
196 /* FIXME: was_v isn't used... why? */
198 if (!obj->clip.clipees)
200 for (i = 0; i < rects->count; ++i)
202 /* get updates and clip to current clip */
203 x = rects->array[i].x;
204 y = rects->array[i].y;
205 w = rects->array[i].w;
206 h = rects->array[i].h;
207 RECTS_CLIP_TO_RECT(x, y, w, h,
208 obj->cur.cache.clip.x,
209 obj->cur.cache.clip.y,
210 obj->cur.cache.clip.w,
211 obj->cur.cache.clip.h);
212 if ((w > 0) && (h > 0))
213 obj->layer->evas->engine.func->output_redraws_rect_add(obj->layer->evas->engine.data.output,
215 /* get updates and clip to previous clip */
216 x = rects->array[i].x;
217 y = rects->array[i].y;
218 w = rects->array[i].w;
219 h = rects->array[i].h;
220 RECTS_CLIP_TO_RECT(x, y, w, h,
221 obj->prev.cache.clip.x,
222 obj->prev.cache.clip.y,
223 obj->prev.cache.clip.w,
224 obj->prev.cache.clip.h);
225 if ((w > 0) && (h > 0))
226 obj->layer->evas->engine.func->output_redraws_rect_add(obj->layer->evas->engine.data.output,
229 /* if the object is actually visible, take any parent clip changes */
232 clipper = obj->cur.clipper;
235 for (l = clipper->clip.changes; l; l = l->next)
237 r = (Evas_Rectangle *)(l->data);
238 /* get updates and clip to current clip */
239 x = r->x; y = r->y; w = r->w; h = r->h;
240 RECTS_CLIP_TO_RECT(x, y, w, h,
241 obj->cur.cache.clip.x,
242 obj->cur.cache.clip.y,
243 obj->cur.cache.clip.w,
244 obj->cur.cache.clip.h);
245 if ((w > 0) && (h > 0))
246 obj->layer->evas->engine.func->output_redraws_rect_add(obj->layer->evas->engine.data.output,
248 /* get updates and clip to previous clip */
249 x = r->x; y = r->y; w = r->w; h = r->h;
250 RECTS_CLIP_TO_RECT(x, y, w, h,
251 obj->prev.cache.clip.x,
252 obj->prev.cache.clip.y,
253 obj->prev.cache.clip.w,
254 obj->prev.cache.clip.h);
255 if ((w > 0) && (h > 0))
256 obj->layer->evas->engine.func->output_redraws_rect_add(obj->layer->evas->engine.data.output,
259 clipper = clipper->cur.clipper;
265 while (obj->clip.changes)
267 free(obj->clip.changes->data);
268 obj->clip.changes = evas_list_remove(obj->clip.changes, obj->clip.changes->data);
270 for (i = 0; i < rects->count; ++i)
272 r = malloc(sizeof(Evas_Rectangle));
275 *r = rects->array[i];
276 obj->clip.changes = evas_list_append(obj->clip.changes, r);
288 evas_object_was_in_output_rect(Evas_Object *obj, int x, int y, int w, int h)
290 if (obj->smart.smart) return 0;
291 /* assumes coords have been recalced */
292 if ((RECTS_INTERSECT(x, y, w, h,
293 obj->prev.cache.clip.x,
294 obj->prev.cache.clip.y,
295 obj->prev.cache.clip.w,
296 obj->prev.cache.clip.h)))
302 evas_object_was_visible(Evas_Object *obj)
304 if (obj->smart.smart) return 0;
305 if ((obj->prev.visible) &&
306 (obj->prev.cache.clip.visible) &&
307 (obj->prev.cache.clip.a > 0))
309 if (obj->func->was_visible)
310 return obj->func->was_visible(obj);
317 evas_object_was_opaque(Evas_Object *obj)
319 if (obj->smart.smart) return 0;
320 if (obj->prev.cache.clip.a == 255)
322 if (obj->func->was_opaque)
323 return obj->func->was_opaque(obj);
330 evas_object_is_inside(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
332 if (obj->smart.smart) return 0;
333 if (obj->func->is_inside)
334 return obj->func->is_inside(obj, x, y);
339 evas_object_was_inside(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
341 if (obj->smart.smart) return 0;
342 if (obj->func->was_inside)
343 return obj->func->was_inside(obj, x, y);
346 /* routines apps will call */
349 * @defgroup Evas_Object_Group Generic Object Functions
351 * Functions that manipulate generic evas objects.
355 * Deletes the given evas object and frees its memory.
357 * The object's 'free' callback is called when this function is called.
358 * If the object currently has the focus, its 'focus out' callback is
361 * @param obj The given evas object.
362 * @ingroup Evas_Object_Group
365 evas_object_del(Evas_Object *obj)
367 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
371 if (obj->delete_me) return;
373 evas_object_event_callback_call(obj, EVAS_CALLBACK_DEL, NULL);
374 if (obj->name) evas_object_name_set(obj, NULL);
377 evas_object_free(obj, 1);
383 obj->layer->evas->focused = NULL;
384 evas_object_event_callback_call(obj, EVAS_CALLBACK_FOCUS_OUT, NULL);
386 obj->layer->evas->pointer.mouse_grabbed -= obj->mouse_grabbed;
387 obj->mouse_grabbed = 0;
388 evas_object_hide(obj);
389 evas_object_grabs_cleanup(obj);
390 while (obj->clip.clipees) evas_object_clip_unset(obj->clip.clipees->data);
391 if (obj->cur.clipper) evas_object_clip_unset(obj);
392 if (obj->smart.smart) evas_object_smart_del(obj);
393 evas_object_event_callback_call(obj, EVAS_CALLBACK_FREE, NULL);
394 evas_object_smart_cleanup(obj);
396 evas_object_change(obj);
400 * Moves the given evas object to the given location.
401 * @param obj The given evas object.
402 * @param x X position to move the object to, in canvas units.
403 * @param y Y position to move the object to, in canvas units.
404 * @ingroup Evas_Object_Group
407 evas_object_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
409 int is, was = 0, pass = 0;
411 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
414 if (obj->delete_me) return;
415 if (evas_object_intercept_call_move(obj, x, y)) return;
416 #ifdef FORWARD_NOOP_MOVES_TO_SMART_OBJS
417 if (obj->smart.smart)
419 if (obj->smart.smart->smart_class->move)
420 obj->smart.smart->smart_class->move(obj, x, y);
423 if ((obj->cur.geometry.x == x) &&
424 (obj->cur.geometry.y == y))
426 evas_object_inform_call_move(obj);
429 #ifndef FORWARD_NOOP_MOVES_TO_SMART_OBJS
430 if (obj->smart.smart)
432 if (obj->smart.smart->smart_class->move)
433 obj->smart.smart->smart_class->move(obj, x, y);
436 if (obj->layer->evas->events_frozen <= 0)
438 pass = evas_event_passes_through(obj);
440 was = evas_object_is_in_output_rect(obj,
441 obj->layer->evas->pointer.x,
442 obj->layer->evas->pointer.y, 1, 1);
444 obj->cur.geometry.x = x;
445 obj->cur.geometry.y = y;
446 //// obj->cur.cache.geometry.validity = 0;
447 evas_object_change(obj);
448 evas_object_clip_dirty(obj);
449 if (obj->layer->evas->events_frozen <= 0)
451 evas_object_recalc_clippees(obj);
454 if (!obj->smart.smart)
456 is = evas_object_is_in_output_rect(obj,
457 obj->layer->evas->pointer.x,
458 obj->layer->evas->pointer.y, 1, 1);
459 if ((is ^ was) && obj->cur.visible)
460 evas_event_feed_mouse_move(obj->layer->evas,
461 obj->layer->evas->pointer.x,
462 obj->layer->evas->pointer.y,
463 obj->layer->evas->last_timestamp,
468 evas_object_inform_call_move(obj);
472 * Changes the size of the given evas object.
473 * @param obj The given evas object.
474 * @param w The new width of the evas object.
475 * @param h The new height of the evas object.
476 * @ingroup Evas_Object_Group
479 evas_object_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
481 int is, was = 0, pass = 0;
483 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
486 if (obj->delete_me) return;
487 if (w < 0.0) w = 0.0; if (h < 0.0) h = 0.0;
488 if (evas_object_intercept_call_resize(obj, w, h)) return;
489 #ifdef FORWARD_NOOP_RESIZES_TO_SMART_OBJS
490 if (obj->smart.smart)
492 if (obj->smart.smart->smart_class->resize)
493 obj->smart.smart->smart_class->resize(obj, w, h);
496 if ((obj->cur.geometry.w == w) &&
497 (obj->cur.geometry.h == h))
499 evas_object_inform_call_resize(obj);
502 #ifndef FORWARD_NOOP_RESIZES_TO_SMART_OBJS
503 if (obj->smart.smart)
505 if (obj->smart.smart->smart_class->resize)
506 obj->smart.smart->smart_class->resize(obj, w, h);
509 if (obj->layer->evas->events_frozen <= 0)
511 pass = evas_event_passes_through(obj);
513 was = evas_object_is_in_output_rect(obj,
514 obj->layer->evas->pointer.x,
515 obj->layer->evas->pointer.y, 1, 1);
517 obj->cur.geometry.w = w;
518 obj->cur.geometry.h = h;
519 //// obj->cur.cache.geometry.validity = 0;
520 evas_object_change(obj);
521 evas_object_clip_dirty(obj);
522 evas_object_recalc_clippees(obj);
523 if (obj->layer->evas->events_frozen <= 0)
525 // if (obj->func->coords_recalc) obj->func->coords_recalc(obj);
528 if (!obj->smart.smart)
530 is = evas_object_is_in_output_rect(obj,
531 obj->layer->evas->pointer.x,
532 obj->layer->evas->pointer.y, 1, 1);
533 if ((is ^ was) && (obj->cur.visible))
534 evas_event_feed_mouse_move(obj->layer->evas,
535 obj->layer->evas->pointer.x,
536 obj->layer->evas->pointer.y,
537 obj->layer->evas->last_timestamp,
542 evas_object_inform_call_resize(obj);
546 * Retrieves the position and rectangular size of the given evas object.
548 * Note that if any of @p x, @p y, @p w or @p h are @c NULL, the @c NULL
549 * parameters are ignored.
551 * @param obj The given evas object.
552 * @param x Pointer to an integer in which to store the X coordinate of
554 * @param y Pointer to an integer in which to store the Y coordinate of
556 * @param w Pointer to an integer in which to store the width of the
558 * @param h Pointer to an integer in which to store the height of the
560 * @ingroup Evas_Object_Group
563 evas_object_geometry_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
565 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
566 if (x) *x = 0; if (y) *y = 0; if (w) *w = 0; if (h) *h = 0;
571 if (x) *x = 0; if (y) *y = 0; if (w) *w = 0; if (h) *h = 0;
574 if (x) *x = obj->cur.geometry.x;
575 if (y) *y = obj->cur.geometry.y;
576 if (w) *w = obj->cur.geometry.w;
577 if (h) *h = obj->cur.geometry.h;
581 * @defgroup Evas_Object_Size_Hints_Group Generic Object Size Hints Functions
583 * Functions that deals with hints about object size.
587 * Retrieves the size hint for the minimum size.
589 * This is not a size enforcement in any way, it's just a hint that should
590 * be used whenever appropriate.
592 * Note that if any of @p w or @p h are @c NULL, the @c NULL
593 * parameters are ignored.
595 * @param obj The given evas object.
596 * @param w Pointer to an integer in which to store the minimum width.
597 * @param h Pointer to an integer in which to store the minimum height.
598 * @ingroup Evas_Object_Size_Hints_Group
601 evas_object_size_hint_min_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
603 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
604 if (w) *w = 0; if (h) *h = 0;
607 if ((!obj->size_hints) || obj->delete_me)
609 if (w) *w = 0; if (h) *h = 0;
612 if (w) *w = obj->size_hints->min.w;
613 if (h) *h = obj->size_hints->min.h;
617 * Sets the size hint for the minimum size.
619 * This is not a size enforcement in any way, it's just a hint that should
620 * be used whenever appropriate.
622 * @param obj The given evas object.
623 * @param w Integer to use as the minimum width hint.
624 * @param h Integer to use as the minimum height hint.
625 * @ingroup Evas_Object_Size_Hints_Group
628 evas_object_size_hint_min_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
630 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
635 if (!obj->size_hints)
636 obj->size_hints = calloc(1, sizeof(Evas_Size_Hints));
638 obj->size_hints->min.w = w;
639 obj->size_hints->min.h = h;
641 evas_object_inform_call_changed_size_hints(obj);
645 * Retrieves the size hint for the maximum size.
647 * This is not a size enforcement in any way, it's just a hint that should
648 * be used whenever appropriate.
650 * Note that if any of @p w or @p h are @c NULL, the @c NULL
651 * parameters are ignored.
653 * @param obj The given evas object.
654 * @param w Pointer to an integer in which to store the maximum width.
655 * @param h Pointer to an integer in which to store the maximum height.
656 * @ingroup Evas_Object_Size_Hints_Group
659 evas_object_size_hint_max_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
661 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
662 if (w) *w = 0; if (h) *h = 0;
665 if ((!obj->size_hints) || obj->delete_me)
667 if (w) *w = 0; if (h) *h = 0;
670 if (w) *w = obj->size_hints->max.w;
671 if (h) *h = obj->size_hints->max.h;
675 * Sets the size hint for the maximum size.
677 * This is not a size enforcement in any way, it's just a hint that should
678 * be used whenever appropriate.
680 * @param obj The given evas object.
681 * @param w Integer to use as the maximum width hint.
682 * @param h Integer to use as the maximum height hint.
683 * @ingroup Evas_Object_Size_Hints_Group
686 evas_object_size_hint_max_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
688 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
693 if (!obj->size_hints)
694 obj->size_hints = calloc(1, sizeof(Evas_Size_Hints));
696 obj->size_hints->max.w = w;
697 obj->size_hints->max.h = h;
699 evas_object_inform_call_changed_size_hints(obj);
703 * Retrieves the size request hint.
705 * This is not a size enforcement in any way, it's just a hint that should
706 * be used whenever appropriate.
708 * Note that if any of @p w or @p h are @c NULL, the @c NULL
709 * parameters are ignored.
711 * @param obj The given evas object.
712 * @param w Pointer to an integer in which to store the requested width.
713 * @param h Pointer to an integer in which to store the requested height.
714 * @ingroup Evas_Object_Size_Hints_Group
717 evas_object_size_hint_request_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
719 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
720 if (w) *w = 0; if (h) *h = 0;
723 if ((!obj->size_hints) || obj->delete_me)
725 if (w) *w = 0; if (h) *h = 0;
728 if (w) *w = obj->size_hints->request.w;
729 if (h) *h = obj->size_hints->request.h;
733 * Sets the requested size hint.
735 * This is not a size enforcement in any way, it's just a hint that should
736 * be used whenever appropriate.
738 * @param obj The given evas object.
739 * @param w Integer to use as the preferred width hint.
740 * @param h Integer to use as the preferred height hint.
741 * @ingroup Evas_Object_Size_Hints_Group
744 evas_object_size_hint_request_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
746 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
751 if (!obj->size_hints)
752 obj->size_hints = calloc(1, sizeof(Evas_Size_Hints));
754 obj->size_hints->request.w = w;
755 obj->size_hints->request.h = h;
757 evas_object_inform_call_changed_size_hints(obj);
761 * Retrieves the size aspect control hint.
763 * This is not a size enforcement in any way, it's just a hint that should
764 * be used whenever appropriate.
766 * Note that if any of @p aspect, @p w or @p h are @c NULL, the @c NULL
767 * parameters are ignored.
769 * @param obj The given evas object.
770 * @param aspect Returns the hint on how size should be calculated.
771 * @param w Pointer to an integer in which to store the aspect width.
772 * @param h Pointer to an integer in which to store the aspect height.
773 * @ingroup Evas_Object_Size_Hints_Group
776 evas_object_size_hint_aspect_get(const Evas_Object *obj, Evas_Aspect_Control *aspect, Evas_Coord *w, Evas_Coord *h)
778 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
779 if (aspect) *aspect = EVAS_ASPECT_CONTROL_NONE;
780 if (w) *w = 0; if (h) *h = 0;
783 if ((!obj->size_hints) || obj->delete_me)
785 if (aspect) *aspect = EVAS_ASPECT_CONTROL_NONE;
786 if (w) *w = 0; if (h) *h = 0;
789 if (aspect) *aspect = obj->size_hints->aspect.mode;
790 if (w) *w = obj->size_hints->aspect.size.w;
791 if (h) *h = obj->size_hints->aspect.size.h;
795 * Sets the size aspect control hint.
797 * This is not a size enforcement in any way, it's just a hint that should
798 * be used whenever appropriate.
800 * @param obj The given evas object.
801 * @param aspect Hint on how to calculate size.
802 * @param w Integer to use as aspect width hint.
803 * @param h Integer to use as aspect height hint.
804 * @ingroup Evas_Object_Size_Hints_Group
807 evas_object_size_hint_aspect_set(Evas_Object *obj, Evas_Aspect_Control aspect, Evas_Coord w, Evas_Coord h)
809 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
814 if (!obj->size_hints)
815 obj->size_hints = calloc(1, sizeof(Evas_Size_Hints));
817 obj->size_hints->aspect.mode = aspect;
818 obj->size_hints->aspect.size.w = w;
819 obj->size_hints->aspect.size.h = h;
821 evas_object_inform_call_changed_size_hints(obj);
826 * @defgroup Evas_Object_Visibility_Group Generic Object Visibility Functions
828 * Functions that deal with the visibility of evas objects.
832 * Makes the given evas object visible.
833 * @param obj The given evas object.
834 * @ingroup Evas_Object_Visibility_Group
837 evas_object_show(Evas_Object *obj)
839 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
842 if (obj->delete_me) return;
843 if (evas_object_intercept_call_show(obj)) return;
844 if (obj->smart.smart)
846 if (obj->smart.smart->smart_class->show)
847 obj->smart.smart->smart_class->show(obj);
849 if (obj->cur.visible)
851 evas_object_inform_call_show(obj);
854 obj->cur.visible = 1;
855 evas_object_change(obj);
856 evas_object_clip_dirty(obj);
857 if (obj->layer->evas->events_frozen <= 0)
859 evas_object_recalc_clippees(obj);
860 if (!evas_event_passes_through(obj))
862 if (!obj->smart.smart)
864 if (evas_object_is_in_output_rect(obj,
865 obj->layer->evas->pointer.x,
866 obj->layer->evas->pointer.y, 1, 1))
867 evas_event_feed_mouse_move(obj->layer->evas,
868 obj->layer->evas->pointer.x,
869 obj->layer->evas->pointer.y,
870 obj->layer->evas->last_timestamp,
875 evas_object_inform_call_show(obj);
879 * Makes the given evas object invisible.
880 * @param obj The given evas object.
881 * @ingroup Evas_Object_Visibility_Group
884 evas_object_hide(Evas_Object *obj)
886 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
889 if (obj->delete_me) return;
890 if (evas_object_intercept_call_hide(obj)) return;
891 if (obj->smart.smart)
893 if (obj->smart.smart->smart_class->hide)
894 obj->smart.smart->smart_class->hide(obj);
896 if (!obj->cur.visible)
898 evas_object_inform_call_hide(obj);
901 obj->cur.visible = 0;
902 evas_object_change(obj);
903 evas_object_clip_dirty(obj);
904 if (obj->layer->evas->events_frozen <= 0)
906 evas_object_recalc_clippees(obj);
907 if (!evas_event_passes_through(obj))
909 if (!obj->smart.smart)
911 if (evas_object_is_in_output_rect(obj,
912 obj->layer->evas->pointer.x,
913 obj->layer->evas->pointer.y, 1, 1))
914 evas_event_feed_mouse_move(obj->layer->evas,
915 obj->layer->evas->pointer.x,
916 obj->layer->evas->pointer.y,
917 obj->layer->evas->last_timestamp,
919 if (obj->delete_me) return;
920 if (obj->mouse_grabbed > 0)
922 // if (obj->layer->evas->pointer.mouse_grabbed >= obj->mouse_grabbed)
923 obj->layer->evas->pointer.mouse_grabbed -= obj->mouse_grabbed;
926 if ((obj->mouse_in) || (obj->mouse_grabbed > 0))
928 obj->layer->evas->pointer.object.in = evas_list_remove(obj->layer->evas->pointer.object.in, obj);
930 obj->mouse_grabbed = 0;
931 if (obj->layer->evas->events_frozen > 0)
938 Evas_Event_Mouse_Out ev;
941 ev.buttons = obj->layer->evas->pointer.button;
942 ev.output.x = obj->layer->evas->pointer.x;
943 ev.output.y = obj->layer->evas->pointer.y;
944 ev.canvas.x = obj->layer->evas->pointer.x;
945 ev.canvas.y = obj->layer->evas->pointer.y;
947 ev.modifiers = &(obj->layer->evas->modifiers);
948 ev.locks = &(obj->layer->evas->locks);
949 evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_OUT, &ev);
957 if ((obj->mouse_in) || (obj->mouse_grabbed > 0))
958 obj->layer->evas->pointer.object.in = evas_list_remove(obj->layer->evas->pointer.object.in, obj);
959 obj->mouse_grabbed = 0;
962 evas_object_inform_call_hide(obj);
966 * Retrieves whether or not the given evas object is visible.
967 * @param obj The given evas object.
968 * @return @c 1 if the object is visible. @c 0 otherwise.
969 * @ingroup Evas_Object_Visibility_Group
972 evas_object_visible_get(const Evas_Object *obj)
974 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
977 if (obj->delete_me) return 0;
978 return obj->cur.visible;
982 * Sets the general colour of the given evas object to the given colour.
983 * @param obj The given evas object.
984 * @param r The red component of the given colour.
985 * @param g The green component of the given colour.
986 * @param b The blue component of the given colour.
987 * @param a The alpha component of the given colour.
988 * @ingroup Evas_Object_Group
991 evas_object_color_set(Evas_Object *obj, int r, int g, int b, int a)
993 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
996 if (obj->delete_me) return;
997 if (r > 255) r = 255; if (r < 0) r = 0;
998 if (g > 255) g = 255; if (g < 0) g = 0;
999 if (b > 255) b = 255; if (b < 0) b = 0;
1000 if (a > 255) a = 255; if (a < 0) a = 0;
1001 if (evas_object_intercept_call_color_set(obj, r, g, b, a)) return;
1002 if (obj->smart.smart)
1004 if (obj->smart.smart->smart_class->color_set)
1005 obj->smart.smart->smart_class->color_set(obj, r, g, b, a);
1007 if ((obj->cur.color.r == r) &&
1008 (obj->cur.color.g == g) &&
1009 (obj->cur.color.b == b) &&
1010 (obj->cur.color.a == a)) return;
1011 obj->cur.color.r = r;
1012 obj->cur.color.g = g;
1013 obj->cur.color.b = b;
1014 if ((obj->cur.color.a == 0) && (a == 0)) return;
1015 obj->cur.color.a = a;
1016 evas_object_change(obj);
1020 * Retrieves the general colour of the given evas object.
1022 * Note that if any of @p r, @p g, @p b or @p a are @c NULL, then the
1023 * @c NULL parameters are ignored.
1025 * @param obj The given evas object.
1026 * @param r Pointer to an integer in which to store the red component of
1028 * @param g Pointer to an integer in which to store the green component of
1030 * @param b Pointer to an integer in which to store the blue component of
1032 * @param a Pointer to an integer in which to store the alpha component of
1034 * @ingroup Evas_Object_Group
1037 evas_object_color_get(const Evas_Object *obj, int *r, int *g, int *b, int *a)
1039 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1040 if (r) *r = 0; if (g) *g = 0; if (b) *b = 0; if (a) *a = 0;
1045 if (r) *r = 0; if (g) *g = 0; if (b) *b = 0; if (a) *a = 0;
1048 if (r) *r = obj->cur.color.r;
1049 if (g) *g = obj->cur.color.g;
1050 if (b) *b = obj->cur.color.b;
1051 if (a) *a = obj->cur.color.a;
1055 * Sets whether or not the given evas object is to be drawn anti_aliased.
1056 * @param obj The given evas object.
1057 * @param anti_alias. 1 if the object is to be anti_aliased, 0 otherwise.
1058 * @ingroup Evas_Object_Group
1061 evas_object_anti_alias_set(Evas_Object *obj, Evas_Bool anti_alias)
1063 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1066 if (obj->delete_me) return;
1067 if (obj->cur.anti_alias == !!anti_alias)
1069 obj->cur.anti_alias = !!anti_alias;
1070 evas_object_change(obj);
1075 * Retrieves whether or not the given evas object is to be drawn anti_aliased.
1076 * @param obj The given evas object.
1077 * @return @c 1 if the object is to be anti_aliased. @c 0 otherwise.
1078 * @ingroup Evas_Object_Group
1081 evas_object_anti_alias_get(const Evas_Object *obj)
1083 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1086 if (obj->delete_me) return 0;
1087 return obj->cur.anti_alias;
1091 * Sets the color_space to be used for linear interpolation of colors.
1092 * @param obj The given evas object.
1093 * @param color_space, one of EVAS_COLOR_SPACE_ARGB or EVAS_COLOR_SPACE_AHSV.
1094 * @ingroup Evas_Object_Group
1097 evas_object_color_interpolation_set(Evas_Object *obj, int color_space)
1099 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1102 if (obj->delete_me) return;
1103 if (obj->cur.interpolation_color_space == color_space)
1105 obj->cur.interpolation_color_space = color_space;
1106 evas_object_change(obj);
1111 * Retrieves the current value of the color space used for linear interpolation.
1112 * @param obj The given evas object.
1113 * @return @c EVAS_COLOR_SPACE_ARGB or EVAS_COLOR_SPACE_AHSV.
1114 * @ingroup Evas_Object_Group
1117 evas_object_color_interpolation_get(const Evas_Object *obj)
1119 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1122 if (obj->delete_me) return 0;
1123 return obj->cur.interpolation_color_space;
1127 * Sets the render_op to be used for rendering the evas object.
1128 * @param obj The given evas object.
1129 * @param render_op one of the Evas_Render_Op values.
1130 * @ingroup Evas_Object_Group
1133 evas_object_render_op_set(Evas_Object *obj, Evas_Render_Op render_op)
1135 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1138 if (obj->delete_me) return;
1139 if ((Evas_Render_Op)obj->cur.render_op == render_op)
1141 obj->cur.render_op = render_op;
1142 evas_object_change(obj);
1147 * Retrieves the current value of the operation used for rendering the evas object.
1148 * @param obj The given evas object.
1149 * @return one of the enumerated values in Evas_Render_Op.
1150 * @ingroup Evas_Object_Group
1153 evas_object_render_op_get(const Evas_Object *obj)
1155 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1158 if (obj->delete_me) return EVAS_RENDER_BLEND;
1159 return obj->cur.render_op;
1163 * Retrieves the evas that the given evas object is on.
1164 * @param obj The given evas object.
1165 * @return The evas that the object is on.
1166 * @ingroup Evas_Object_Group
1169 evas_object_evas_get(const Evas_Object *obj)
1171 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1174 if (obj->delete_me) return 0;
1175 return obj->layer->evas;
1179 * @defgroup Evas_Object_Finders Object Finder Functions
1181 * Functions that determine what evas objects are at a given location
1182 * or within a given region of an evas.
1188 * FIXME: To be fixed.
1189 * @ingroup Evas_Object_Finders
1192 evas_object_top_at_xy_get(const Evas *e, Evas_Coord x, Evas_Coord y, Evas_Bool include_pass_events_objects, Evas_Bool include_hidden_objects)
1194 Evas_Object_List *l;
1197 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
1202 //// xx = evas_coord_world_x_to_screen(e, x);
1203 //// yy = evas_coord_world_y_to_screen(e, y);
1204 for (l = ((Evas_Object_List *)(e->layers))->last; l; l = l->prev)
1206 Evas_Object_List *l2;
1209 lay = (Evas_Layer *)l;
1210 for (l2 = get_layer_objects_last(lay); l2; l2 = l2->prev)
1214 obj = (Evas_Object *)l2;
1215 if (obj->delete_me) continue;
1216 if ((!include_pass_events_objects) && (evas_event_passes_through(obj))) continue;
1217 if ((!include_hidden_objects) && (!obj->cur.visible)) continue;
1218 evas_object_clip_recalc(obj);
1219 if ((evas_object_is_in_output_rect(obj, xx, yy, 1, 1)) &&
1220 (!obj->clip.clipees))
1230 * FIXME: To be fixed.
1231 * @ingroup Evas_Object_Finders
1234 evas_object_top_at_pointer_get(const Evas *e)
1236 //// return evas_object_top_at_xy_get(e, e->pointer.canvas_x, e->pointer.canvas_y, 0, 0);
1237 return evas_object_top_at_xy_get(e, e->pointer.x, e->pointer.y, 1, 1);
1243 * FIXME: To be fixed.
1244 * @ingroup Evas_Object_Finders
1247 evas_object_top_in_rectangle_get(const Evas *e, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h, Evas_Bool include_pass_events_objects, Evas_Bool include_hidden_objects)
1249 Evas_Object_List *l;
1252 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
1259 //// xx = evas_coord_world_x_to_screen(e, x);
1260 //// yy = evas_coord_world_y_to_screen(e, y);
1261 //// ww = evas_coord_world_x_to_screen(e, w);
1262 //// hh = evas_coord_world_y_to_screen(e, h);
1265 for (l = ((Evas_Object_List *)(e->layers))->last; l; l = l->prev)
1267 Evas_Object_List *l2;
1270 lay = (Evas_Layer *)l;
1271 for (l2 = get_layer_objects_last(lay); l2; l2 = l2->prev)
1275 obj = (Evas_Object *)l2;
1276 if (obj->delete_me) continue;
1277 if ((!include_pass_events_objects) && (evas_event_passes_through(obj))) continue;
1278 if ((!include_hidden_objects) && (!obj->cur.visible)) continue;
1279 evas_object_clip_recalc(obj);
1280 if ((evas_object_is_in_output_rect(obj, xx, yy, ww, hh)) &&
1281 (!obj->clip.clipees))
1291 * FIXME: To be fixed.
1292 * @ingroup Evas_Object_Finders
1295 evas_objects_at_xy_get(const Evas *e, Evas_Coord x, Evas_Coord y, Evas_Bool include_pass_events_objects, Evas_Bool include_hidden_objects)
1297 Evas_List *in = NULL;
1298 Evas_Object_List *l;
1301 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
1306 //// xx = evas_coord_world_x_to_screen(e, x);
1307 //// yy = evas_coord_world_y_to_screen(e, y);
1308 for (l = ((Evas_Object_List *)(e->layers))->last; l; l = l->prev)
1310 Evas_Object_List *l2;
1313 lay = (Evas_Layer *)l;
1314 for (l2 = get_layer_objects_last(lay); l2; l2 = l2->prev)
1318 obj = (Evas_Object *)l2;
1319 if (obj->delete_me) continue;
1320 if ((!include_pass_events_objects) && (evas_event_passes_through(obj))) continue;
1321 if ((!include_hidden_objects) && (!obj->cur.visible)) continue;
1322 evas_object_clip_recalc(obj);
1323 if ((evas_object_is_in_output_rect(obj, xx, yy, 1, 1)) &&
1324 (!obj->clip.clipees))
1325 in = evas_list_prepend(in, obj);
1334 * FIXME: To be fixed.
1335 * @ingroup Evas_Object_Finders
1338 evas_objects_in_rectangle_get(const Evas *e, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h, Evas_Bool include_pass_events_objects, Evas_Bool include_hidden_objects)
1340 Evas_List *in = NULL;
1341 Evas_Object_List *l;
1344 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
1351 //// xx = evas_coord_world_x_to_screen(e, x);
1352 //// yy = evas_coord_world_y_to_screen(e, y);
1353 //// ww = evas_coord_world_x_to_screen(e, w);
1354 //// hh = evas_coord_world_y_to_screen(e, h);
1357 for (l = ((Evas_Object_List *)(e->layers))->last; l; l = l->prev)
1359 Evas_Object_List *l2;
1362 lay = (Evas_Layer *)l;
1363 for (l2 = get_layer_objects_last(lay); l2; l2 = l2->prev)
1367 obj = (Evas_Object *)l2;
1368 if (obj->delete_me) continue;
1369 if ((!include_pass_events_objects) && (evas_event_passes_through(obj))) continue;
1370 if ((!include_hidden_objects) && (!obj->cur.visible)) continue;
1371 evas_object_clip_recalc(obj);
1372 if ((evas_object_is_in_output_rect(obj, xx, yy, ww, hh)) &&
1373 (!obj->clip.clipees))
1374 in = evas_list_prepend(in, obj);
1381 * Retrieves the name of the type of the given evas object.
1382 * @param obj The given object.
1384 * @ingroup Evas_Object_Group
1387 evas_object_type_get(const Evas_Object *obj)
1389 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1392 if (obj->delete_me) return "";
1397 * Set whether to use a precise (usually expensive) point collision detection.
1398 * @param obj The given object.
1399 * @param precise wheter to use a precise point collision detection or not
1400 * The default value is false.
1401 * @ingroup Evas_Object_Group
1404 evas_object_precise_is_inside_set(Evas_Object *obj, Evas_Bool precise)
1406 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1409 obj->precise_is_inside = precise;
1413 * Determine whether an object is set to use a precise point collision detection.
1414 * @param obj The given object.
1415 * @ingroup Evas_Object_Group
1418 evas_object_precise_is_inside_get(const Evas_Object *obj)
1420 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
1423 return obj->precise_is_inside;