Tizen Native API  4.0
Clipboard History Manager

This module provides functionalities of copy and paste for applications.

This module provides functionalities about clipboard.

Required Header

#include <cbhm.h>

Overview

Clipboard provides functionalities for copy and paste for applications The clipboard manages the history of copied items from applications. data can be transferred between applications by using clipboard with copy and paste operations

Functions

int cbhm_open_service (cbhm_h *cbhm_handle)
 Creates and initializes clipboard handle.
int cbhm_close_service (cbhm_h cbhm_handle)
 Closes clipboard handle.
int cbhm_show (cbhm_h cbhm_handle)
 Shows clipboard.
int cbhm_hide (cbhm_h cbhm_handle)
 Hides clipboard.
int cbhm_selection_type_set (cbhm_h cbhm_handle, cbhm_sel_type_e type)
 Sets clipboard selection type.
int cbhm_selection_type_get (cbhm_h cbhm_handle, cbhm_sel_type_e *type)
 Gets clipboard selection type.
int cbhm_item_selected_callback_add (cbhm_h cbhm_handle, cbhm_selected_cb callback, void *user_data)
 Adds event callback function of selecting a clipboard item.
int cbhm_item_selected_callback_remove (cbhm_h cbhm_handle, cbhm_selected_cb callback, void *user_data)
 Removes event callback function for selecting a clipboard item.
int cbhm_selection_set (cbhm_h cbhm_handle, cbhm_sel_type_e type, const void *data, size_t len)
 Sends data to clipboard.
int cbhm_selection_get (cbhm_h cbhm_handle, cbhm_sel_type_e type, cbhm_selection_data_cb callback, void *user_data)
 Receives data from clipboard.
int cbhm_item_count_get (cbhm_h cbhm_handle)
 Gets the count of clipboard items.
int cbhm_latest_item_type_get (cbhm_h cbhm_handle, cbhm_sel_type_e *type)
 Gets the type of the latest item in clipboard.
int cbhm_item_changed_callback_add (cbhm_h cbhm_handle, cbhm_item_changed_cb callback, void *user_data)
 Adds event callback function for receiving changed event of clipboard items.
int cbhm_item_changed_callback_remove (cbhm_h cbhm_handle, cbhm_item_changed_cb callback, void *user_data)
 Removes event callback function for receiving changed event of clipboard items.
int cbhm_state_get (cbhm_h cbhm_handle, cbhm_state_type_e *type)
 Gets the clipboard state.
int cbhm_monitor_callback_add (cbhm_h cbhm_handle, cbhm_monitor_cb callback, void *user_data)
 Adds event callback function of receiving monitored event of clipboard.
int cbhm_monitor_callback_remove (cbhm_h cbhm_handle, cbhm_monitor_cb callback, void *user_data)
 Deletes event callback function of receiving monitored event of clipboard.

Typedefs

typedef struct cbhm * cbhm_h
 Clipboard handle.
typedef int(* cbhm_selected_cb )(cbhm_h cbhm_handle, void *user_data)
 Event callback signature of selecting a clipboard item.
typedef int(* cbhm_selection_data_cb )(cbhm_h cbhm_handle, const char *buf, size_t len, void *user_data)
 Event callback signature of receiving data from clipboard.
typedef void(* cbhm_item_changed_cb )(cbhm_h cbhm_handle, int item_count, void *user_data)
 Event callback signature for receiving changed event of clipboard items.
typedef void(* cbhm_monitor_cb )(cbhm_h cbhm_handle, bool active_state, void *user_data)
 Event callback signature of receiving monitored event of clipboard.

Typedef Documentation

typedef struct cbhm* cbhm_h

Clipboard handle.

Since :
3.0
typedef void(* cbhm_item_changed_cb)(cbhm_h cbhm_handle, int item_count, void *user_data)

Event callback signature for receiving changed event of clipboard items.

