[src/lib/Elementary.h.in] Corrected some description errors in tickernoti's APIs.
[framework/uifw/elementary.git] / src / modules / popup_copypasteUI / copypaste.c
index 851bbb7..381f711 100644 (file)
@@ -3,6 +3,18 @@
 #include "elm_priv.h"
 
 Elm_Entry_Extension_data *ext_mod;
+typedef struct _Elm_Entry_Context_Menu_Item Elm_Entry_Context_Menu_Item;
+struct _Elm_Entry_Context_Menu_Item
+{
+   Evas_Object *obj;
+   const char *label;
+   const char *icon_file;
+   const char *icon_group;
+   Elm_Icon_Type icon_type;
+   Evas_Smart_Cb func;
+   void *data;
+};
+
 
 static void
 _select(void *data, Evas_Object *obj, void *event_info)
@@ -42,12 +54,18 @@ _cancel(void *data, Evas_Object *obj, void *event_info)
 static void
 _clipboard_menu(void *data, Evas_Object *obj, void *event_info)
 {
-       // start for cbhm
-       ecore_x_selection_secondary_set(elm_win_xwindow_get(obj), "",1);
-       elm_cbhm_helper_init(obj);
-       elm_cbhm_send_raw_data("show");
-       evas_object_hide(ext_mod->popup);
-       // end for cbhm
+   // start for cbhm
+#ifdef HAVE_ELEMENTARY_X
+   ecore_x_selection_secondary_set(elm_win_xwindow_get(obj), "",1);
+#endif
+   ext_mod->cnpinit(data,obj,event_info);
+   elm_cbhm_helper_init(obj);
+   if (ext_mod->cnp_mode != ELM_CNP_MODE_MARKUP)
+     elm_cbhm_send_raw_data("show0");
+   else
+     elm_cbhm_send_raw_data("show1");
+   evas_object_hide(ext_mod->popup);
+   // end for cbhm
 }
 
 static void
@@ -96,11 +114,11 @@ obj_unhook(Evas_Object *obj)
 
 EAPI void
 obj_longpress(Evas_Object *obj)
-{              
+{
        if(!ext_mod) return;
        Evas_Object *top;
        Evas_Object *list;
-       
+
        const Eina_List *l;
        const Elm_Entry_Context_Menu_Item *it;
        /*update*/
@@ -113,14 +131,14 @@ obj_longpress(Evas_Object *obj)
                if(top)
                ext_mod->popup = elm_popup_add(top);
                elm_object_style_set(ext_mod->popup,"menustyle");
-               elm_popup_set_mode(ext_mod->popup, ELM_POPUP_TYPE_ALERT);
+               elm_popup_mode_set(ext_mod->popup, ELM_POPUP_TYPE_ALERT);
                elm_popup_title_label_set(ext_mod->popup,"CopyPaste");
                list = elm_list_add(ext_mod->popup);
                elm_object_style_set(list,"popup");
-               elm_list_horizontal_mode_set(list, ELM_LIST_COMPRESS);
+               elm_list_mode_set(list, ELM_LIST_COMPRESS);
                elm_widget_sub_object_add(obj, ext_mod->popup);
                if (!ext_mod->selmode)
-               {       
+               {
                        if (!ext_mod->password)
                                elm_list_item_append(list, "Select", NULL, NULL,_select, obj);
                        if (1) // need way to detect if someone has a selection
@@ -130,7 +148,7 @@ obj_longpress(Evas_Object *obj)
                                }
        //              elm_ctxpopup_item_add(wd->ctxpopup, NULL, "Selectall",_select_all, obj );
        // start for cbhm
-                       if (!ext_mod->password)
+                       if ((!ext_mod->password) && (ext_mod->editable))
                                elm_list_item_append(list, "More", NULL, NULL,_clipboard_menu, obj);
        // end for cbhm
                }
@@ -146,7 +164,7 @@ obj_longpress(Evas_Object *obj)
                                                }
                                        else
                                                {
-                                                       _cancel(obj,ext_mod->popup,NULL);               
+                                                       _cancel(obj,ext_mod->popup,NULL);
                                                        elm_list_item_append(list, "Select", NULL, NULL,_select, obj);
                                                        if (1) // need way to detect if someone has a selection
                                                                {
@@ -155,7 +173,8 @@ obj_longpress(Evas_Object *obj)
                                                                }
                                                }
        // start for cbhm
-                                       elm_list_item_append(list, "More", NULL, NULL,_clipboard_menu, obj);
+                                       if (ext_mod->editable)
+                                               elm_list_item_append(list, "More", NULL, NULL,_clipboard_menu, obj);
        // end for cbhm
                                }
                }
@@ -167,11 +186,10 @@ obj_longpress(Evas_Object *obj)
                {
                        elm_list_go(list);
                        elm_popup_content_set(ext_mod->popup, list);
-                       evas_object_show(ext_mod->popup);              
+                       evas_object_show(ext_mod->popup);
                        evas_render( evas_object_evas_get( ext_mod->popup ) );
                }
        }
-       ext_mod->longpress_timer = NULL;
 }
 
 EAPI void
@@ -179,12 +197,5 @@ obj_mouseup(Evas_Object *obj)
 {
 /*update*/
        elm_entry_extension_module_data_get(obj,ext_mod);
-   if (ext_mod->longpress_timer)
-     {         
-               if (ext_mod->have_selection )
-                       {                               
-                               _cancel(obj,ext_mod->popup,NULL);
-                       }
-     }     
 }