yakov pushed a commit to branch master.

http://git.enlightenment.org/tools/erigo.git/commit/?id=ea9ebdf2dd84ad93a563fb9a2032038371526991

commit ea9ebdf2dd84ad93a563fb9a2032038371526991
Author: Yakov Goldberg <yako...@samsung.com>
Date:   Mon Mar 23 16:06:15 2015 +0200

    Add memo bubble to properties which require Activate
    
    Some entries in Description/Property/COntent Views require user to press 
Enter to apply
    changes. This patch provides memo bubble for such cases.
---
 src/bin/egui_gui/contentview.c  |  1 +
 src/bin/egui_gui/descview.c     |  3 ++-
 src/bin/egui_gui/itemview.c     |  1 +
 src/bin/egui_gui/props_helper.c | 41 +++++++++++++++++++++++++++++++++++++++++
 src/bin/egui_gui/props_helper.h |  4 ++++
 5 files changed, 49 insertions(+), 1 deletion(-)

diff --git a/src/bin/egui_gui/contentview.c b/src/bin/egui_gui/contentview.c
index ed11cc8..1ecdd32 100644
--- a/src/bin/egui_gui/contentview.c
+++ b/src/bin/egui_gui/contentview.c
@@ -67,6 +67,7 @@ _content_item_content_get(It_Data *it_data)
              else
                {
                   eo_do(obj, eo_event_callback_add(ELM_ENTRY_EVENT_ACTIVATED, 
_contentview_cbs->content_change_cb_func, NULL));
+                  prop_memo_bubble_add(obj, "Press Enter to apply changes");
                }
           }
         else
diff --git a/src/bin/egui_gui/descview.c b/src/bin/egui_gui/descview.c
index 8590d0e..cbe4da5 100644
--- a/src/bin/egui_gui/descview.c
+++ b/src/bin/egui_gui/descview.c
@@ -77,7 +77,8 @@ _description_item_content_get(It_Data *it_data)
    else if (!strcmp(it_data->desc, DB_DEF_NAME))
      {
         Eo *entry = props_entry_add(box, wdg_name_get(it_data->wdg), 
GUI_TYPE_STRING);
-        eo_do (entry, eo_event_callback_add(ELM_ENTRY_EVENT_ACTIVATED, 
_wdg_name_change_cb, it_data->wdg));
+        eo_do(entry, eo_event_callback_add(ELM_ENTRY_EVENT_ACTIVATED, 
_wdg_name_change_cb, it_data->wdg));
+        prop_memo_bubble_add(entry, "Press Enter to apply changes");
         elm_object_tooltip_text_set(entry, "Widget name");
      }
    else if (!strcmp(it_data->desc, DB_DEF_CLASS))
diff --git a/src/bin/egui_gui/itemview.c b/src/bin/egui_gui/itemview.c
index cb02400..a5c7c56 100644
--- a/src/bin/egui_gui/itemview.c
+++ b/src/bin/egui_gui/itemview.c
@@ -99,6 +99,7 @@ _item_list_content_get(void *data, Evas_Object *obj 
EINA_UNUSED, const char *par
              else
                {
                   eo_do(o, eo_event_callback_add(ELM_ENTRY_EVENT_ACTIVATED, 
_view_cbs->item_update_cb_func, NULL));
+                  prop_memo_bubble_add(o, "Press Enter to apply changes");
                }
           }
         else
diff --git a/src/bin/egui_gui/props_helper.c b/src/bin/egui_gui/props_helper.c
index 7c2961a..5bb5af5 100644
--- a/src/bin/egui_gui/props_helper.c
+++ b/src/bin/egui_gui/props_helper.c
@@ -564,3 +564,44 @@ props_value_add(Eo *box, const Gui_Widget *wdg, const 
Gui_Value *value, const Op
    return new_obj;
 }
 
+
+/* Callback deletes a bubble when object is unfocused. */
+static Eina_Bool
+_unfocused_cb(void *data, Eo *obj, const Eo_Event_Description *desc 
EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+   Eo *bubble = data;
+   eo_do(obj, eo_event_callback_del(ELM_LAYOUT_EVENT_UNFOCUSED, _unfocused_cb, 
bubble));
+   eo_del(bubble);
+   return EO_CALLBACK_CONTINUE;
+}
+
+/* Callback creates a bubble when object is focused. */
+static Eina_Bool
+_focused_cb(void *data, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, 
void *event_info EINA_UNUSED)
+{
+   Evas_Coord x ,y;
+
+   Eo *lbl = elm_label_add(obj);
+   eo_do(lbl, elm_obj_widget_part_text_set(NULL, data));
+   eo_do(lbl, evas_obj_visibility_set(EINA_TRUE));
+
+   Eo *bubble = elm_bubble_add(obj);
+   eo_do(obj, evas_obj_position_get(&x, &y));
+
+   eo_do(bubble, elm_obj_container_content_set(NULL, lbl));
+   eo_do(bubble, evas_obj_size_set(170, 45));
+   eo_do(bubble, evas_obj_color_set(255, 255, 0, 255));
+   eo_do(bubble, evas_obj_position_set(x, y - 35));
+   eo_do(bubble, evas_obj_visibility_set(EINA_TRUE));
+   eo_do(bubble, elm_obj_bubble_pos_set(ELM_BUBBLE_POS_BOTTOM_LEFT));
+
+   eo_do(obj, eo_event_callback_add(ELM_LAYOUT_EVENT_UNFOCUSED, _unfocused_cb, 
bubble));
+   return EO_CALLBACK_CONTINUE;
+}
+
+void
+prop_memo_bubble_add(Eo *obj, const char *memo)
+{
+   eo_do(obj, eo_event_callback_add(ELM_LAYOUT_EVENT_FOCUSED, _focused_cb, 
memo));
+}
+
diff --git a/src/bin/egui_gui/props_helper.h b/src/bin/egui_gui/props_helper.h
index b1f7b73..f3546f1 100644
--- a/src/bin/egui_gui/props_helper.h
+++ b/src/bin/egui_gui/props_helper.h
@@ -130,4 +130,8 @@ void*
 _mempool_cache_data_get(const char *key);
 void
 _mempool_cache_data_put(const char *key, void *ptr);
+
+/* API to add and show/hide memo bubble when object is focused/unfocused. */
+void
+prop_memo_bubble_add(Eo *obj, const char *memo);
 #endif

-- 


Reply via email to