Since :
4.0
Parameters:
[in]cbhm_handleThe clipboard handle
Remarks:
cbhm_handle is the same handle as the one used in the cbhm_item_changed_callback_add() call with which the callback was added
Parameters:
[in]item_countThe number of clipboard items
[in]user_dataUser data to be passed to the given event callback function
Returns:
CBHM_ERROR_NONE on success, otherwise a negative error value
Return values:
CBHM_ERROR_NONESuccessful
See also:
cbhm_item_selected_callback_add()
typedef void(* cbhm_monitor_cb)(cbhm_h cbhm_handle, bool active_state, void *user_data)

Event callback signature of receiving monitored event of clipboard.

Since :
4.0
Parameters:
[in]cbhm_handleClipboard handle
[in]active_stateClipboard is active if true, inactive otherwise
[in]user_dataUser data to be passed to the given event callback function
See also:
cbhm_monitor_callback_add()
cbhm_monitor_callback_remove()
typedef int(* cbhm_selected_cb)(cbhm_h cbhm_handle, void *user_data)

Event callback signature of selecting a clipboard item.

Since :
3.0
Parameters:
[in]cbhm_handleClipboard handle
[in]user_dataUser data to be passed to the given event callback function
Returns:
This is reserved
See also:
cbhm_item_selected_callback_add()
typedef int(* cbhm_selection_data_cb)(cbhm_h cbhm_handle, const char *buf, size_t len, void *user_data)

Event callback signature of receiving data from clipboard.

Since :
3.0
Parameters:
[in]Clipboardhandle
[out]bufBuffer for receiving data
[in]lenThe length of buffer
[in]user_dataUser data to be passed to the given event callback function
Returns:
This is reserved
See also:
cbhm_item_selected_callback_add()

Enumeration Type Documentation

Enumeration for Clipboard Error Codes.

Since :
3.0
Enumerator:
CBHM_ERROR_NONE 

Successful

CBHM_ERROR_OUT_OF_MEMORY 

Out of memory

CBHM_ERROR_NOT_SUPPORTED 

Not supported

CBHM_ERROR_INVALID_PARAMETER 

Invalid parameter

CBHM_ERROR_NO_DATA 

No data available

CBHM_ERROR_CONNECTION_REFUSED 

Connection refused

CBHM_ERROR_ADDRES_IN_USE 

Address already in use

Enumeration for Clipboard Data Type.

Since :
3.0
Enumerator:
CBHM_SEL_TYPE_TEXT 

Content is from outside of Elementary

CBHM_SEL_TYPE_MARKUP 

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

CBHM_SEL_TYPE_IMAGE 

Edje textblock markup, including inline images

CBHM_SEL_TYPE_HTML 

Images

Enumeration for Clipboard State Type.

Since :
3.0

Function Documentation

int cbhm_close_service ( cbhm_h  cbhm_handle)

Closes clipboard handle.

Since :
3.0
Parameters:
[in]cbhm_handleClipboard handle
Returns:
0 on success, otherwise a negative error value
Return values:
CBHM_ERROR_NONESuccessful
CBHM_ERROR_INVALID_PARAMETERInvalid function parameters
See also:
cbhm_open_service()
int cbhm_hide ( cbhm_h  cbhm_handle)

Hides clipboard.

Since :
3.0
Parameters:
[in]cbhm_handleClipboard handle
Returns:
0 on success, otherwise a negative error value
Return values:
CBHM_ERROR_NONESuccessful
CBHM_ERROR_INVALID_PARAMETERInvalid function parameters
See also:
cbhm_show()
int cbhm_item_changed_callback_add ( cbhm_h  cbhm_handle,
cbhm_item_changed_cb  callback,
void *  user_data 
)

Adds event callback function for receiving changed event of clipboard items.

