Implements the following functionality a. More...

Data Structures

struct  _Elm_Selection_Data
 Structure holding the info about selected data. More...

Typedefs

typedef Eina_Bool(* Elm_Drop_Cb )(void *data, Evas_Object *obj, Elm_Selection_Data *ev)
 Callback invoked in when the selected data is 'dropped' at its destination.
typedef void(* Elm_Selection_Loss_Cb )(void *data, Elm_Sel_Type selection)
 Callback invoked in when the selection ownership for a given selection is lost.

Enumerations

enum  Elm_Sel_Type {
  ELM_SEL_TYPE_PRIMARY,
  ELM_SEL_TYPE_SECONDARY,
  ELM_SEL_TYPE_XDND,
  ELM_SEL_TYPE_CLIPBOARD
}
 Defines the types of selection property names. More...
enum  Elm_Sel_Format {
  ELM_SEL_FORMAT_TARGETS = -1,
  ELM_SEL_FORMAT_NONE = 0x0,
  ELM_SEL_FORMAT_TEXT = 0x01,
  ELM_SEL_FORMAT_MARKUP = 0x02,
  ELM_SEL_FORMAT_IMAGE = 0x04,
  ELM_SEL_FORMAT_VCARD = 0x08,
  ELM_SEL_FORMAT_HTML = 0x10
}
 Defines the types of content. More...

Functions

Eina_Bool elm_cnp_selection_set (Evas_Object *obj, Elm_Sel_Type selection, Elm_Sel_Format format, const void *buf, size_t buflen)
 Set copy data for a widget.
Eina_Bool elm_cnp_selection_get (Evas_Object *obj, Elm_Sel_Type selection, Elm_Sel_Format format, Elm_Drop_Cb datacb, void *udata)
 Retrieve data from a widget that has a selection.
Eina_Bool elm_object_cnp_selection_clear (Evas_Object *obj, Elm_Sel_Type selection)
 Clear the selection data of a widget.
void elm_cnp_selection_loss_callback_set (Evas_Object *obj, Elm_Sel_Type selection, Elm_Selection_Loss_Cb func, const void *data)
 Set a function to be called when a selection is lost.

Detailed Description

Implements the following functionality a.

select, copy/cut and paste b. clipboard c. drag and drop in order to share data across application windows.

Contains functions to select text or a portion of data, send it to a buffer, and paste the data into a target.

elm_cnp provides a generic copy and paste facility based on its windowing system. It is not necessary to know the details of each windowing system, but some terms and behavior are common. Currently the X11 window system is widely used, and only X11 functionality is implemented.

In X11R6 window system, CopyPaste works like a peer-to-peer communication. Copying is an operation on an object in an X server. X11 calls those objects 'selections' which have names. Generally, two selection types are needed for copy and paste: The Primary selection and the Clipboard selection. Primary selection is for selecting text (that means highlighted text). Clipboard selection is for explicit copying behavior (such as ctrl+c, or 'copy' in a menu). Thus, in applications most cases only use the clipboard selection. As stated before, taking ownership of a selection doesn't move any actual data. Copying and Pasting is described as follows: 1. Copy text in Program A : Program A takes ownership of the selection 2. Paste text in Program B : Program B notes that Program A owns the selection 3. Program B asks A for the text 4. Program A responds and sends the text to program B 5. Program B pastes the response More information is on

TODO: add for other window system.


Typedef Documentation

typedef Eina_Bool(* Elm_Drop_Cb)(void *data, Evas_Object *obj, Elm_Selection_Data *ev)

Callback invoked in when the selected data is 'dropped' at its destination.

Parameters:
dataApplication specific data
objThe evas object where selected data is 'dropped'.
evstruct holding information about selected data FIXME: this should probably be a smart callback
typedef void(* Elm_Selection_Loss_Cb)(void *data, Elm_Sel_Type selection)

Callback invoked in when the selection ownership for a given selection is lost.

Parameters:
dataApplication specific data
selectionThe selection that is lost
Since:
1.7

