diff options
author | David Walter Seikel | 2012-01-04 18:41:13 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-01-04 18:41:13 +1000 |
commit | dd7595a3475407a7fa96a97393bae8c5220e8762 (patch) | |
tree | e341e911d7eb911a51684a7412ef7f7c7605d28e /libraries/evas/src/lib/canvas/evas_object_main.c | |
parent | Add the skeleton. (diff) | |
download | SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.zip SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.gz SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.bz2 SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.xz |
Add the base Enlightenment Foundation Libraries - eina, eet, evas, ecore, embryo, and edje.
Note that embryo wont be used, but I'm not sure yet if you can build edje without it.
Diffstat (limited to '')
-rw-r--r-- | libraries/evas/src/lib/canvas/evas_object_main.c | 1319 |
1 files changed, 1319 insertions, 0 deletions
diff --git a/libraries/evas/src/lib/canvas/evas_object_main.c b/libraries/evas/src/lib/canvas/evas_object_main.c new file mode 100644 index 0000000..3eaded9 --- /dev/null +++ b/libraries/evas/src/lib/canvas/evas_object_main.c | |||
@@ -0,0 +1,1319 @@ | |||
1 | #include "evas_common.h" | ||
2 | #include "evas_private.h" | ||
3 | |||
4 | EVAS_MEMPOOL(_mp_obj); | ||
5 | EVAS_MEMPOOL(_mp_sh); | ||
6 | |||
7 | static Eina_Inlist * | ||
8 | get_layer_objects(Evas_Layer *l) | ||
9 | { | ||
10 | if ((!l) || (!l->objects)) return NULL; | ||
11 | return (EINA_INLIST_GET(l->objects)); | ||
12 | } | ||
13 | |||
14 | /* evas internal stuff */ | ||
15 | Evas_Object * | ||
16 | evas_object_new(Evas *e __UNUSED__) | ||
17 | { | ||
18 | Evas_Object *obj; | ||
19 | |||
20 | EVAS_MEMPOOL_INIT(_mp_obj, "evas_object", Evas_Object, 512, NULL); | ||
21 | obj = EVAS_MEMPOOL_ALLOC(_mp_obj, Evas_Object); | ||
22 | if (!obj) return NULL; | ||
23 | EVAS_MEMPOOL_PREP(_mp_obj, obj, Evas_Object); | ||
24 | |||
25 | obj->magic = MAGIC_OBJ; | ||
26 | obj->cur.scale = 1.0; | ||
27 | obj->prev.scale = 1.0; | ||
28 | |||
29 | return obj; | ||
30 | } | ||
31 | |||
32 | void | ||
33 | evas_object_free(Evas_Object *obj, int clean_layer) | ||
34 | { | ||
35 | int was_smart_child = 0; | ||
36 | |||
37 | #if 0 // filtering disabled | ||
38 | evas_filter_free(obj); | ||
39 | #endif | ||
40 | if (!strcmp(obj->type, "image")) evas_object_image_video_surface_set(obj, NULL); | ||
41 | evas_object_map_set(obj, NULL); | ||
42 | evas_object_grabs_cleanup(obj); | ||
43 | evas_object_intercept_cleanup(obj); | ||
44 | if (obj->smart.parent) was_smart_child = 1; | ||
45 | evas_object_smart_cleanup(obj); | ||
46 | obj->func->free(obj); | ||
47 | if (!was_smart_child) evas_object_release(obj, clean_layer); | ||
48 | if (obj->clip.clipees) | ||
49 | eina_list_free(obj->clip.clipees); | ||
50 | evas_object_clip_changes_clean(obj); | ||
51 | evas_object_event_callback_all_del(obj); | ||
52 | evas_object_event_callback_cleanup(obj); | ||
53 | while (obj->data.elements) | ||
54 | { | ||
55 | Evas_Data_Node *node; | ||
56 | |||
57 | node = obj->data.elements->data; | ||
58 | obj->data.elements = eina_list_remove(obj->data.elements, node); | ||
59 | free(node); | ||
60 | } | ||
61 | obj->magic = 0; | ||
62 | if (obj->size_hints) | ||
63 | { | ||
64 | EVAS_MEMPOOL_FREE(_mp_sh, obj->size_hints); | ||
65 | } | ||
66 | EVAS_MEMPOOL_FREE(_mp_obj, obj); | ||
67 | } | ||
68 | |||
69 | void | ||
70 | evas_object_change(Evas_Object *obj) | ||
71 | { | ||
72 | Eina_List *l; | ||
73 | Evas_Object *obj2; | ||
74 | Eina_Bool movch = 0; | ||
75 | |||
76 | if (obj->layer->evas->nochange) | ||
77 | { | ||
78 | // printf("nochange %p\n", obj); | ||
79 | return; | ||
80 | } | ||
81 | // else | ||
82 | // printf("ch %p\n", obj); | ||
83 | obj->layer->evas->changed = 1; | ||
84 | if (obj->changed_move) | ||
85 | { | ||
86 | movch = 1; | ||
87 | obj->changed_move = 0; | ||
88 | if (!obj->changed_nomove) obj->changed_move_only = 1; | ||
89 | if (obj->changed) return; | ||
90 | } | ||
91 | else | ||
92 | { | ||
93 | obj->changed_move_only = 0; | ||
94 | obj->changed_nomove = 1; | ||
95 | if (obj->changed) return; | ||
96 | } | ||
97 | // obj->changed = 1; | ||
98 | evas_render_object_recalc(obj); | ||
99 | /* set changed flag on all objects this one clips too */ | ||
100 | if (!((movch) && (obj->is_static_clip))) | ||
101 | { | ||
102 | EINA_LIST_FOREACH(obj->clip.clipees, l, obj2) evas_object_change(obj2); | ||
103 | } | ||
104 | EINA_LIST_FOREACH(obj->proxy.proxies, l, obj2) | ||
105 | { | ||
106 | evas_object_change(obj2); | ||
107 | } | ||
108 | if (obj->smart.parent) evas_object_change(obj->smart.parent); | ||
109 | } | ||
110 | |||
111 | void | ||
112 | evas_object_render_pre_visible_change(Eina_Array *rects, Evas_Object *obj, int is_v, int was_v) | ||
113 | { | ||
114 | if (obj->smart.smart) return ; | ||
115 | if (is_v == was_v) return ; | ||
116 | if (is_v) | ||
117 | { | ||
118 | evas_add_rect(rects, | ||
119 | obj->cur.cache.clip.x, | ||
120 | obj->cur.cache.clip.y, | ||
121 | obj->cur.cache.clip.w, | ||
122 | obj->cur.cache.clip.h); | ||
123 | } | ||
124 | else | ||
125 | { | ||
126 | evas_add_rect(rects, | ||
127 | obj->prev.cache.clip.x, | ||
128 | obj->prev.cache.clip.y, | ||
129 | obj->prev.cache.clip.w, | ||
130 | obj->prev.cache.clip.h); | ||
131 | } | ||
132 | } | ||
133 | |||
134 | void | ||
135 | evas_object_render_pre_clipper_change(Eina_Array *rects, Evas_Object *obj) | ||
136 | { | ||
137 | if (obj->smart.smart) return ; | ||
138 | if (obj->cur.clipper == obj->prev.clipper) return ; | ||
139 | if ((obj->cur.clipper) && (obj->prev.clipper)) | ||
140 | { | ||
141 | /* get difference rects between clippers */ | ||
142 | evas_rects_return_difference_rects(rects, | ||
143 | obj->cur.clipper->cur.cache.clip.x, | ||
144 | obj->cur.clipper->cur.cache.clip.y, | ||
145 | obj->cur.clipper->cur.cache.clip.w, | ||
146 | obj->cur.clipper->cur.cache.clip.h, | ||
147 | obj->prev.clipper->prev.cache.clip.x, | ||
148 | obj->prev.clipper->prev.cache.clip.y, | ||
149 | obj->prev.clipper->prev.cache.clip.w, | ||
150 | obj->prev.clipper->prev.cache.clip.h); | ||
151 | } | ||
152 | else if (obj->cur.clipper) | ||
153 | { | ||
154 | evas_rects_return_difference_rects(rects, | ||
155 | obj->cur.geometry.x, | ||
156 | obj->cur.geometry.y, | ||
157 | obj->cur.geometry.w, | ||
158 | obj->cur.geometry.h, | ||
159 | //// rl = evas_rects_return_difference_rects(obj->cur.cache.geometry.x, | ||
160 | //// obj->cur.cache.geometry.y, | ||
161 | //// obj->cur.cache.geometry.w, | ||
162 | //// obj->cur.cache.geometry.h, | ||
163 | obj->cur.clipper->cur.cache.clip.x, | ||
164 | obj->cur.clipper->cur.cache.clip.y, | ||
165 | obj->cur.clipper->cur.cache.clip.w, | ||
166 | obj->cur.clipper->cur.cache.clip.h); | ||
167 | } | ||
168 | else if (obj->prev.clipper) | ||
169 | { | ||
170 | evas_rects_return_difference_rects(rects, | ||
171 | obj->prev.geometry.x, | ||
172 | obj->prev.geometry.y, | ||
173 | obj->prev.geometry.w, | ||
174 | obj->prev.geometry.h, | ||
175 | //// rl = evas_rects_return_difference_rects(obj->prev.cache.geometry.x, | ||
176 | //// obj->prev.cache.geometry.y, | ||
177 | //// obj->prev.cache.geometry.w, | ||
178 | //// obj->prev.cache.geometry.h, | ||
179 | obj->prev.clipper->prev.cache.clip.x, | ||
180 | obj->prev.clipper->prev.cache.clip.y, | ||
181 | obj->prev.clipper->prev.cache.clip.w, | ||
182 | obj->prev.clipper->prev.cache.clip.h); | ||
183 | } | ||
184 | } | ||
185 | |||
186 | void | ||
187 | evas_object_render_pre_prev_cur_add(Eina_Array *rects, Evas_Object *obj) | ||
188 | { | ||
189 | evas_add_rect(rects, | ||
190 | obj->cur.cache.clip.x, | ||
191 | obj->cur.cache.clip.y, | ||
192 | obj->cur.cache.clip.w, | ||
193 | obj->cur.cache.clip.h); | ||
194 | evas_add_rect(rects, | ||
195 | obj->prev.cache.clip.x, | ||
196 | obj->prev.cache.clip.y, | ||
197 | obj->prev.cache.clip.w, | ||
198 | obj->prev.cache.clip.h); | ||
199 | /* | ||
200 | evas_add_rect(rects, | ||
201 | obj->cur.geometry.x, | ||
202 | obj->cur.geometry.y, | ||
203 | obj->cur.geometry.w, | ||
204 | obj->cur.geometry.h); | ||
205 | //// obj->cur.cache.geometry.x, | ||
206 | //// obj->cur.cache.geometry.y, | ||
207 | //// obj->cur.cache.geometry.w, | ||
208 | //// obj->cur.cache.geometry.h); | ||
209 | evas_add_rect(rects, | ||
210 | obj->prev.geometry.x, | ||
211 | obj->prev.geometry.y, | ||
212 | obj->prev.geometry.w, | ||
213 | obj->prev.geometry.h); | ||
214 | //// obj->prev.cache.geometry.x, | ||
215 | //// obj->prev.cache.geometry.y, | ||
216 | //// obj->prev.cache.geometry.w, | ||
217 | //// obj->prev.cache.geometry.h); | ||
218 | */ | ||
219 | } | ||
220 | |||
221 | void | ||
222 | evas_object_clip_changes_clean(Evas_Object *obj) | ||
223 | { | ||
224 | Eina_Rectangle *r; | ||
225 | |||
226 | EINA_LIST_FREE(obj->clip.changes, r) eina_rectangle_free(r); | ||
227 | } | ||
228 | |||
229 | void | ||
230 | evas_object_render_pre_effect_updates(Eina_Array *rects, Evas_Object *obj, int is_v, int was_v) | ||
231 | { | ||
232 | Eina_Rectangle *r; | ||
233 | Evas_Object *clipper; | ||
234 | Eina_List *l; | ||
235 | unsigned int i; | ||
236 | Eina_Array_Iterator it; | ||
237 | int x, y, w, h; | ||
238 | |||
239 | if (obj->smart.smart) goto end; | ||
240 | /* FIXME: was_v isn't used... why? */ | ||
241 | was_v = 0; | ||
242 | if (!obj->clip.clipees) | ||
243 | { | ||
244 | EINA_ARRAY_ITER_NEXT(rects, i, r, it) | ||
245 | { | ||
246 | /* get updates and clip to current clip */ | ||
247 | x = r->x; | ||
248 | y = r->y; | ||
249 | w = r->w; | ||
250 | h = r->h; | ||
251 | RECTS_CLIP_TO_RECT(x, y, w, h, | ||
252 | obj->cur.cache.clip.x, | ||
253 | obj->cur.cache.clip.y, | ||
254 | obj->cur.cache.clip.w, | ||
255 | obj->cur.cache.clip.h); | ||
256 | if ((w > 0) && (h > 0)) | ||
257 | obj->layer->evas->engine.func->output_redraws_rect_add(obj->layer->evas->engine.data.output, | ||
258 | x, y, w, h); | ||
259 | /* get updates and clip to previous clip */ | ||
260 | x = r->x; | ||
261 | y = r->y; | ||
262 | w = r->w; | ||
263 | h = r->h; | ||
264 | RECTS_CLIP_TO_RECT(x, y, w, h, | ||
265 | obj->prev.cache.clip.x, | ||
266 | obj->prev.cache.clip.y, | ||
267 | obj->prev.cache.clip.w, | ||
268 | obj->prev.cache.clip.h); | ||
269 | if ((w > 0) && (h > 0)) | ||
270 | obj->layer->evas->engine.func->output_redraws_rect_add(obj->layer->evas->engine.data.output, | ||
271 | x, y, w, h); | ||
272 | } | ||
273 | /* if the object is actually visible, take any parent clip changes */ | ||
274 | if (is_v) | ||
275 | { | ||
276 | clipper = obj->cur.clipper; | ||
277 | while (clipper) | ||
278 | { | ||
279 | EINA_LIST_FOREACH(clipper->clip.changes, l, r) | ||
280 | { | ||
281 | /* get updates and clip to current clip */ | ||
282 | x = r->x; y = r->y; w = r->w; h = r->h; | ||
283 | RECTS_CLIP_TO_RECT(x, y, w, h, | ||
284 | obj->cur.cache.clip.x, | ||
285 | obj->cur.cache.clip.y, | ||
286 | obj->cur.cache.clip.w, | ||
287 | obj->cur.cache.clip.h); | ||
288 | if ((w > 0) && (h > 0)) | ||
289 | obj->layer->evas->engine.func->output_redraws_rect_add(obj->layer->evas->engine.data.output, | ||
290 | x, y, w, h); | ||
291 | /* get updates and clip to previous clip */ | ||
292 | x = r->x; y = r->y; w = r->w; h = r->h; | ||
293 | RECTS_CLIP_TO_RECT(x, y, w, h, | ||
294 | obj->prev.cache.clip.x, | ||
295 | obj->prev.cache.clip.y, | ||
296 | obj->prev.cache.clip.w, | ||
297 | obj->prev.cache.clip.h); | ||
298 | if ((w > 0) && (h > 0)) | ||
299 | obj->layer->evas->engine.func->output_redraws_rect_add(obj->layer->evas->engine.data.output, | ||
300 | x, y, w, h); | ||
301 | } | ||
302 | clipper = clipper->cur.clipper; | ||
303 | } | ||
304 | } | ||
305 | } | ||
306 | else | ||
307 | { | ||
308 | evas_object_clip_changes_clean(obj); | ||
309 | EINA_ARRAY_ITER_NEXT(rects, i, r, it) | ||
310 | obj->clip.changes = eina_list_append(obj->clip.changes, r); | ||
311 | eina_array_clean(rects); | ||
312 | } | ||
313 | |||
314 | end: | ||
315 | EINA_ARRAY_ITER_NEXT(rects, i, r, it) | ||
316 | eina_rectangle_free(r); | ||
317 | eina_array_clean(rects); | ||
318 | } | ||
319 | |||
320 | int | ||
321 | evas_object_was_in_output_rect(Evas_Object *obj, int x, int y, int w, int h) | ||
322 | { | ||
323 | if (obj->smart.smart) return 0; | ||
324 | /* assumes coords have been recalced */ | ||
325 | if ((RECTS_INTERSECT(x, y, w, h, | ||
326 | obj->prev.cache.clip.x, | ||
327 | obj->prev.cache.clip.y, | ||
328 | obj->prev.cache.clip.w, | ||
329 | obj->prev.cache.clip.h))) | ||
330 | return 1; | ||
331 | return 0; | ||
332 | } | ||
333 | |||
334 | int | ||
335 | evas_object_was_opaque(Evas_Object *obj) | ||
336 | { | ||
337 | if (obj->smart.smart) return 0; | ||
338 | if (obj->prev.cache.clip.a == 255) | ||
339 | { | ||
340 | if (obj->func->was_opaque) | ||
341 | return obj->func->was_opaque(obj); | ||
342 | return 1; | ||
343 | } | ||
344 | return 0; | ||
345 | } | ||
346 | |||
347 | int | ||
348 | evas_object_is_inside(Evas_Object *obj, Evas_Coord x, Evas_Coord y) | ||
349 | { | ||
350 | if (obj->smart.smart) return 0; | ||
351 | if (obj->func->is_inside) | ||
352 | return obj->func->is_inside(obj, x, y); | ||
353 | return 0; | ||
354 | } | ||
355 | |||
356 | int | ||
357 | evas_object_was_inside(Evas_Object *obj, Evas_Coord x, Evas_Coord y) | ||
358 | { | ||
359 | if (obj->smart.smart) return 0; | ||
360 | if (obj->func->was_inside) | ||
361 | return obj->func->was_inside(obj, x, y); | ||
362 | return 0; | ||
363 | } | ||
364 | /* routines apps will call */ | ||
365 | |||
366 | EAPI void | ||
367 | evas_object_ref(Evas_Object *obj) | ||
368 | { | ||
369 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
370 | return; | ||
371 | MAGIC_CHECK_END(); | ||
372 | obj->ref++; | ||
373 | if (obj->ref == 0) obj->ref--; | ||
374 | } | ||
375 | |||
376 | EAPI void | ||
377 | evas_object_unref(Evas_Object *obj) | ||
378 | { | ||
379 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
380 | return; | ||
381 | MAGIC_CHECK_END(); | ||
382 | if (obj->ref == 0) return; | ||
383 | obj->ref--; | ||
384 | if ((obj->del_ref) && (obj->ref == 0)) evas_object_del(obj); | ||
385 | } | ||
386 | |||
387 | EAPI void | ||
388 | evas_object_del(Evas_Object *obj) | ||
389 | { | ||
390 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
391 | return; | ||
392 | MAGIC_CHECK_END(); | ||
393 | |||
394 | if (obj->delete_me) return; | ||
395 | |||
396 | if (obj->ref > 0) | ||
397 | { | ||
398 | obj->del_ref = 1; | ||
399 | return; | ||
400 | } | ||
401 | #ifdef EVAS_FRAME_QUEUING | ||
402 | evas_common_frameq_flush(); | ||
403 | #endif | ||
404 | |||
405 | evas_object_hide(obj); | ||
406 | if (obj->focused) | ||
407 | { | ||
408 | obj->focused = 0; | ||
409 | obj->layer->evas->focused = NULL; | ||
410 | _evas_object_event_new(); | ||
411 | evas_object_event_callback_call(obj, EVAS_CALLBACK_FOCUS_OUT, NULL); | ||
412 | _evas_post_event_callback_call(obj->layer->evas); | ||
413 | } | ||
414 | _evas_object_event_new(); | ||
415 | evas_object_event_callback_call(obj, EVAS_CALLBACK_DEL, NULL); | ||
416 | _evas_post_event_callback_call(obj->layer->evas); | ||
417 | if (obj->mouse_grabbed > 0) | ||
418 | obj->layer->evas->pointer.mouse_grabbed -= obj->mouse_grabbed; | ||
419 | if ((obj->mouse_in) || (obj->mouse_grabbed > 0)) | ||
420 | obj->layer->evas->pointer.object.in = eina_list_remove(obj->layer->evas->pointer.object.in, obj); | ||
421 | obj->mouse_grabbed = 0; | ||
422 | obj->mouse_in = 0; | ||
423 | if (obj->name) evas_object_name_set(obj, NULL); | ||
424 | if (!obj->layer) | ||
425 | { | ||
426 | evas_object_free(obj, 1); | ||
427 | return; | ||
428 | } | ||
429 | obj->layer->evas->pointer.mouse_grabbed -= obj->mouse_grabbed; | ||
430 | obj->mouse_grabbed = 0; | ||
431 | obj->mouse_in = 0; | ||
432 | evas_object_grabs_cleanup(obj); | ||
433 | while (obj->clip.clipees) | ||
434 | evas_object_clip_unset(obj->clip.clipees->data); | ||
435 | while (obj->proxy.proxies) | ||
436 | evas_object_image_source_unset(obj->proxy.proxies->data); | ||
437 | if (obj->cur.clipper) evas_object_clip_unset(obj); | ||
438 | if (obj->smart.smart) evas_object_smart_del(obj); | ||
439 | evas_object_map_set(obj, NULL); | ||
440 | _evas_object_event_new(); | ||
441 | evas_object_event_callback_call(obj, EVAS_CALLBACK_FREE, NULL); | ||
442 | _evas_post_event_callback_call(obj->layer->evas); | ||
443 | evas_object_smart_cleanup(obj); | ||
444 | obj->delete_me = 1; | ||
445 | evas_object_change(obj); | ||
446 | } | ||
447 | |||
448 | EAPI void | ||
449 | evas_object_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y) | ||
450 | { | ||
451 | int is, was = 0, pass = 0, freeze = 0; | ||
452 | |||
453 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
454 | return; | ||
455 | MAGIC_CHECK_END(); | ||
456 | if (obj->delete_me) return; | ||
457 | if (evas_object_intercept_call_move(obj, x, y)) return; | ||
458 | if (obj->doing.in_move > 0) | ||
459 | { | ||
460 | WRN("evas_object_move() called on object %p when in the middle of moving the same object", obj); | ||
461 | return; | ||
462 | } | ||
463 | if ((obj->cur.geometry.x == x) && (obj->cur.geometry.y == y)) return; | ||
464 | if (obj->layer->evas->events_frozen <= 0) | ||
465 | { | ||
466 | pass = evas_event_passes_through(obj); | ||
467 | freeze = evas_event_freezes_through(obj); | ||
468 | if ((!pass) && (!freeze)) | ||
469 | was = evas_object_is_in_output_rect(obj, | ||
470 | obj->layer->evas->pointer.x, | ||
471 | obj->layer->evas->pointer.y, 1, 1); | ||
472 | } | ||
473 | obj->doing.in_move++; | ||
474 | if (obj->smart.smart) | ||
475 | { | ||
476 | if (obj->smart.smart->smart_class->move) | ||
477 | obj->smart.smart->smart_class->move(obj, x, y); | ||
478 | } | ||
479 | obj->cur.geometry.x = x; | ||
480 | obj->cur.geometry.y = y; | ||
481 | //// obj->cur.cache.geometry.validity = 0; | ||
482 | obj->changed_move = 1; | ||
483 | evas_object_change(obj); | ||
484 | evas_object_clip_dirty(obj); | ||
485 | obj->doing.in_move--; | ||
486 | if (obj->layer->evas->events_frozen <= 0) | ||
487 | { | ||
488 | evas_object_recalc_clippees(obj); | ||
489 | if (!pass) | ||
490 | { | ||
491 | if (!obj->smart.smart) | ||
492 | { | ||
493 | is = evas_object_is_in_output_rect(obj, | ||
494 | obj->layer->evas->pointer.x, | ||
495 | obj->layer->evas->pointer.y, 1, 1); | ||
496 | if ((is ^ was) && obj->cur.visible) | ||
497 | evas_event_feed_mouse_move(obj->layer->evas, | ||
498 | obj->layer->evas->pointer.x, | ||
499 | obj->layer->evas->pointer.y, | ||
500 | obj->layer->evas->last_timestamp, | ||
501 | NULL); | ||
502 | } | ||
503 | } | ||
504 | } | ||
505 | evas_object_inform_call_move(obj); | ||
506 | } | ||
507 | |||
508 | EAPI void | ||
509 | evas_object_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h) | ||
510 | { | ||
511 | int is, was = 0, pass = 0, freeze =0; | ||
512 | |||
513 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
514 | return; | ||
515 | MAGIC_CHECK_END(); | ||
516 | if (obj->delete_me) return; | ||
517 | if (w < 0) w = 0; if (h < 0) h = 0; | ||
518 | if (evas_object_intercept_call_resize(obj, w, h)) return; | ||
519 | if (obj->doing.in_resize > 0) | ||
520 | { | ||
521 | WRN("evas_object_resize() called on object %p when in the middle of resizing the same object", obj); | ||
522 | return; | ||
523 | } | ||
524 | if ((obj->cur.geometry.w == w) && (obj->cur.geometry.h == h)) return; | ||
525 | if (obj->layer->evas->events_frozen <= 0) | ||
526 | { | ||
527 | pass = evas_event_passes_through(obj); | ||
528 | freeze = evas_event_freezes_through(obj); | ||
529 | if ((!pass) && (!freeze)) | ||
530 | was = evas_object_is_in_output_rect(obj, | ||
531 | obj->layer->evas->pointer.x, | ||
532 | obj->layer->evas->pointer.y, 1, 1); | ||
533 | } | ||
534 | obj->doing.in_resize++; | ||
535 | if (obj->smart.smart) | ||
536 | { | ||
537 | if (obj->smart.smart->smart_class->resize) | ||
538 | obj->smart.smart->smart_class->resize(obj, w, h); | ||
539 | } | ||
540 | obj->cur.geometry.w = w; | ||
541 | obj->cur.geometry.h = h; | ||
542 | //// obj->cur.cache.geometry.validity = 0; | ||
543 | evas_object_change(obj); | ||
544 | evas_object_clip_dirty(obj); | ||
545 | obj->doing.in_resize--; | ||
546 | /* NB: evas_object_recalc_clippees was here previously ( < 08/07/2009) */ | ||
547 | if (obj->layer->evas->events_frozen <= 0) | ||
548 | { | ||
549 | /* NB: If this creates glitches on screen then move to above position */ | ||
550 | evas_object_recalc_clippees(obj); | ||
551 | |||
552 | // if (obj->func->coords_recalc) obj->func->coords_recalc(obj); | ||
553 | if (!pass) | ||
554 | { | ||
555 | if (!obj->smart.smart) | ||
556 | { | ||
557 | is = evas_object_is_in_output_rect(obj, | ||
558 | obj->layer->evas->pointer.x, | ||
559 | obj->layer->evas->pointer.y, 1, 1); | ||
560 | if ((is ^ was) && (obj->cur.visible)) | ||
561 | evas_event_feed_mouse_move(obj->layer->evas, | ||
562 | obj->layer->evas->pointer.x, | ||
563 | obj->layer->evas->pointer.y, | ||
564 | obj->layer->evas->last_timestamp, | ||
565 | NULL); | ||
566 | } | ||
567 | } | ||
568 | } | ||
569 | evas_object_inform_call_resize(obj); | ||
570 | } | ||
571 | |||
572 | EAPI void | ||
573 | evas_object_geometry_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h) | ||
574 | { | ||
575 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
576 | if (x) *x = 0; if (y) *y = 0; if (w) *w = 0; if (h) *h = 0; | ||
577 | return; | ||
578 | MAGIC_CHECK_END(); | ||
579 | if (obj->delete_me) | ||
580 | { | ||
581 | if (x) *x = 0; if (y) *y = 0; if (w) *w = 0; if (h) *h = 0; | ||
582 | return; | ||
583 | } | ||
584 | if (x) *x = obj->cur.geometry.x; | ||
585 | if (y) *y = obj->cur.geometry.y; | ||
586 | if (w) *w = obj->cur.geometry.w; | ||
587 | if (h) *h = obj->cur.geometry.h; | ||
588 | } | ||
589 | |||
590 | static void | ||
591 | _evas_object_size_hint_alloc(Evas_Object *obj) | ||
592 | { | ||
593 | if (obj->size_hints) return; | ||
594 | |||
595 | EVAS_MEMPOOL_INIT(_mp_sh, "evas_size_hints", Evas_Size_Hints, 512, ); | ||
596 | obj->size_hints = EVAS_MEMPOOL_ALLOC(_mp_sh, Evas_Size_Hints); | ||
597 | if (!obj->size_hints) return; | ||
598 | EVAS_MEMPOOL_PREP(_mp_sh, obj->size_hints, Evas_Size_Hints); | ||
599 | obj->size_hints->max.w = -1; | ||
600 | obj->size_hints->max.h = -1; | ||
601 | obj->size_hints->align.x = 0.5; | ||
602 | obj->size_hints->align.y = 0.5; | ||
603 | } | ||
604 | |||
605 | EAPI void | ||
606 | evas_object_size_hint_min_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h) | ||
607 | { | ||
608 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
609 | if (w) *w = 0; if (h) *h = 0; | ||
610 | return; | ||
611 | MAGIC_CHECK_END(); | ||
612 | if ((!obj->size_hints) || obj->delete_me) | ||
613 | { | ||
614 | if (w) *w = 0; if (h) *h = 0; | ||
615 | return; | ||
616 | } | ||
617 | if (w) *w = obj->size_hints->min.w; | ||
618 | if (h) *h = obj->size_hints->min.h; | ||
619 | } | ||
620 | |||
621 | EAPI void | ||
622 | evas_object_size_hint_min_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h) | ||
623 | { | ||
624 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
625 | return; | ||
626 | MAGIC_CHECK_END(); | ||
627 | if (obj->delete_me) | ||
628 | return; | ||
629 | _evas_object_size_hint_alloc(obj); | ||
630 | if ((obj->size_hints->min.w == w) && (obj->size_hints->min.h == h)) return; | ||
631 | obj->size_hints->min.w = w; | ||
632 | obj->size_hints->min.h = h; | ||
633 | |||
634 | evas_object_inform_call_changed_size_hints(obj); | ||
635 | } | ||
636 | |||
637 | EAPI void | ||
638 | evas_object_size_hint_max_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h) | ||
639 | { | ||
640 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
641 | if (w) *w = -1; if (h) *h = -1; | ||
642 | return; | ||
643 | MAGIC_CHECK_END(); | ||
644 | if ((!obj->size_hints) || obj->delete_me) | ||
645 | { | ||
646 | if (w) *w = -1; if (h) *h = -1; | ||
647 | return; | ||
648 | } | ||
649 | if (w) *w = obj->size_hints->max.w; | ||
650 | if (h) *h = obj->size_hints->max.h; | ||
651 | } | ||
652 | |||
653 | EAPI void | ||
654 | evas_object_size_hint_max_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h) | ||
655 | { | ||
656 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
657 | return; | ||
658 | MAGIC_CHECK_END(); | ||
659 | if (obj->delete_me) | ||
660 | return; | ||
661 | _evas_object_size_hint_alloc(obj); | ||
662 | if ((obj->size_hints->max.w == w) && (obj->size_hints->max.h == h)) return; | ||
663 | obj->size_hints->max.w = w; | ||
664 | obj->size_hints->max.h = h; | ||
665 | |||
666 | evas_object_inform_call_changed_size_hints(obj); | ||
667 | } | ||
668 | |||
669 | EAPI void | ||
670 | evas_object_size_hint_request_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h) | ||
671 | { | ||
672 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
673 | if (w) *w = 0; if (h) *h = 0; | ||
674 | return; | ||
675 | MAGIC_CHECK_END(); | ||
676 | if ((!obj->size_hints) || obj->delete_me) | ||
677 | { | ||
678 | if (w) *w = 0; if (h) *h = 0; | ||
679 | return; | ||
680 | } | ||
681 | if (w) *w = obj->size_hints->request.w; | ||
682 | if (h) *h = obj->size_hints->request.h; | ||
683 | } | ||
684 | |||
685 | EAPI void | ||
686 | evas_object_size_hint_request_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h) | ||
687 | { | ||
688 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
689 | return; | ||
690 | MAGIC_CHECK_END(); | ||
691 | if (obj->delete_me) | ||
692 | return; | ||
693 | _evas_object_size_hint_alloc(obj); | ||
694 | if ((obj->size_hints->request.w == w) && (obj->size_hints->request.h == h)) return; | ||
695 | obj->size_hints->request.w = w; | ||
696 | obj->size_hints->request.h = h; | ||
697 | |||
698 | evas_object_inform_call_changed_size_hints(obj); | ||
699 | } | ||
700 | |||
701 | EAPI void | ||
702 | evas_object_size_hint_aspect_get(const Evas_Object *obj, Evas_Aspect_Control *aspect, Evas_Coord *w, Evas_Coord *h) | ||
703 | { | ||
704 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
705 | if (aspect) *aspect = EVAS_ASPECT_CONTROL_NONE; | ||
706 | if (w) *w = 0; if (h) *h = 0; | ||
707 | return; | ||
708 | MAGIC_CHECK_END(); | ||
709 | if ((!obj->size_hints) || obj->delete_me) | ||
710 | { | ||
711 | if (aspect) *aspect = EVAS_ASPECT_CONTROL_NONE; | ||
712 | if (w) *w = 0; if (h) *h = 0; | ||
713 | return; | ||
714 | } | ||
715 | if (aspect) *aspect = obj->size_hints->aspect.mode; | ||
716 | if (w) *w = obj->size_hints->aspect.size.w; | ||
717 | if (h) *h = obj->size_hints->aspect.size.h; | ||
718 | } | ||
719 | |||
720 | EAPI void | ||
721 | evas_object_size_hint_aspect_set(Evas_Object *obj, Evas_Aspect_Control aspect, Evas_Coord w, Evas_Coord h) | ||
722 | { | ||
723 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
724 | return; | ||
725 | MAGIC_CHECK_END(); | ||
726 | if (obj->delete_me) | ||
727 | return; | ||
728 | _evas_object_size_hint_alloc(obj); | ||
729 | if ((obj->size_hints->aspect.mode == aspect) && (obj->size_hints->aspect.size.w == w) && (obj->size_hints->aspect.size.h == h)) return; | ||
730 | obj->size_hints->aspect.mode = aspect; | ||
731 | obj->size_hints->aspect.size.w = w; | ||
732 | obj->size_hints->aspect.size.h = h; | ||
733 | |||
734 | evas_object_inform_call_changed_size_hints(obj); | ||
735 | } | ||
736 | |||
737 | EAPI void | ||
738 | evas_object_size_hint_align_get(const Evas_Object *obj, double *x, double *y) | ||
739 | { | ||
740 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
741 | if (x) *x = 0.5; if (y) *y = 0.5; | ||
742 | return; | ||
743 | MAGIC_CHECK_END(); | ||
744 | if ((!obj->size_hints) || obj->delete_me) | ||
745 | { | ||
746 | if (x) *x = 0.5; if (y) *y = 0.5; | ||
747 | return; | ||
748 | } | ||
749 | if (x) *x = obj->size_hints->align.x; | ||
750 | if (y) *y = obj->size_hints->align.y; | ||
751 | } | ||
752 | |||
753 | EAPI void | ||
754 | evas_object_size_hint_align_set(Evas_Object *obj, double x, double y) | ||
755 | { | ||
756 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
757 | return; | ||
758 | MAGIC_CHECK_END(); | ||
759 | if (obj->delete_me) | ||
760 | return; | ||
761 | _evas_object_size_hint_alloc(obj); | ||
762 | if ((obj->size_hints->align.x == x) && (obj->size_hints->align.y == y)) return; | ||
763 | obj->size_hints->align.x = x; | ||
764 | obj->size_hints->align.y = y; | ||
765 | |||
766 | evas_object_inform_call_changed_size_hints(obj); | ||
767 | } | ||
768 | |||
769 | EAPI void | ||
770 | evas_object_size_hint_weight_get(const Evas_Object *obj, double *x, double *y) | ||
771 | { | ||
772 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
773 | if (x) *x = 0.0; if (y) *y = 0.0; | ||
774 | return; | ||
775 | MAGIC_CHECK_END(); | ||
776 | if ((!obj->size_hints) || obj->delete_me) | ||
777 | { | ||
778 | if (x) *x = 0.0; if (y) *y = 0.0; | ||
779 | return; | ||
780 | } | ||
781 | if (x) *x = obj->size_hints->weight.x; | ||
782 | if (y) *y = obj->size_hints->weight.y; | ||
783 | } | ||
784 | |||
785 | EAPI void | ||
786 | evas_object_size_hint_weight_set(Evas_Object *obj, double x, double y) | ||
787 | { | ||
788 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
789 | return; | ||
790 | MAGIC_CHECK_END(); | ||
791 | if (obj->delete_me) | ||
792 | return; | ||
793 | _evas_object_size_hint_alloc(obj); | ||
794 | if ((obj->size_hints->weight.x == x) && (obj->size_hints->weight.y == y)) return; | ||
795 | obj->size_hints->weight.x = x; | ||
796 | obj->size_hints->weight.y = y; | ||
797 | |||
798 | evas_object_inform_call_changed_size_hints(obj); | ||
799 | } | ||
800 | |||
801 | EAPI void | ||
802 | evas_object_size_hint_padding_get(const Evas_Object *obj, Evas_Coord *l, Evas_Coord *r, Evas_Coord *t, Evas_Coord *b) | ||
803 | { | ||
804 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
805 | if (l) *l = 0; if (r) *r = 0; | ||
806 | if (t) *t = 0; if (b) *b = 0; | ||
807 | return; | ||
808 | MAGIC_CHECK_END(); | ||
809 | if ((!obj->size_hints) || obj->delete_me) | ||
810 | { | ||
811 | if (l) *l = 0; if (r) *r = 0; | ||
812 | if (t) *t = 0; if (b) *b = 0; | ||
813 | return; | ||
814 | } | ||
815 | if (l) *l = obj->size_hints->padding.l; | ||
816 | if (r) *r = obj->size_hints->padding.r; | ||
817 | if (t) *t = obj->size_hints->padding.t; | ||
818 | if (b) *b = obj->size_hints->padding.b; | ||
819 | } | ||
820 | |||
821 | EAPI void | ||
822 | evas_object_size_hint_padding_set(Evas_Object *obj, Evas_Coord l, Evas_Coord r, Evas_Coord t, Evas_Coord b) | ||
823 | { | ||
824 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
825 | return; | ||
826 | MAGIC_CHECK_END(); | ||
827 | if (obj->delete_me) | ||
828 | return; | ||
829 | _evas_object_size_hint_alloc(obj); | ||
830 | 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; | ||
831 | obj->size_hints->padding.l = l; | ||
832 | obj->size_hints->padding.r = r; | ||
833 | obj->size_hints->padding.t = t; | ||
834 | obj->size_hints->padding.b = b; | ||
835 | |||
836 | evas_object_inform_call_changed_size_hints(obj); | ||
837 | } | ||
838 | |||
839 | EAPI void | ||
840 | evas_object_show(Evas_Object *obj) | ||
841 | { | ||
842 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
843 | return; | ||
844 | MAGIC_CHECK_END(); | ||
845 | if (obj->delete_me) return; | ||
846 | if (evas_object_intercept_call_show(obj)) return; | ||
847 | if (obj->smart.smart) | ||
848 | { | ||
849 | if (obj->smart.smart->smart_class->show) | ||
850 | obj->smart.smart->smart_class->show(obj); | ||
851 | } | ||
852 | if (obj->cur.visible) | ||
853 | { | ||
854 | return; | ||
855 | } | ||
856 | obj->cur.visible = 1; | ||
857 | evas_object_change(obj); | ||
858 | evas_object_clip_dirty(obj); | ||
859 | if (obj->layer->evas->events_frozen <= 0) | ||
860 | { | ||
861 | evas_object_clip_across_clippees_check(obj); | ||
862 | evas_object_recalc_clippees(obj); | ||
863 | if ((!evas_event_passes_through(obj)) && | ||
864 | (!evas_event_freezes_through(obj))) | ||
865 | { | ||
866 | if (!obj->smart.smart) | ||
867 | { | ||
868 | if (evas_object_is_in_output_rect(obj, | ||
869 | obj->layer->evas->pointer.x, | ||
870 | obj->layer->evas->pointer.y, 1, 1)) | ||
871 | evas_event_feed_mouse_move(obj->layer->evas, | ||
872 | obj->layer->evas->pointer.x, | ||
873 | obj->layer->evas->pointer.y, | ||
874 | obj->layer->evas->last_timestamp, | ||
875 | NULL); | ||
876 | } | ||
877 | } | ||
878 | } | ||
879 | evas_object_inform_call_show(obj); | ||
880 | } | ||
881 | |||
882 | EAPI void | ||
883 | evas_object_hide(Evas_Object *obj) | ||
884 | { | ||
885 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
886 | return; | ||
887 | MAGIC_CHECK_END(); | ||
888 | if (obj->delete_me) return; | ||
889 | if (evas_object_intercept_call_hide(obj)) return; | ||
890 | if (obj->smart.smart) | ||
891 | { | ||
892 | if (obj->smart.smart->smart_class->hide) | ||
893 | obj->smart.smart->smart_class->hide(obj); | ||
894 | } | ||
895 | if (!obj->cur.visible) | ||
896 | { | ||
897 | return; | ||
898 | } | ||
899 | obj->cur.visible = 0; | ||
900 | evas_object_change(obj); | ||
901 | evas_object_clip_dirty(obj); | ||
902 | if (obj->layer->evas->events_frozen <= 0) | ||
903 | { | ||
904 | evas_object_clip_across_clippees_check(obj); | ||
905 | evas_object_recalc_clippees(obj); | ||
906 | if ((!evas_event_passes_through(obj)) && | ||
907 | (!evas_event_freezes_through(obj))) | ||
908 | { | ||
909 | if ((!obj->smart.smart) || | ||
910 | ((obj->cur.map) && (obj->cur.map->count == 4) && (obj->cur.usemap))) | ||
911 | { | ||
912 | if (!obj->mouse_grabbed) | ||
913 | { | ||
914 | if (evas_object_is_in_output_rect(obj, | ||
915 | obj->layer->evas->pointer.x, | ||
916 | obj->layer->evas->pointer.y, 1, 1)) | ||
917 | evas_event_feed_mouse_move(obj->layer->evas, | ||
918 | obj->layer->evas->pointer.x, | ||
919 | obj->layer->evas->pointer.y, | ||
920 | obj->layer->evas->last_timestamp, | ||
921 | NULL); | ||
922 | } | ||
923 | /* this is at odds to handling events when an obj is moved out of the mouse | ||
924 | * ore resized out or clipped out. if mouse is grabbed - regardless of | ||
925 | * visibility, mouse move events should keep happening and mouse up. | ||
926 | * for better or worse it's at least consistent. | ||
927 | if (obj->delete_me) return; | ||
928 | if (obj->mouse_grabbed > 0) | ||
929 | obj->layer->evas->pointer.mouse_grabbed -= obj->mouse_grabbed; | ||
930 | if ((obj->mouse_in) || (obj->mouse_grabbed > 0)) | ||
931 | obj->layer->evas->pointer.object.in = eina_list_remove(obj->layer->evas->pointer.object.in, obj); | ||
932 | obj->mouse_grabbed = 0; | ||
933 | if (obj->layer->evas->events_frozen > 0) | ||
934 | { | ||
935 | obj->mouse_in = 0; | ||
936 | return; | ||
937 | } | ||
938 | if (obj->mouse_in) | ||
939 | { | ||
940 | Evas_Event_Mouse_Out ev; | ||
941 | |||
942 | _evas_object_event_new(); | ||
943 | |||
944 | obj->mouse_in = 0; | ||
945 | ev.buttons = obj->layer->evas->pointer.button; | ||
946 | ev.output.x = obj->layer->evas->pointer.x; | ||
947 | ev.output.y = obj->layer->evas->pointer.y; | ||
948 | ev.canvas.x = obj->layer->evas->pointer.x; | ||
949 | ev.canvas.y = obj->layer->evas->pointer.y; | ||
950 | ev.data = NULL; | ||
951 | ev.modifiers = &(obj->layer->evas->modifiers); | ||
952 | ev.locks = &(obj->layer->evas->locks); | ||
953 | ev.timestamp = obj->layer->evas->last_timestamp; | ||
954 | ev.event_flags = EVAS_EVENT_FLAG_NONE; | ||
955 | evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_OUT, &ev); | ||
956 | _evas_post_event_callback_call(obj->layer->evas); | ||
957 | } | ||
958 | */ | ||
959 | } | ||
960 | } | ||
961 | } | ||
962 | else | ||
963 | { | ||
964 | /* | ||
965 | if (obj->mouse_grabbed > 0) | ||
966 | obj->layer->evas->pointer.mouse_grabbed -= obj->mouse_grabbed; | ||
967 | if ((obj->mouse_in) || (obj->mouse_grabbed > 0)) | ||
968 | obj->layer->evas->pointer.object.in = eina_list_remove(obj->layer->evas->pointer.object.in, obj); | ||
969 | obj->mouse_grabbed = 0; | ||
970 | obj->mouse_in = 0; | ||
971 | */ | ||
972 | } | ||
973 | evas_object_inform_call_hide(obj); | ||
974 | } | ||
975 | |||
976 | EAPI Eina_Bool | ||
977 | evas_object_visible_get(const Evas_Object *obj) | ||
978 | { | ||
979 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
980 | return 0; | ||
981 | MAGIC_CHECK_END(); | ||
982 | if (obj->delete_me) return 0; | ||
983 | return obj->cur.visible; | ||
984 | } | ||
985 | |||
986 | EAPI void | ||
987 | evas_object_color_set(Evas_Object *obj, int r, int g, int b, int a) | ||
988 | { | ||
989 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
990 | return; | ||
991 | MAGIC_CHECK_END(); | ||
992 | if (obj->delete_me) return; | ||
993 | if (r > 255) r = 255; if (r < 0) r = 0; | ||
994 | if (g > 255) g = 255; if (g < 0) g = 0; | ||
995 | if (b > 255) b = 255; if (b < 0) b = 0; | ||
996 | if (a > 255) a = 255; if (a < 0) a = 0; | ||
997 | if (evas_object_intercept_call_color_set(obj, r, g, b, a)) return; | ||
998 | if (obj->smart.smart) | ||
999 | { | ||
1000 | if (obj->smart.smart->smart_class->color_set) | ||
1001 | obj->smart.smart->smart_class->color_set(obj, r, g, b, a); | ||
1002 | } | ||
1003 | if ((obj->cur.color.r == r) && | ||
1004 | (obj->cur.color.g == g) && | ||
1005 | (obj->cur.color.b == b) && | ||
1006 | (obj->cur.color.a == a)) return; | ||
1007 | obj->cur.color.r = r; | ||
1008 | obj->cur.color.g = g; | ||
1009 | obj->cur.color.b = b; | ||
1010 | evas_object_clip_dirty(obj); | ||
1011 | if ((obj->cur.color.a == 0) && (a == 0) && (obj->cur.render_op == EVAS_RENDER_BLEND)) return; | ||
1012 | obj->cur.color.a = a; | ||
1013 | evas_object_change(obj); | ||
1014 | } | ||
1015 | |||
1016 | EAPI void | ||
1017 | evas_object_color_get(const Evas_Object *obj, int *r, int *g, int *b, int *a) | ||
1018 | { | ||
1019 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
1020 | if (r) *r = 0; if (g) *g = 0; if (b) *b = 0; if (a) *a = 0; | ||
1021 | return; | ||
1022 | MAGIC_CHECK_END(); | ||
1023 | if (obj->delete_me) | ||
1024 | { | ||
1025 | if (r) *r = 0; if (g) *g = 0; if (b) *b = 0; if (a) *a = 0; | ||
1026 | return; | ||
1027 | } | ||
1028 | if (r) *r = obj->cur.color.r; | ||
1029 | if (g) *g = obj->cur.color.g; | ||
1030 | if (b) *b = obj->cur.color.b; | ||
1031 | if (a) *a = obj->cur.color.a; | ||
1032 | } | ||
1033 | |||
1034 | EAPI void | ||
1035 | evas_object_anti_alias_set(Evas_Object *obj, Eina_Bool anti_alias) | ||
1036 | { | ||
1037 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
1038 | return; | ||
1039 | MAGIC_CHECK_END(); | ||
1040 | if (obj->delete_me) return; | ||
1041 | anti_alias = !!anti_alias; | ||
1042 | if (obj->cur.anti_alias == anti_alias)return; | ||
1043 | obj->cur.anti_alias = anti_alias; | ||
1044 | evas_object_change(obj); | ||
1045 | } | ||
1046 | |||
1047 | EAPI Eina_Bool | ||
1048 | evas_object_anti_alias_get(const Evas_Object *obj) | ||
1049 | { | ||
1050 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
1051 | return 0; | ||
1052 | MAGIC_CHECK_END(); | ||
1053 | if (obj->delete_me) return 0; | ||
1054 | return obj->cur.anti_alias; | ||
1055 | } | ||
1056 | |||
1057 | EAPI void | ||
1058 | evas_object_scale_set(Evas_Object *obj, double scale) | ||
1059 | { | ||
1060 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
1061 | return; | ||
1062 | MAGIC_CHECK_END(); | ||
1063 | if (obj->delete_me) return; | ||
1064 | if (obj->cur.scale == scale) return; | ||
1065 | obj->cur.scale = scale; | ||
1066 | evas_object_change(obj); | ||
1067 | if (obj->func->scale_update) obj->func->scale_update(obj); | ||
1068 | } | ||
1069 | |||
1070 | EAPI double | ||
1071 | evas_object_scale_get(const Evas_Object *obj) | ||
1072 | { | ||
1073 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
1074 | return 0; | ||
1075 | MAGIC_CHECK_END(); | ||
1076 | if (obj->delete_me) return 1.0; | ||
1077 | return obj->cur.scale; | ||
1078 | } | ||
1079 | |||
1080 | EAPI void | ||
1081 | evas_object_render_op_set(Evas_Object *obj, Evas_Render_Op render_op) | ||
1082 | { | ||
1083 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
1084 | return; | ||
1085 | MAGIC_CHECK_END(); | ||
1086 | if (obj->delete_me) return; | ||
1087 | if ((Evas_Render_Op)obj->cur.render_op == render_op) | ||
1088 | return; | ||
1089 | obj->cur.render_op = render_op; | ||
1090 | evas_object_change(obj); | ||
1091 | } | ||
1092 | |||
1093 | EAPI Evas_Render_Op | ||
1094 | evas_object_render_op_get(const Evas_Object *obj) | ||
1095 | { | ||
1096 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
1097 | return 0; | ||
1098 | MAGIC_CHECK_END(); | ||
1099 | if (obj->delete_me) return EVAS_RENDER_BLEND; | ||
1100 | return obj->cur.render_op; | ||
1101 | } | ||
1102 | |||
1103 | EAPI Evas * | ||
1104 | evas_object_evas_get(const Evas_Object *obj) | ||
1105 | { | ||
1106 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
1107 | return NULL; | ||
1108 | MAGIC_CHECK_END(); | ||
1109 | if (obj->delete_me) return NULL; | ||
1110 | return obj->layer->evas; | ||
1111 | } | ||
1112 | |||
1113 | EAPI Evas_Object * | ||
1114 | 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) | ||
1115 | { | ||
1116 | Evas_Layer *lay; | ||
1117 | int xx, yy; | ||
1118 | |||
1119 | MAGIC_CHECK(e, Evas, MAGIC_EVAS); | ||
1120 | return NULL; | ||
1121 | MAGIC_CHECK_END(); | ||
1122 | xx = x; | ||
1123 | yy = y; | ||
1124 | //// xx = evas_coord_world_x_to_screen(e, x); | ||
1125 | //// yy = evas_coord_world_y_to_screen(e, y); | ||
1126 | EINA_INLIST_REVERSE_FOREACH((EINA_INLIST_GET(e->layers)), lay) | ||
1127 | { | ||
1128 | Evas_Object *obj; | ||
1129 | |||
1130 | EINA_INLIST_REVERSE_FOREACH(get_layer_objects(lay), obj) | ||
1131 | { | ||
1132 | if (obj->delete_me) continue; | ||
1133 | if ((!include_pass_events_objects) && | ||
1134 | (evas_event_passes_through(obj))) continue; | ||
1135 | if ((!include_hidden_objects) && (!obj->cur.visible)) continue; | ||
1136 | evas_object_clip_recalc(obj); | ||
1137 | if ((evas_object_is_in_output_rect(obj, xx, yy, 1, 1)) && | ||
1138 | (!obj->clip.clipees)) | ||
1139 | return obj; | ||
1140 | } | ||
1141 | } | ||
1142 | return NULL; | ||
1143 | } | ||
1144 | |||
1145 | EAPI Evas_Object * | ||
1146 | evas_object_top_at_pointer_get(const Evas *e) | ||
1147 | { | ||
1148 | return evas_object_top_at_xy_get(e, e->pointer.x, e->pointer.y, EINA_TRUE, | ||
1149 | EINA_TRUE); | ||
1150 | } | ||
1151 | |||
1152 | EAPI Evas_Object * | ||
1153 | 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) | ||
1154 | { | ||
1155 | Evas_Layer *lay; | ||
1156 | int xx, yy, ww, hh; | ||
1157 | |||
1158 | MAGIC_CHECK(e, Evas, MAGIC_EVAS); | ||
1159 | return NULL; | ||
1160 | MAGIC_CHECK_END(); | ||
1161 | xx = x; | ||
1162 | yy = y; | ||
1163 | ww = w; | ||
1164 | hh = h; | ||
1165 | //// xx = evas_coord_world_x_to_screen(e, x); | ||
1166 | //// yy = evas_coord_world_y_to_screen(e, y); | ||
1167 | //// ww = evas_coord_world_x_to_screen(e, w); | ||
1168 | //// hh = evas_coord_world_y_to_screen(e, h); | ||
1169 | if (ww < 1) ww = 1; | ||
1170 | if (hh < 1) hh = 1; | ||
1171 | EINA_INLIST_REVERSE_FOREACH((EINA_INLIST_GET(e->layers)), lay) | ||
1172 | { | ||
1173 | Evas_Object *obj; | ||
1174 | |||
1175 | EINA_INLIST_REVERSE_FOREACH(get_layer_objects(lay), obj) | ||
1176 | { | ||
1177 | if (obj->delete_me) continue; | ||
1178 | if ((!include_pass_events_objects) && | ||
1179 | (evas_event_passes_through(obj))) continue; | ||
1180 | if ((!include_hidden_objects) && (!obj->cur.visible)) continue; | ||
1181 | evas_object_clip_recalc(obj); | ||
1182 | if ((evas_object_is_in_output_rect(obj, xx, yy, ww, hh)) && | ||
1183 | (!obj->clip.clipees)) | ||
1184 | return obj; | ||
1185 | } | ||
1186 | } | ||
1187 | return NULL; | ||
1188 | } | ||
1189 | |||
1190 | EAPI Eina_List * | ||
1191 | 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) | ||
1192 | { | ||
1193 | Eina_List *in = NULL; | ||
1194 | Evas_Layer *lay; | ||
1195 | int xx, yy; | ||
1196 | |||
1197 | MAGIC_CHECK(e, Evas, MAGIC_EVAS); | ||
1198 | return NULL; | ||
1199 | MAGIC_CHECK_END(); | ||
1200 | xx = x; | ||
1201 | yy = y; | ||
1202 | //// xx = evas_coord_world_x_to_screen(e, x); | ||
1203 | //// yy = evas_coord_world_y_to_screen(e, y); | ||
1204 | EINA_INLIST_REVERSE_FOREACH((EINA_INLIST_GET(e->layers)), lay) | ||
1205 | { | ||
1206 | Evas_Object *obj; | ||
1207 | |||
1208 | EINA_INLIST_REVERSE_FOREACH(get_layer_objects(lay), obj) | ||
1209 | { | ||
1210 | if (obj->delete_me) continue; | ||
1211 | if ((!include_pass_events_objects) && | ||
1212 | (evas_event_passes_through(obj))) continue; | ||
1213 | if ((!include_hidden_objects) && (!obj->cur.visible)) continue; | ||
1214 | evas_object_clip_recalc(obj); | ||
1215 | if ((evas_object_is_in_output_rect(obj, xx, yy, 1, 1)) && | ||
1216 | (!obj->clip.clipees)) | ||
1217 | in = eina_list_prepend(in, obj); | ||
1218 | } | ||
1219 | } | ||
1220 | return in; | ||
1221 | } | ||
1222 | |||
1223 | /** | ||
1224 | * Retrieves the objects in the given rectangle region | ||
1225 | * @param e The given evas object. | ||
1226 | * @param x The horizontal coordinate. | ||
1227 | * @param y The vertical coordinate. | ||
1228 | * @param w The width size. | ||
1229 | * @param h The height size. | ||
1230 | * @param include_pass_events_objects Boolean Flag to include or not pass events objects | ||
1231 | * @param include_hidden_objects Boolean Flag to include or not hidden objects | ||
1232 | * @return The list of evas object in the rectangle region. | ||
1233 | * | ||
1234 | */ | ||
1235 | EAPI Eina_List * | ||
1236 | 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) | ||
1237 | { | ||
1238 | Eina_List *in = NULL; | ||
1239 | Evas_Layer *lay; | ||
1240 | int xx, yy, ww, hh; | ||
1241 | |||
1242 | MAGIC_CHECK(e, Evas, MAGIC_EVAS); | ||
1243 | return NULL; | ||
1244 | MAGIC_CHECK_END(); | ||
1245 | xx = x; | ||
1246 | yy = y; | ||
1247 | ww = w; | ||
1248 | hh = h; | ||
1249 | //// xx = evas_coord_world_x_to_screen(e, x); | ||
1250 | //// yy = evas_coord_world_y_to_screen(e, y); | ||
1251 | //// ww = evas_coord_world_x_to_screen(e, w); | ||
1252 | //// hh = evas_coord_world_y_to_screen(e, h); | ||
1253 | if (ww < 1) ww = 1; | ||
1254 | if (hh < 1) hh = 1; | ||
1255 | EINA_INLIST_REVERSE_FOREACH((EINA_INLIST_GET(e->layers)), lay) | ||
1256 | { | ||
1257 | Evas_Object *obj; | ||
1258 | |||
1259 | EINA_INLIST_REVERSE_FOREACH(get_layer_objects(lay), obj) | ||
1260 | { | ||
1261 | if (obj->delete_me) continue; | ||
1262 | if ((!include_pass_events_objects) && | ||
1263 | (evas_event_passes_through(obj))) continue; | ||
1264 | if ((!include_hidden_objects) && (!obj->cur.visible)) continue; | ||
1265 | evas_object_clip_recalc(obj); | ||
1266 | if ((evas_object_is_in_output_rect(obj, xx, yy, ww, hh)) && | ||
1267 | (!obj->clip.clipees)) | ||
1268 | in = eina_list_prepend(in, obj); | ||
1269 | } | ||
1270 | } | ||
1271 | return in; | ||
1272 | } | ||
1273 | |||
1274 | EAPI const char * | ||
1275 | evas_object_type_get(const Evas_Object *obj) | ||
1276 | { | ||
1277 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
1278 | return NULL; | ||
1279 | MAGIC_CHECK_END(); | ||
1280 | if (obj->delete_me) return ""; | ||
1281 | return obj->type; | ||
1282 | } | ||
1283 | |||
1284 | EAPI void | ||
1285 | evas_object_precise_is_inside_set(Evas_Object *obj, Eina_Bool precise) | ||
1286 | { | ||
1287 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
1288 | return; | ||
1289 | MAGIC_CHECK_END(); | ||
1290 | obj->precise_is_inside = precise; | ||
1291 | } | ||
1292 | |||
1293 | EAPI Eina_Bool | ||
1294 | evas_object_precise_is_inside_get(const Evas_Object *obj) | ||
1295 | { | ||
1296 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
1297 | return 0; | ||
1298 | MAGIC_CHECK_END(); | ||
1299 | return obj->precise_is_inside; | ||
1300 | } | ||
1301 | |||
1302 | EAPI void | ||
1303 | evas_object_static_clip_set(Evas_Object *obj, Eina_Bool is_static_clip) | ||
1304 | { | ||
1305 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
1306 | return; | ||
1307 | MAGIC_CHECK_END(); | ||
1308 | obj->is_static_clip = is_static_clip; | ||
1309 | } | ||
1310 | |||
1311 | EAPI Eina_Bool | ||
1312 | evas_object_static_clip_get(const Evas_Object *obj) | ||
1313 | { | ||
1314 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
1315 | return 0; | ||
1316 | MAGIC_CHECK_END(); | ||
1317 | return obj->is_static_clip; | ||
1318 | } | ||
1319 | |||