};
/**
- * @brief Set a data of a widget to copy and paste.
+ * @brief Set copy and paste data to a widget.
*
- * Append the given callback to the list. This functions will be called
- * called.
+ * XXX: need to be rewritten.
+ * Append the given callback to the list. This functions will be called.
*
- * @param selection selection type for copying and pasting
- * @param widget The source widget pointer
+ * @param selection Selection type for copying and pasting
+ * @param obj The source widget pointer
* @param format Type of selection format
* @param buf The pointer of data source
* @return If EINA_TRUE, setting data is success.
* @ingroup CopyPaste
*
*/
-
-EAPI Eina_Bool elm_cnp_selection_set(Elm_Sel_Type selection, Evas_Object *widget, Elm_Sel_Format format, const void *buf, size_t buflen);
+// 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);
/**
- * @brief Retrieve the data from the widget which is set for copying and pasting.
+ * @brief Retrieve the copy and paste data from the widget.
*
- * Getting the data from the widget which is set for copying and pasting.
- * Mainly the widget is elm_entry. If then @p datacb and @p udata are
- * can be NULL. If not, @p datacb and @p udata are used for retrieving data.
+ * Gets the data from the widget which is set for copying and pasting.
+ * Mainly the widget is elm_entry. If then @p datacb and @p udata can be NULL.
+ * If not, @p datacb and @p udata are used for retrieving data.
*
* @see also elm_cnp_selection_set()
*
- * @param selection selection type for copying and pasting
- * @param widget The source widget pointer
+ * @param selection Selection type for copying and pasting
+ * @param obj The source widget pointer
* @param datacb The user data callback if the target widget isn't elm_entry
* @param udata The user data pointer for @p datacb
* @return If EINA_TRUE, getting data is success.
* @ingroup CopyPaste
*
*/
-
-EAPI Eina_Bool elm_cnp_selection_get(Elm_Sel_Type selection, Elm_Sel_Format format, Evas_Object *widget, Elm_Drop_Cb datacb, void *udata);
+// 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,
+ Elm_Drop_Cb datacb, void *udata);
/**
- * @brief Clear the data in the widget which is set for copying and pasting.
+ * @brief Clear the copy and paste data in the widget.
*
* Clear the data in the widget. Normally this function isn't need to call.
*
* @see also elm_cnp_selection_set()
*
- * @param selection selection type for copying and pasting
+ * @param selection Selection type for copying and pasting
* @param widget The source widget pointer
* @return If EINA_TRUE, clearing data is success.
*
* @ingroup CopyPaste
*
*/
-
-EAPI Eina_Bool elm_cnp_selection_clear(Elm_Sel_Type selection, Evas_Object *widget);
+// 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);
/**
* @}
#endif
}
-Eina_Bool
-elm_cnp_selection_set(Elm_Sel_Type selection, Evas_Object *widget,
+EAPI Eina_Bool
+elm_cnp_selection_set(Elm_Sel_Type selection, Evas_Object *obj,
Elm_Sel_Format format, const void *selbuf, size_t buflen)
{
#ifdef HAVE_ELEMENTARY_X
- Evas_Object *top = elm_widget_top_get(widget);
+ Evas_Object *top = elm_widget_top_get(obj);
Ecore_X_Window xwin;
Cnp_Selection *sel;
if (top) xwin = elm_win_xwindow_get(top);
- else xwin = elm_win_xwindow_get(widget);
+ else xwin = elm_win_xwindow_get(obj);
if ((!xwin) || (selection >= ELM_SEL_TYPE_MAX))
return EINA_FALSE;
if (!_elm_cnp_init_count) _elm_cnp_init();
if ((!selbuf) && (format != ELM_SEL_FORMAT_IMAGE))
- return elm_cnp_selection_clear(selection, widget);
+ return elm_cnp_selection_clear(selection, obj);
sel = selections + selection;
sel->active = EINA_TRUE;
- sel->widget = widget;
+ sel->widget = obj;
sel->set(xwin, &selection, sizeof(Elm_Sel_Type));
sel->format = format;
#endif
}
-Eina_Bool
-elm_cnp_selection_clear(Elm_Sel_Type selection, Evas_Object *widget)
+EAPI Eina_Bool
+elm_cnp_selection_clear(Elm_Sel_Type selection, Evas_Object *obj)
{
#ifdef HAVE_ELEMENTARY_X
Cnp_Selection *sel;
sel = selections + selection;
/* No longer this selection: Consider it gone! */
- if ((!sel->active) || (sel->widget != widget)) return EINA_TRUE;
+ if ((!sel->active) || (sel->widget != obj)) return EINA_TRUE;
sel->active = EINA_FALSE;
sel->widget = NULL;
#endif
}
-Eina_Bool
+EAPI Eina_Bool
elm_cnp_selection_get(Elm_Sel_Type selection, Elm_Sel_Format format,
- Evas_Object *widget, Elm_Drop_Cb datacb, void *udata)
+ Evas_Object *obj, Elm_Drop_Cb datacb, void *udata)
{
#ifdef HAVE_ELEMENTARY_X
Evas_Object *top;
if (!_elm_cnp_init_count) _elm_cnp_init();
sel = selections + selection;
- top = elm_widget_top_get(widget);
+ top = elm_widget_top_get(obj);
if (!top) return EINA_FALSE;
sel->requestformat = format;
- sel->requestwidget = widget;
+ sel->requestwidget = obj;
sel->request(elm_win_xwindow_get(top), ECORE_X_SELECTION_TARGET_TARGETS);
sel->datacb = datacb;
sel->udata = udata;