2011-12-29 23:20:48 -08:00
|
|
|
/**
|
2012-02-22 18:52:07 -08:00
|
|
|
* @defgroup CopyPaste
|
|
|
|
*
|
|
|
|
* Implement the copy and paste + clipboard functionality, in order to
|
|
|
|
* share data across application windows.
|
|
|
|
*
|
|
|
|
* Contains functions to select a portion of text, stick it to a clipboard
|
|
|
|
* and to paste the selection to an appropriate place.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
2011-12-29 23:20:48 -08:00
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
typedef struct _Elm_Selection_Data Elm_Selection_Data;
|
|
|
|
typedef Eina_Bool (*Elm_Drop_Cb)(void *d, Evas_Object *o, Elm_Selection_Data *data);
|
2011-12-29 22:49:28 -08:00
|
|
|
|
2012-02-22 18:52:00 -08:00
|
|
|
/**
|
2012-02-22 18:52:07 -08:00
|
|
|
* Defines the types of selection property names.
|
2012-02-22 18:52:00 -08:00
|
|
|
* Kindly refer to http://www.x.org/docs/X11/xlib.pdf
|
|
|
|
* for more details.
|
|
|
|
*/
|
2011-12-30 01:41:11 -08:00
|
|
|
typedef enum
|
2011-12-29 23:20:48 -08:00
|
|
|
{
|
2012-02-22 18:52:00 -08:00
|
|
|
ELM_SEL_TYPE_PRIMARY, //primary text selection
|
2012-02-22 18:52:07 -08:00
|
|
|
ELM_SEL_TYPE_SECONDARY, // used when primary selection is in use.
|
2012-02-22 18:52:00 -08:00
|
|
|
ELM_SEL_TYPE_XDND, //drag and drop
|
2012-02-22 18:52:07 -08:00
|
|
|
ELM_SEL_TYPE_CLIPBOARD, // highlighted text
|
2011-12-29 23:20:48 -08:00
|
|
|
} Elm_Sel_Type;
|
2011-12-29 22:49:28 -08:00
|
|
|
|
2011-12-30 01:41:11 -08:00
|
|
|
typedef enum
|
2011-12-29 23:20:48 -08:00
|
|
|
{
|
|
|
|
/** Targets: for matching every atom requesting */
|
|
|
|
ELM_SEL_FORMAT_TARGETS = -1,
|
|
|
|
/** they come from outside of elm */
|
|
|
|
ELM_SEL_FORMAT_NONE = 0x0,
|
2012-02-14 00:50:26 -08:00
|
|
|
/** Plain unformatted text: Used for things that don't want rich markup */
|
2011-12-29 23:20:48 -08:00
|
|
|
ELM_SEL_FORMAT_TEXT = 0x01,
|
|
|
|
/** Edje textblock markup, including inline images */
|
|
|
|
ELM_SEL_FORMAT_MARKUP = 0x02,
|
|
|
|
/** Images */
|
|
|
|
ELM_SEL_FORMAT_IMAGE = 0x04,
|
|
|
|
/** Vcards */
|
|
|
|
ELM_SEL_FORMAT_VCARD = 0x08,
|
2012-02-14 00:50:26 -08:00
|
|
|
/** Raw HTML-like things for widgets that want that stuff (hello webkit!) */
|
2011-12-29 23:20:48 -08:00
|
|
|
ELM_SEL_FORMAT_HTML = 0x10,
|
|
|
|
} Elm_Sel_Format;
|
2011-12-29 22:49:28 -08:00
|
|
|
|
2011-12-29 23:20:48 -08:00
|
|
|
struct _Elm_Selection_Data
|
|
|
|
{
|
|
|
|
int x, y;
|
|
|
|
Elm_Sel_Format format;
|
|
|
|
void *data;
|
|
|
|
size_t len;
|
|
|
|
};
|
2011-12-29 22:49:28 -08:00
|
|
|
|
2011-12-29 23:20:48 -08:00
|
|
|
/**
|
2012-02-15 23:06:13 -08:00
|
|
|
* @brief Set copy and paste data to a widget.
|
2011-12-29 23:20:48 -08:00
|
|
|
*
|
2012-02-15 23:06:13 -08:00
|
|
|
* XXX: need to be rewritten.
|
|
|
|
* Append the given callback to the list. This functions will be called.
|
2011-12-29 23:20:48 -08:00
|
|
|
*
|
2012-02-15 23:06:13 -08:00
|
|
|
* @param selection Selection type for copying and pasting
|
|
|
|
* @param obj The source widget pointer
|
2011-12-29 23:20:48 -08:00
|
|
|
* @param format Type of selection format
|
|
|
|
* @param buf The pointer of data source
|
|
|
|
* @return If EINA_TRUE, setting data is success.
|
|
|
|
*
|
|
|
|
* @ingroup CopyPaste
|
|
|
|
*
|
|
|
|
*/
|
2012-02-15 23:06:13 -08:00
|
|
|
// 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);
|
2011-12-29 22:49:28 -08:00
|
|
|
|
2011-12-29 23:20:48 -08:00
|
|
|
/**
|
2012-02-15 23:06:13 -08:00
|
|
|
* @brief Retrieve the copy and paste data from the widget.
|
2011-12-29 23:20:48 -08:00
|
|
|
*
|
2012-02-15 23:06:13 -08:00
|
|
|
* 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.
|
2011-12-29 23:20:48 -08:00
|
|
|
*
|
|
|
|
* @see also elm_cnp_selection_set()
|
|
|
|
*
|
2012-02-15 23:06:13 -08:00
|
|
|
* @param selection Selection type for copying and pasting
|
2012-02-20 14:55:40 -08:00
|
|
|
* @param format Type of selection format
|
2012-02-15 23:06:13 -08:00
|
|
|
* @param obj The source widget pointer
|
2011-12-29 23:20:48 -08:00
|
|
|
* @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
|
|
|
|
*
|
|
|
|
*/
|
2012-02-15 23:06:13 -08:00
|
|
|
// 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);
|
2011-12-29 22:49:28 -08:00
|
|
|
|
2011-12-29 23:20:48 -08:00
|
|
|
/**
|
2012-02-15 23:06:13 -08:00
|
|
|
* @brief Clear the copy and paste data in the widget.
|
2011-12-29 23:20:48 -08:00
|
|
|
*
|
|
|
|
* Clear the data in the widget. Normally this function isn't need to call.
|
|
|
|
*
|
|
|
|
* @see also elm_cnp_selection_set()
|
|
|
|
*
|
2012-02-15 23:06:13 -08:00
|
|
|
* @param selection Selection type for copying and pasting
|
2012-02-18 07:40:39 -08:00
|
|
|
* @param obj The source widget pointer
|
2011-12-29 23:20:48 -08:00
|
|
|
* @return If EINA_TRUE, clearing data is success.
|
|
|
|
*
|
|
|
|
* @ingroup CopyPaste
|
|
|
|
*
|
|
|
|
*/
|
2012-02-15 23:06:13 -08:00
|
|
|
// 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);
|
2011-12-29 22:49:28 -08:00
|
|
|
|
2011-12-29 23:20:48 -08:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|