Since :
4.0
Parameters:
[in]cbhm_handleThe clipboard handle
[in]callbackThe callback function called when a clipboard item is changed
[in]user_dataUser data to be passed to the given event callback function
Returns:
0 on success, otherwise a negative error value
Return values:
CBHM_ERROR_NONESuccessful
CBHM_ERROR_INVALID_PARAMETERInvalid function parameters
CBHM_ERROR_OUT_OF_MEMORYOut of memory
int cbhm_item_changed_callback_remove ( cbhm_h  cbhm_handle,
cbhm_item_changed_cb  callback,
void *  user_data 
)

Removes event callback function for receiving changed event of clipboard items.

Since :
4.0
Parameters:
[in]cbhm_handleThe clipboard handle
[in]callbackThe callback function to be removed
[in]user_dataUser data to be passed to the given event callback function
Returns:
0 on success, otherwise a negative error value
Return values:
CBHM_ERROR_NONESuccessful
CBHM_ERROR_INVALID_PARAMETERInvalid function parameters
int cbhm_item_count_get ( cbhm_h  cbhm_handle)

Gets the count of clipboard items.

Since :
3.0
Parameters:
[in]cbhm_handleClipboard handle
Returns:
The count of clipboard items
Return values:
CBHM_ERROR_INVALID_PARAMETERInvalid function parameters
int cbhm_item_selected_callback_add ( cbhm_h  cbhm_handle,
cbhm_selected_cb  callback,
void *  user_data 
)

Adds event callback function of selecting a clipboard item.

Since :
3.0
Parameters:
[in]cbhm_handleClipboard handle
[in]callbackCallback function called when a clipboard item is selected
[in]user_dataUser data to be passed to the given event callback function
Returns:
0 on success, otherwise a negative error value
Return values:
CBHM_ERROR_NONESuccessful
CBHM_ERROR_INVALID_PARAMETERInvalid function parameters
CBHM_ERROR_OUT_OF_MEMORYOut of memory
int cbhm_item_selected_callback_remove ( cbhm_h  cbhm_handle,
cbhm_selected_cb  callback,
void *  user_data 
)

Removes event callback function for selecting a clipboard item.

Since :
4.0
Parameters:
[in]cbhm_handleThe clipboard handle
[in]callbackThe callback function to be deleted
[in]user_dataUser data to be passed to the given event callback function
Returns:
0 on success, otherwise a negative error value
Return values:
CBHM_ERROR_NONESuccessful
CBHM_ERROR_INVALID_PARAMETERInvalid function parameters
int cbhm_latest_item_type_get ( cbhm_h  cbhm_handle,
cbhm_sel_type_e type 
)

Gets the type of the latest item in clipboard.

Since :
4.0
Parameters:
[in]cbhm_handleThe clipboard handle
[out]typeThe type of the latest item
Returns:
0 on success, otherwise a negative error value
Return values:
CBHM_ERROR_NONESuccessful
CBHM_ERROR_INVALID_PARAMETERInvalid function parameters
See also:
cbhm_selection_type_set()
int cbhm_monitor_callback_add ( cbhm_h  cbhm_handle,
cbhm_monitor_cb  callback,
void *  user_data 
)

Adds event callback function of receiving monitored event of clipboard.

Since :
4.0
Parameters:
[in]cbhm_handleClipboard handle
[in]callbackCallback function called when clipboard becomes active or inactive
[in]user_dataUser data to be passed to the given event callback function
Returns:
0 on success, otherwise a negative error value
Return values:
CBHM_ERROR_NONESuccessful
CBHM_ERROR_INVALID_PARAMETERInvalid function parameters
CBHM_ERROR_OUT_OF_MEMORYOut of memory
See also:
cbhm_monitor_callback_remove()
int cbhm_monitor_callback_remove ( cbhm_h  cbhm_handle,
cbhm_monitor_cb  callback,
void *  user_data 
)

Deletes event callback function of receiving monitored event of clipboard.

