From: Hyoyoung Chang <hyoyoung@gmail.com>

Subject: [E-devel] [patch] elm_cnp - revise apis
Date: Tue, 28 Feb 2012 15:11:12 +0900

Dear all.

I made a small patch about revise cnp apis.
It changed argument orders of apis to consistence and make elm widget centric.
now all cnp api's first argument is a elm widget.
It breaks api compatibility. so elementarychanges is needed to update.

thanks.


SVN revision: 68491
This commit is contained in:
Hyoyoung Chang 2012-02-28 06:17:22 +00:00 committed by Mike Blumenkrantz
parent 1cbee6a1cc
commit d7bc38e0d5
4 changed files with 20 additions and 28 deletions

View File

@ -13,7 +13,7 @@ _bt_copy_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNU
const char *txt = elm_object_text_get(en);
elm_object_text_set(glb, txt);
elm_cnp_selection_set(ELM_SEL_TYPE_CLIPBOARD, elm_object_parent_widget_get(en),
elm_cnp_selection_set(elm_object_parent_widget_get(en), ELM_SEL_TYPE_CLIPBOARD,
ELM_SEL_FORMAT_TEXT, txt, strlen(txt));
}
@ -22,8 +22,8 @@ _bt_paste_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UN
{
Evas_Object *en = (Evas_Object*)(data);
elm_cnp_selection_get(ELM_SEL_TYPE_CLIPBOARD, ELM_SEL_FORMAT_TEXT,
en, NULL, NULL);
elm_cnp_selection_get(en, ELM_SEL_TYPE_CLIPBOARD, ELM_SEL_FORMAT_TEXT,
NULL, NULL);
}
static void

View File

@ -390,7 +390,7 @@ elm_selection_selection_has_owner(void)
}
EAPI Eina_Bool
elm_cnp_selection_set(Elm_Sel_Type selection, Evas_Object *obj,
elm_cnp_selection_set(Evas_Object *obj, Elm_Sel_Type selection,
Elm_Sel_Format format, const void *selbuf, size_t buflen)
{
#ifdef HAVE_ELEMENTARY_X
@ -463,8 +463,8 @@ elm_object_cnp_selection_clear(Evas_Object *obj, Elm_Sel_Type selection)
}
EAPI Eina_Bool
elm_cnp_selection_get(Elm_Sel_Type selection, Elm_Sel_Format format,
Evas_Object *obj, Elm_Drop_Cb datacb, void *udata)
elm_cnp_selection_get(Evas_Object *obj, Elm_Sel_Type selection,
Elm_Sel_Format format, Elm_Drop_Cb datacb, void *udata)
{
#ifdef HAVE_ELEMENTARY_X
Evas_Object *top;

View File

@ -113,12 +113,9 @@ typedef Eina_Bool (*Elm_Drop_Cb)(void *data, Evas_Object *obj, Elm_Selection_Dat
* @ingroup CopyPaste
*
*/
// XXX: EAPI void elm_object_cnp_selection_set(Evas_Object *obj, Elm_Sel_Type selection,
// Elm_Sel_Format format, const void *buf,
// size_t buflen);
EAPI Eina_Bool elm_cnp_selection_set(Elm_Sel_Type selection, Evas_Object *obj,
Elm_Sel_Format format, const void *buf,
size_t buflen);
EAPI Eina_Bool elm_cnp_selection_set(Evas_Object *obj, Elm_Sel_Type selection,
Elm_Sel_Format format,
const void *buf, size_t buflen);
/**
* @brief Retrieve data from a widget that has a selection.
@ -142,15 +139,10 @@ EAPI Eina_Bool elm_cnp_selection_set(Elm_Sel_Type selection, Evas_Object *obj,
*/
// XXX: This api needs to be refined by cnp experts.
// I suggest:
// 1. return copy and paste data.
// 2. call cnp callback regardless of widget type.
// 3. apps insert text data into entry manually.
// XXX: EAPI void *elm_object_cnp_selection_get(Evas_Object *obj,
// Elm_Sel_Type selection,
// Elm_Sel_Format format,
// Elm_Cnp_Cb datacb);
EAPI Eina_Bool elm_cnp_selection_get(Elm_Sel_Type selection,
Elm_Sel_Format format, Evas_Object *obj,
// 1. call cnp callback regardless of widget type.
// 2. apps insert text data into entry manually.
EAPI Eina_Bool elm_cnp_selection_get(Evas_Object *obj, Elm_Sel_Type selection,
Elm_Sel_Format format,
Elm_Drop_Cb datacb, void *udata);
/**
@ -167,8 +159,8 @@ EAPI Eina_Bool elm_cnp_selection_get(Elm_Sel_Type selection,
* @ingroup CopyPaste
*
*/
EAPI Eina_Bool elm_object_cnp_selection_clear(Evas_Object *obj,
Elm_Sel_Type selection);
EAPI Eina_Bool elm_object_cnp_selection_clear(Evas_Object *obj,
Elm_Sel_Type selection);
/**
* @}

View File

@ -1182,7 +1182,7 @@ _paste(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
formats = ELM_SEL_FORMAT_MARKUP;
if (!wd->textonly)
formats |= ELM_SEL_FORMAT_IMAGE;
elm_cnp_selection_get(ELM_SEL_TYPE_CLIPBOARD, formats, data, NULL, NULL);
elm_cnp_selection_get(data, ELM_SEL_TYPE_CLIPBOARD, formats, NULL, NULL);
#endif
}
}
@ -1196,7 +1196,7 @@ _store_selection(Elm_Sel_Type seltype, Evas_Object *obj)
if (!wd) return;
sel = edje_object_part_text_selection_get(wd->ent, "elm.text");
if ((!sel) || (!sel[0])) return; /* avoid deleting our own selection */
elm_cnp_selection_set(seltype, obj, ELM_SEL_FORMAT_MARKUP, sel, strlen(sel));
elm_cnp_selection_set(obj, seltype, ELM_SEL_FORMAT_MARKUP, sel, strlen(sel));
if (seltype == ELM_SEL_TYPE_CLIPBOARD)
eina_stringshare_replace(&wd->cut_sel, sel);
}
@ -1588,7 +1588,7 @@ _signal_selection_start(void *data, Evas_Object *obj __UNUSED__, const char *emi
top = elm_widget_top_get(data);
if (txt && top && (elm_win_xwindow_get(top)))
elm_cnp_selection_set(ELM_SEL_TYPE_PRIMARY, data,
elm_cnp_selection_set(data, ELM_SEL_TYPE_PRIMARY,
ELM_SEL_FORMAT_MARKUP, txt, strlen(txt));
}
#endif
@ -1637,7 +1637,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_set(ELM_SEL_TYPE_PRIMARY, data,
elm_cnp_selection_set(data, ELM_SEL_TYPE_PRIMARY,
ELM_SEL_FORMAT_MARKUP, wd->cut_sel,
strlen(wd->cut_sel));
#endif
@ -1674,7 +1674,7 @@ _signal_entry_paste_request(void *data, Evas_Object *obj __UNUSED__, const char
if ((top) && (elm_win_xwindow_get(top)))
{
wd->selection_asked = EINA_TRUE;
elm_cnp_selection_get(type, ELM_SEL_FORMAT_MARKUP, data,
elm_cnp_selection_get(data, type, ELM_SEL_FORMAT_MARKUP,
NULL, NULL);
}
#endif