summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Hirt <daniel.hirt@samsung.com>2015-07-30 18:30:46 +0300
committerDaniel Hirt <daniel.hirt@samsung.com>2015-07-30 18:30:46 +0300
commit3893bc4ec151d1dcb38225fcfc928717eec8ce43 (patch)
treefecd1c02581e43178965fd79fd2d45649bad13b9
parent5d8b1e7c5e35d33488a1fa5d010ce3cb2fb65185 (diff)
Saving more work
-rw-r--r--src/lib/eo_preload.c94
1 files changed, 79 insertions, 15 deletions
diff --git a/src/lib/eo_preload.c b/src/lib/eo_preload.c
index 04bb165..a7be9b9 100644
--- a/src/lib/eo_preload.c
+++ b/src/lib/eo_preload.c
@@ -22,8 +22,12 @@ typedef struct
22 do {}while(0) 22 do {}while(0)
23 23
24int color_idx = 0; 24int color_idx = 0;
25Rect_Color colors[] = {{255, 255, 0 , 128}, 25Rect_Color colors[] = {
26 {255, 0 , 255, 128}}; 26 {255, 255, 0 , 128},
27 {255, 0 , 255, 128},
28 {128, 0 , 255, 128},
29 {255, 128 , 0, 128},
30};
27 31
28static void 32static void
29_init_colors() 33_init_colors()
@@ -53,12 +57,13 @@ typedef struct
53static Debug_Decorate *g_decor = NULL; 57static Debug_Decorate *g_decor = NULL;
54 58
55EAPI Eina_List * 59EAPI Eina_List *
56_evas_textblock_par_rects_get(Evas_Object *obj); 60_evas_textblock_par_rects_get(const Evas_Object *obj);
61EAPI Eina_List *
62_evas_textblock_items_get(const Evas_Object *obj);
57 63
58static void 64static void
59_rects_populate(Debug_Decorate *dec) 65_textblock_populate_paragraphs(Debug_Decorate *dec)
60{ 66{
61 color_idx = 0;
62 Eina_List *rects; 67 Eina_List *rects;
63 Eina_Rectangle *rect; 68 Eina_Rectangle *rect;
64 Evas_Coord ox, oy; 69 Evas_Coord ox, oy;
@@ -73,7 +78,7 @@ _rects_populate(Debug_Decorate *dec)
73 CYCLE_ARR(colors, color_idx); 78 CYCLE_ARR(colors, color_idx);
74 79
75 r->obj = evas_object_rectangle_add(dec->obj); 80 r->obj = evas_object_rectangle_add(dec->obj);
76 evas_object_pass_events_set(r->obj, EINA_TRUE); 81 evas_object_repeat_events_set(r->obj, EINA_TRUE);
77 evas_object_color_set(r->obj, c.r, c.g, c.b, c.a); 82 evas_object_color_set(r->obj, c.r, c.g, c.b, c.a);
78 // printf("Color set to (%d,%d,%d,%d)\n", c.r, c.g, c.b, c.a); 83 // printf("Color set to (%d,%d,%d,%d)\n", c.r, c.g, c.b, c.a);
79 evas_object_resize(r->obj, rect->w, rect->h); 84 evas_object_resize(r->obj, rect->w, rect->h);
@@ -86,8 +91,74 @@ _rects_populate(Debug_Decorate *dec)
86 eina_rectangle_free(rect); 91 eina_rectangle_free(rect);
87 } 92 }
88 93
94}
95
96static Evas_Object *
97_textblock_item_content_cb(void *data,
98 Evas_Object *obj,
99 Evas_Object *tt)
100{
101 char buf[1024];
102 Evas_Object *text = elm_label_add(tt);
103
104 evas_object_resize(text, 200, 50);
105
106 /* Print to the buf */
107 sprintf(buf, "Item %p<ps>"
108 "Need info here",
109 obj);
110 elm_object_part_text_set(text, "elm.text", buf);
111
112 return text;
113
114}
115
116static Eina_Bool
117_item_mouse_in(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info)
118{
119 printf("Entered item %lu\n", (size_t)data);
120 return EINA_TRUE;
121}
122
123static void
124_textblock_populate_items(Debug_Decorate *dec)
125{
126 Eina_List *rects;
127 Eina_Rectangle *rect;
128 Evas_Coord ox, oy;
129 evas_object_geometry_get(dec->obj, &ox, &oy, NULL, NULL);
130
89 /* Decorate Items */ 131 /* Decorate Items */
90 int it_idx = 0; /* Maybe use this for text elements */ 132 size_t it_idx = 0; /* Maybe use this for text elements */
133 rects = _evas_textblock_items_get(dec->obj);
134 EINA_LIST_FREE(rects, rect)
135 {
136 Debug_Rect *r = malloc(sizeof(Debug_Rect));
137 Rect_Color c = colors[color_idx];
138 CYCLE_ARR(colors, color_idx);
139
140 r->obj = evas_object_rectangle_add(dec->obj);
141 // elm_object_tooltip_content_cb_set(r->obj, _textblock_item_content_cb, NULL, NULL);
142 evas_object_repeat_events_set(r->obj, EINA_TRUE);
143 eo_do(r->obj, eo_event_callback_add(EVAS_OBJECT_EVENT_MOUSE_IN, _item_mouse_in, (void *)it_idx++));
144 evas_object_color_set(r->obj, c.r, c.g, c.b, c.a);
145 evas_object_resize(r->obj, rect->w, rect->h);
146 evas_object_move(r->obj, ox + rect->x, oy + rect->y);
147 dec->rects = (Debug_Rect *)eina_inlist_append(
148 EINA_INLIST_GET(dec->rects),
149 EINA_INLIST_GET(r));
150 evas_object_show(r->obj);
151
152 eina_rectangle_free(rect);
153 }
154
155}
156static void
157_rects_populate(Debug_Decorate *dec)
158{
159 color_idx = 0;
160 _textblock_populate_paragraphs(dec);
161 _textblock_populate_items(dec);
91} 162}
92 163
93/* Clears debug rectangles for given obj */ 164/* Clears debug rectangles for given obj */
@@ -152,13 +223,6 @@ _timer_cb(void *data)
152 return EINA_TRUE; 223 return EINA_TRUE;
153} 224}
154 225
155Eina_Bool
156_on_tracked_object_changed(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info)
157{
158
159 return EINA_TRUE;
160}
161
162static Eina_Bool 226static Eina_Bool
163_on_obj_del(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info) 227_on_obj_del(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info)
164{ 228{
@@ -213,7 +277,7 @@ _eo_add_internal_start(const char *file, int line, const Eo_Class *klass_id, Eo
213 } 277 }
214 if (eo_isa(ret, ELM_ENTRY_CLASS)) 278 if (eo_isa(ret, ELM_ENTRY_CLASS))
215 { 279 {
216 elm_object_tooltip_content_cb_set(ret, _textblock_tooltip_content_cb, NULL, NULL); 280 // elm_object_tooltip_content_cb_set(ret, _textblock_tooltip_content_cb, NULL, NULL);
217 elm_object_tooltip_show_delay_set(ret, 0.0); 281 elm_object_tooltip_show_delay_set(ret, 0.0);
218 eo_do(ret, eo_event_callback_add(EVAS_OBJECT_EVENT_DEL, _on_obj_del, NULL)); 282 eo_do(ret, eo_event_callback_add(EVAS_OBJECT_EVENT_DEL, _on_obj_del, NULL));
219 } 283 }