Since :
4.0
Parameters:
[in]cbhm_handleClipboard handle
[in]callbackCallback function to be deleted
[in]user_dataUser data to be passed to the given event callback function
Returns:
0 on success, otherwise a negative error value
Return values:
CBHM_ERROR_NONESuccessful
CBHM_ERROR_INVALID_PARAMETERInvalid function parameters
See also:
cbhm_monitor_callback_add()
int cbhm_open_service ( cbhm_h cbhm_handle)

Creates and initializes clipboard handle.

Since :
3.0
Parameters:
[out]cbhm_handleClipboard handle
Returns:
0 on success, otherwise a negative error value
Return values:
CBHM_ERROR_NONESuccessful
CBHM_ERROR_INVALID_PARAMETERInvalid function parameters
CBHM_ERROR_OUT_OF_MEMORYOut of memory
See also:
cbhm_close_service()
int cbhm_selection_get ( cbhm_h  cbhm_handle,
cbhm_sel_type_e  type,
cbhm_selection_data_cb  callback,
void *  user_data 
)

Receives data from clipboard.

Since :
3.0
Parameters:
[in]cbhm_handleClipboard handle
[in]typeSelection type
[in]callbackCallback function receiving data from clipboard
[in]user_dataUser data to be passed to the given event callback function
Returns:
0 on success, otherwise a negative error value
Return values:
CBHM_ERROR_NONESuccessful
CBHM_ERROR_INVALID_PARAMETERInvalid function parameters
CBHM_ERROR_NO_DATANo data available
See also:
cbhm_selection_set()
int cbhm_selection_set ( cbhm_h  cbhm_handle,
cbhm_sel_type_e  type,
const void *  data,
size_t  len 
)

Sends data to clipboard.

Since :
3.0
Parameters:
[in]cbhm_handleClipboard handle
[in]typeSelection type
[in]dataData to be sent
[in]lenThe length of data
Returns:
0 on success, otherwise a negative error value
Return values:
CBHM_ERROR_NONESuccessful
CBHM_ERROR_INVALID_PARAMETERInvalid function parameters
CBHM_ERROR_OUT_OF_MEMORYOut of memory
See also:
cbhm_selection_get()
int cbhm_selection_type_get ( cbhm_h  cbhm_handle,
cbhm_sel_type_e type 
)

Gets clipboard selection type.

Since :
3.0
Parameters:
[in]cbhm_handleClipboard handle
[out]typeSelection type
Returns:
0 on success, otherwise a negative error value
Return values:
CBHM_ERROR_NONESuccessful
CBHM_ERROR_INVALID_PARAMETERInvalid function parameters
See also:
cbhm_selection_type_set()
int cbhm_selection_type_set ( cbhm_h  cbhm_handle,
cbhm_sel_type_e  type 
)

Sets clipboard selection type.

Since :
3.0
Parameters:
[in]cbhm_handleClipboard handle
[in]typeSelection type
Returns:
0 on success, otherwise a negative error value
Return values:
CBHM_ERROR_NONESuccessful
CBHM_ERROR_INVALID_PARAMETERInvalid function parameters
See also:
cbhm_selection_type_get()
int cbhm_show ( cbhm_h  cbhm_handle)

Shows clipboard.

Since :
3.0
Parameters:
[in]cbhm_handleClipboard handle
Returns:
0 on success, otherwise a negative error value
Return values:
CBHM_ERROR_NONESuccessful
CBHM_ERROR_INVALID_PARAMETERInvalid function parameters
See also:
cbhm_hide()
int cbhm_state_get ( cbhm_h  cbhm_handle,
cbhm_state_type_e type 
)

Gets the clipboard state.

Since :
4.0
Parameters:
[in]cbhm_handleClipboard handle
[out]typeState type
Returns:
0 on success, otherwise a negative error value
Return values:
CBHM_ERROR_NONESuccessful
CBHM_ERROR_INVALID_PARAMETERInvalid function parameters