summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Williams <andy@andywilliams.me>2017-12-14 08:55:01 +0000
committerAndy Williams <andy@andywilliams.me>2017-12-14 08:55:01 +0000
commitfcdf4e9d10a5b48117ce1ee4669a4c57db6d8052 (patch)
treeb1427dc26703a81fcd6b0c0e24e18ea7dd1831f9
parent3726af831350ac042831c628b7ae1ef1ac88cd69 (diff)
elm_code: Correct tooltip behaviour for elm_cde_widget
-rw-r--r--src/lib/elementary/elm_code_widget.c35
1 files changed, 29 insertions, 6 deletions
diff --git a/src/lib/elementary/elm_code_widget.c b/src/lib/elementary/elm_code_widget.c
index fd9e781984..2f9b693322 100644
--- a/src/lib/elementary/elm_code_widget.c
+++ b/src/lib/elementary/elm_code_widget.c
@@ -1024,6 +1024,29 @@ _mouse_selection_paste_at_position(Elm_Code_Widget *widget,
1024 free(text); 1024 free(text);
1025} 1025}
1026 1026
1027static Evas_Object *
1028_elm_code_widget_tooltip_cb(void *data, Evas_Object *obj EINA_UNUSED, Evas_Object *tooltip)
1029{
1030 Evas_Object *label;
1031
1032 if (!data)
1033 return NULL;
1034
1035 label = elm_label_add(tooltip);
1036 elm_object_text_set(label, (Eina_Stringshare *)data);
1037 return label;
1038}
1039
1040static void
1041_elm_code_widget_tooltip_del_cb(void *data, Evas_Object *obj EINA_UNUSED,
1042 void *event_info EINA_UNUSED)
1043{
1044 if (!data)
1045 return;
1046
1047 eina_stringshare_del((Eina_Stringshare *)data);
1048}
1049
1027static void 1050static void
1028_elm_code_widget_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, 1051_elm_code_widget_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
1029 void *event_info) 1052 void *event_info)
@@ -1099,12 +1122,13 @@ _elm_code_widget_mouse_move_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj
1099 if (!pd->editable || !event->buttons) 1122 if (!pd->editable || !event->buttons)
1100 { 1123 {
1101 Elm_Code_Line *line; 1124 Elm_Code_Line *line;
1125 Eina_Stringshare *text = NULL;
1102 1126
1103 line = elm_code_file_line_get(elm_code_widget_code_get(widget)->file, row); 1127 line = elm_code_file_line_get(elm_code_widget_code_get(widget)->file, row);
1104 if (line) 1128 if (line && line->status_text)
1105 elm_object_tooltip_text_set(widget, line->status_text); 1129 text = eina_stringshare_add(line->status_text);
1106 else 1130 elm_object_tooltip_content_cb_set(pd->gridbox, _elm_code_widget_tooltip_cb,
1107 elm_object_tooltip_text_set(widget, NULL); 1131 text, _elm_code_widget_tooltip_del_cb);
1108 1132
1109 return; 1133 return;
1110 } 1134 }
@@ -2253,6 +2277,7 @@ _elm_code_widget_efl_canvas_group_group_add(Eo *obj, Elm_Code_Widget_Data *pd)
2253 if (!elm_widget_theme_klass_get(obj)) 2277 if (!elm_widget_theme_klass_get(obj))
2254 elm_widget_theme_klass_set(obj, "code"); 2278 elm_widget_theme_klass_set(obj, "code");
2255 elm_widget_theme_element_set(obj, "layout"); 2279 elm_widget_theme_element_set(obj, "layout");
2280 _elm_code_widget_elm_widget_theme_apply(obj, pd);
2256 2281
2257 efl_canvas_group_add(efl_super(obj, ELM_CODE_WIDGET_CLASS)); 2282 efl_canvas_group_add(efl_super(obj, ELM_CODE_WIDGET_CLASS));
2258 elm_object_focus_allow_set(obj, EINA_TRUE); 2283 elm_object_focus_allow_set(obj, EINA_TRUE);
@@ -2283,8 +2308,6 @@ _elm_code_widget_efl_canvas_group_group_add(Eo *obj, Elm_Code_Widget_Data *pd)
2283 elm_object_content_set(scroller, gridrows); 2308 elm_object_content_set(scroller, gridrows);
2284 pd->gridbox = gridrows; 2309 pd->gridbox = gridrows;
2285 2310
2286 _elm_code_widget_elm_widget_theme_apply(obj, pd);
2287
2288 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _elm_code_widget_resize_cb, obj); 2311 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _elm_code_widget_resize_cb, obj);
2289 evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_DOWN, _elm_code_widget_key_down_cb, obj); 2312 evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_DOWN, _elm_code_widget_key_down_cb, obj);
2290 evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _elm_code_widget_hidden_cb, obj); 2313 evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _elm_code_widget_hidden_cb, obj);