From: sanjeev Date: Thu, 23 Feb 2012 02:52:11 +0000 (+0000) Subject: Fix a few more review comments for cnp. X-Git-Tag: REL_F_I9500_20120323_1~17^2~590 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=435d05d3d5eda3ba17b950219e2f6bfbf86debe8;p=framework%2Fuifw%2Felementary.git Fix a few more review comments for cnp. Signed-off-by: Sanjeev BA git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@68292 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/bin/test_cnp.c b/src/bin/test_cnp.c index 470cc14..b4c9b97 100644 --- a/src/bin/test_cnp.c +++ b/src/bin/test_cnp.c @@ -32,7 +32,7 @@ _bt_clear_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UN Evas_Object *en = (Evas_Object*)(data); elm_object_text_set(glb, ""); - elm_cnp_selection_clear(ELM_SEL_TYPE_CLIPBOARD, elm_object_parent_widget_get(en)); + elm_object_cnp_selection_clear(elm_object_parent_widget_get(en), ELM_SEL_TYPE_CLIPBOARD); } void diff --git a/src/lib/elm_cnp.c b/src/lib/elm_cnp.c index 337ee5c..d634120 100644 --- a/src/lib/elm_cnp.c +++ b/src/lib/elm_cnp.c @@ -404,7 +404,7 @@ elm_cnp_selection_set(Elm_Sel_Type selection, Evas_Object *obj, return EINA_FALSE; if (!_elm_cnp_init_count) _elm_cnp_init(); if ((!selbuf) && (format != ELM_SEL_FORMAT_IMAGE)) - return elm_cnp_selection_clear(selection, obj); + return elm_object_cnp_selection_clear(obj, selection); sel = selections + selection; @@ -433,7 +433,7 @@ elm_cnp_selection_set(Elm_Sel_Type selection, Evas_Object *obj, } EAPI Eina_Bool -elm_cnp_selection_clear(Elm_Sel_Type selection, Evas_Object *obj) +elm_object_cnp_selection_clear(Evas_Object *obj, Elm_Sel_Type selection) { #ifdef HAVE_ELEMENTARY_X Cnp_Selection *sel; diff --git a/src/lib/elm_cnp.h b/src/lib/elm_cnp.h index 7dfa178..77ab046 100644 --- a/src/lib/elm_cnp.h +++ b/src/lib/elm_cnp.h @@ -11,8 +11,6 @@ * * @{ */ -typedef struct _Elm_Selection_Data Elm_Selection_Data; -typedef Eina_Bool (*Elm_Drop_Cb)(void *d, Evas_Object *o, Elm_Selection_Data *data); /** * Defines the types of selection property names. @@ -21,12 +19,15 @@ typedef Eina_Bool (*Elm_Drop_Cb)(void *d, Evas_Object *o, Elm_Sel */ typedef enum { - ELM_SEL_TYPE_PRIMARY, //primary text selection + ELM_SEL_TYPE_PRIMARY, // refers to primary text selection ELM_SEL_TYPE_SECONDARY, // used when primary selection is in use. - ELM_SEL_TYPE_XDND, //drag and drop - ELM_SEL_TYPE_CLIPBOARD, // highlighted text + ELM_SEL_TYPE_XDND, // drag and drop + ELM_SEL_TYPE_CLIPBOARD, // selected text } Elm_Sel_Type; +/** + * Defines the types of target. + */ typedef enum { /** Targets: for matching every atom requesting */ @@ -45,13 +46,27 @@ typedef enum ELM_SEL_FORMAT_HTML = 0x10, } Elm_Sel_Format; +/** + * Structure holding the info about selected data. + */ struct _Elm_Selection_Data { - int x, y; + Evas_Coord x, y; Elm_Sel_Format format; void *data; size_t len; }; +typedef struct _Elm_Selection_Data Elm_Selection_Data; + +/** + * Callback invoked in when the selected data is 'dropped' at its destination. + * + * @param d Application specific data + * @param o The evas object where selected data is 'dropped'. + * @param data struct holding information about selected data + */ +typedef Eina_Bool (*Elm_Drop_Cb)(void *d, Evas_Object *o, Elm_Selection_Data *data); + /** * @brief Set copy and paste data to a widget. @@ -108,23 +123,19 @@ EAPI Eina_Bool elm_cnp_selection_get(Elm_Sel_Type selection, Elm_Drop_Cb datacb, void *udata); /** - * @brief Clear the copy and paste data in the widget. - * - * Clear the data in the widget. Normally this function isn't need to call. + * @brief Clear the selected/copied data in the widget. * * @see also elm_cnp_selection_set() * - * @param selection Selection type for copying and pasting * @param obj The source widget pointer + * @param selection Selection type for copying and pasting * @return If EINA_TRUE, clearing data is success. * * @ingroup CopyPaste * */ -// XXX: EAPI void elm_object_cnp_selection_clear(Evas_Object *obj, -// Elm_Sel_Type selection); -EAPI Eina_Bool elm_cnp_selection_clear(Elm_Sel_Type selection, - Evas_Object *obj); +EAPI Eina_Bool elm_object_cnp_selection_clear(Evas_Object *obj, + Elm_Sel_Type selection); /** * @} diff --git a/src/lib/elm_entry.c b/src/lib/elm_entry.c index ed3a0f2..ab8442d 100644 --- a/src/lib/elm_entry.c +++ b/src/lib/elm_entry.c @@ -1633,7 +1633,7 @@ _signal_selection_cleared(void *data, Evas_Object *obj __UNUSED__, const char *e top = elm_widget_top_get(data); if ((top) && (elm_win_xwindow_get(top))) - elm_cnp_selection_clear(ELM_SEL_TYPE_PRIMARY, data); + elm_object_cnp_selection_clear(data, ELM_SEL_TYPE_PRIMARY); #endif } }