4 * Implement the copy and paste + clipboard functionality, in order to
5 * share data across application windows.
7 * Contains functions to select a portion of text, stick it to a clipboard
8 * and to paste the selection to an appropriate place.
16 * Defines the types of selection property names.
17 * Kindly refer to http://www.x.org/docs/X11/xlib.pdf
22 ELM_SEL_TYPE_PRIMARY, // refers to primary text selection
23 ELM_SEL_TYPE_SECONDARY, // used when primary selection is in use.
24 ELM_SEL_TYPE_XDND, // drag and drop
25 ELM_SEL_TYPE_CLIPBOARD, // selected text
29 * Defines the types of target.
33 /** Targets: for matching every atom requesting */
34 ELM_SEL_FORMAT_TARGETS = -1,
35 /** they come from outside of elm */
36 ELM_SEL_FORMAT_NONE = 0x0,
37 /** Plain unformatted text: Used for things that don't want rich markup */
38 ELM_SEL_FORMAT_TEXT = 0x01,
39 /** Edje textblock markup, including inline images */
40 ELM_SEL_FORMAT_MARKUP = 0x02,
42 ELM_SEL_FORMAT_IMAGE = 0x04,
44 ELM_SEL_FORMAT_VCARD = 0x08,
45 /** Raw HTML-like things for widgets that want that stuff (hello webkit!) */
46 ELM_SEL_FORMAT_HTML = 0x10,
50 * Structure holding the info about selected data.
52 struct _Elm_Selection_Data
55 Elm_Sel_Format format;
59 typedef struct _Elm_Selection_Data Elm_Selection_Data;
62 * Callback invoked in when the selected data is 'dropped' at its destination.
64 * @param d Application specific data
65 * @param o The evas object where selected data is 'dropped'.
66 * @param data struct holding information about selected data
68 typedef Eina_Bool (*Elm_Drop_Cb)(void *d, Evas_Object *o, Elm_Selection_Data *data);
72 * @brief Set copy and paste data to a widget.
74 * XXX: need to be rewritten.
75 * Append the given callback to the list. This functions will be called.
77 * @param selection Selection type for copying and pasting
78 * @param obj The source widget pointer
79 * @param format Type of selection format
80 * @param buf The pointer of data source
81 * @param buflen The size of @c buf
82 * @return If EINA_TRUE, setting data is success.
87 // XXX: EAPI void elm_object_cnp_selection_set(Evas_Object *obj, Elm_Sel_Type selection,
88 // Elm_Sel_Format format, const void *buf,
90 EAPI Eina_Bool elm_cnp_selection_set(Elm_Sel_Type selection, Evas_Object *obj,
91 Elm_Sel_Format format, const void *buf,
95 * @brief Retrieve the copy and paste data from the widget.
97 * Gets the data from the widget which is set for copying and pasting.
98 * Mainly the widget is elm_entry. If then @p datacb and @p udata can be NULL.
99 * If not, @p datacb and @p udata are used for retrieving data.
101 * @see also elm_cnp_selection_set()
103 * @param selection Selection type for copying and pasting
104 * @param format Type of selection format
105 * @param obj The source widget pointer
106 * @param datacb The user data callback if the target widget isn't elm_entry
107 * @param udata The user data pointer for @p datacb
108 * @return If EINA_TRUE, getting data is success.
113 // XXX: This api needs to be refined by cnp experts.
115 // 1. return copy and paste data.
116 // 2. call cnp callback regardless of widget type.
117 // 3. apps insert text data into entry manually.
118 // XXX: EAPI void *elm_object_cnp_selection_get(Evas_Object *obj,
119 // Elm_Sel_Type selection,
120 // Elm_Sel_Format format,
121 // Elm_Cnp_Cb datacb);
122 EAPI Eina_Bool elm_cnp_selection_get(Elm_Sel_Type selection,
123 Elm_Sel_Format format, Evas_Object *obj,
124 Elm_Drop_Cb datacb, void *udata);
127 * @brief Clear the selected/copied data in the widget.
129 * @see also elm_cnp_selection_set()
131 * @param obj The source widget pointer
132 * @param selection Selection type for copying and pasting
133 * @return If EINA_TRUE, clearing data is success.
138 EAPI Eina_Bool elm_object_cnp_selection_clear(Evas_Object *obj,
139 Elm_Sel_Type selection);