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