Enumeration Type Documentation

Defines the types of content.

Enumerator:
ELM_SEL_FORMAT_TARGETS 

For matching every possible atom.

ELM_SEL_FORMAT_NONE 

Content is from outside of Elementary.

ELM_SEL_FORMAT_TEXT 

Plain unformatted text: Used for things that don't want rich markup.

ELM_SEL_FORMAT_MARKUP 

Edje textblock markup, including inline images.

ELM_SEL_FORMAT_IMAGE 

Images.

ELM_SEL_FORMAT_VCARD 

Vcards.

ELM_SEL_FORMAT_HTML 

Raw HTML-like data (eg.

webkit)

Defines the types of selection property names.

See also:
http://www.x.org/docs/X11/xlib.pdf for more details.
Enumerator:
ELM_SEL_TYPE_PRIMARY 

Primary text selection (highlighted or selected text)

ELM_SEL_TYPE_SECONDARY 

Used when primary selection is in use.

ELM_SEL_TYPE_XDND 

Drag 'n' Drop.

ELM_SEL_TYPE_CLIPBOARD 

Clipboard selection (ctrl+C)


Function Documentation

Eina_Bool elm_cnp_selection_get ( Evas_Object *  obj,
Elm_Sel_Type  selection,
Elm_Sel_Format  format,
Elm_Drop_Cb  datacb,
void *  udata 
)

Retrieve data from a widget that has a selection.

Gets the current selection data from a widget. The widget input here will usually be elm_entry, in which case datacb and udata can be NULL. If a different widget is passed, datacb and udata are used for retrieving data.

See also:
also elm_cnp_selection_set()
Parameters:
selectionSelection type for copying and pasting
formatSelection format
objThe source widget
datacbThe user data callback if the target widget isn't elm_entry
udataThe user data pointer for datacb
Returns:
If EINA_TRUE, getting selection data was successful.

References ELM_SEL_TYPE_CLIPBOARD, and elm_win_wl_window_get().

void elm_cnp_selection_loss_callback_set ( Evas_Object *  obj,
Elm_Sel_Type  selection,
Elm_Selection_Loss_Cb  func,
const void *  data 
)

Set a function to be called when a selection is lost.

The function func is set of be called when selection selection is lost to another process or when elm_cnp_selection_set() is called. If func is NULL then it is not called. data is passed as the data parameter to the callback functions and selection is passed in as the selection that has been lost.

elm_cnp_selection_set() and elm_object_cnp_selection_clear() automatically set this los callback to NULL when called. If you wish to take the selection and then be notified of loss please do this (for example):

See also:
also elm_cnp_selection_set()
Parameters:
objThe object to indicate the window target/display system.
selectionSelection to be notified of for loss
funcThe function to call
dataThe data pointer passed to the function.
Since:
1.7

References ELM_SEL_TYPE_CLIPBOARD.

Eina_Bool elm_cnp_selection_set ( Evas_Object *  obj,
Elm_Sel_Type  selection,
Elm_Sel_Format  format,
const void *  buf,
size_t  buflen 
)

Set copy data for a widget.

Set copy data and take ownership of selection. Format is used for specifying the selection type, and this is used during pasting.

Parameters:
selectionSelection type for copying and pasting
objThe source widget pointer
formatSelection format
bufThe data selected
buflenThe size of buf
Returns:
If EINA_TRUE, setting data was successful.

References ELM_SEL_TYPE_CLIPBOARD, and elm_win_wl_window_get().

Eina_Bool elm_object_cnp_selection_clear ( Evas_Object *  obj,
Elm_Sel_Type  selection 
)

Clear the selection data of a widget.

Clear all data from the selection which is owned by a widget.

See also:
also elm_cnp_selection_set()
Parameters:
objThe source widget
selectionSelection type for copying and pasting
Returns:
If EINA_TRUE, clearing data was successful.

References ELM_SEL_TYPE_CLIPBOARD.