summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Hirt <daniel.hirt@samsung.com>2015-07-29 17:19:14 +0300
committerDaniel Hirt <daniel.hirt@samsung.com>2015-07-29 17:19:14 +0300
commitb4d3f312fc1c0fe8b39cc69bb084ac98465483a2 (patch)
treea2c083f81e2544249cbdf54208de191e9f2daa09
parentc5fde55ba91d14a6fd5153d18a130d5283061538 (diff)
eo_preload: Add tooltip support (initial, POC)
Adds a tooltip for Entry widgets so you can hover and populate some info. The actual intention is to get the Textblock of that Entry and show information for that Textblock. To be continued...
-rw-r--r--src/lib/.eo_preload.c.swpbin20480 -> 0 bytes
-rw-r--r--src/lib/eo_preload.c54
2 files changed, 51 insertions, 3 deletions
diff --git a/src/lib/.eo_preload.c.swp b/src/lib/.eo_preload.c.swp
deleted file mode 100644
index c20781d..0000000
--- a/src/lib/.eo_preload.c.swp
+++ /dev/null
Binary files differ
diff --git a/src/lib/eo_preload.c b/src/lib/eo_preload.c
index ad8e9a1..0a6bc6f 100644
--- a/src/lib/eo_preload.c
+++ b/src/lib/eo_preload.c
@@ -153,6 +153,36 @@ _on_obj_del(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_i
153 return EINA_TRUE; 153 return EINA_TRUE;
154} 154}
155 155
156static Eina_Bool g_debug_enabled = EINA_TRUE;
157
158/******** Tooltip *********/
159
160static Evas_Object *
161_textblock_tooltip_content_cb(void *data,
162 Evas_Object *obj,
163 Evas_Object *tt)
164{
165 char buf[1024];
166 g_debug_enabled = EINA_FALSE; /* Workaround that indicates when the first
167 tooltip was called so we can stop
168 tracking objects */
169 Evas_Object *text = elm_label_add(tt);
170
171 Elm_Wrap_Type wrap = elm_entry_line_wrap_get(data);
172
173 evas_object_resize(text, 200, 50);
174
175 /* Print to the buf */
176 sprintf(buf, "Entry %p<ps>"
177 "Wrap type: %d<ps>",
178 obj, wrap);
179 elm_object_part_text_set(text, "elm.text", buf);
180
181 return text;
182}
183
184/******** PRELOADS ********/
185
156EAPI Eo * 186EAPI Eo *
157_eo_add_internal_start(const char *file, int line, const Eo_Class *klass_id, Eo *parent_id, Eina_Bool ref) 187_eo_add_internal_start(const char *file, int line, const Eo_Class *klass_id, Eo *parent_id, Eina_Bool ref)
158{ 188{
@@ -160,19 +190,37 @@ _eo_add_internal_start(const char *file, int line, const Eo_Class *klass_id, Eo
160 Eo *(*_eo_add_start)(const char *, int, const Eo_Class *, Eo *, Eina_Bool) = dlsym(RTLD_NEXT, __func__); 190 Eo *(*_eo_add_start)(const char *, int, const Eo_Class *, Eo *, Eina_Bool) = dlsym(RTLD_NEXT, __func__);
161 191
162 ret = _eo_add_start(file, line, klass_id, parent_id, ref); 192 ret = _eo_add_start(file, line, klass_id, parent_id, ref);
163 if (eo_isa(ret, EVAS_TEXTBLOCK_CLASS)) 193
194 if (g_debug_enabled)
164 { 195 {
165 tracked = eina_list_append(tracked, ret); 196 if (eo_isa(ret, EVAS_TEXTBLOCK_CLASS))
166 eo_do(ret, eo_event_callback_add(EVAS_OBJECT_EVENT_DEL, _on_obj_del, NULL)); 197 {
198 tracked = eina_list_append(tracked, ret);
199 eo_do(ret, eo_event_callback_add(EVAS_OBJECT_EVENT_DEL, _on_obj_del, NULL));
200 }
201 if (eo_isa(ret, ELM_ENTRY_CLASS))
202 {
203 elm_object_tooltip_content_cb_set(ret, _textblock_tooltip_content_cb, NULL, NULL);
204 eo_do(ret, eo_event_callback_add(EVAS_OBJECT_EVENT_DEL, _on_obj_del, NULL));
205 }
167 } 206 }
168 return ret; 207 return ret;
169} 208}
170 209
210static Eina_Bool
211_timer_disable_debug_cb(void *data)
212{
213 g_debug_enabled = EINA_FALSE;
214 printf("Disabled debug (timeout)\n");
215 return EINA_FALSE;
216}
217
171EAPI void 218EAPI void
172elm_run() 219elm_run()
173{ 220{
174 void (*f)() = dlsym(RTLD_NEXT, __func__); 221 void (*f)() = dlsym(RTLD_NEXT, __func__);
175 _init_colors(); 222 _init_colors();
176 ecore_timer_add(0.1, _timer_cb, NULL); 223 ecore_timer_add(0.1, _timer_cb, NULL);
224// ecore_timer_add(3, _timer_disable_debug_cb, NULL);
177 f(); 225 f();
178} 226}