bool __is_cbhm_test_running = false;
-struct _cbhm_callbacks_view {
+struct _cbhm_view {
common_view* view;
location_manager_h manager;
Evas_Object *lat_label;
Evas_Object *lon_label;
+
Evas_Object *button1;
Evas_Object *button2;
Evas_Object *button3;
Evas_Object *button4;
+
Evas_Object *editfield;
tbt_app_type_e apptype;
cbhm_h cbhm_handle;
bool monitorAdded;
};
-static void _app_destroy_cb(void* this);
-static Evas_Object *add_control_layout(cbhm_callbacks_view *this,
- Evas_Object *parent);
-static void update(cbhm_callbacks_view *this);
+static char *get_selection_type(cbhm_sel_type_e type);
+static void on_cbhm_item_changed(cbhm_h cbhm_handle, int item_count,
+ void *data);
+static int on_cbhm_selection_get(cbhm_h cbhm_handle, const char *buf,
+ size_t len, void *data);
+static void on_monitor_item_changed(cbhm_h cbhm_handle, bool active_state,
+ void *data);
+static void _selection_type_set_cb(cbhm_sel_type_e type,
+ void *data);
+static void _selection_type_show(void *data, Evas_Object *obj,
+ void *event_info);
+
+
static void _add_cb_button_pressed_cb(void *data, Evas_Object *obj,
void *event_info);
-static void _rem_cb_button_pressed_cb(void *data, Evas_Object *obj,
+static void _add_monitor_callback_button_pressed_cb(void *data, Evas_Object *obj,
void *event_info);
-static void _clear_label_button_pressed_cb(void *data, Evas_Object *obj,
+static void _cbhm_count_get_button_pressed_cb(void *data, Evas_Object *obj,
void *event_info);
-static void _show_clipboard_button_pressed_cb(void *data, Evas_Object *obj,
+static void _cbhm_selection_get_button_pressed_cb(void *data, Evas_Object *obj,
void *event_info);
-static void _add_monitor_callback_button_pressed_cb(void *data, Evas_Object *obj,
+static void _clear_label_button_pressed_cb(void *data, Evas_Object *obj,
void *event_info);
-static void _remove_monitor_callback_button_pressed_cb(void *data, Evas_Object *obj,
+static void _hide_clipboard_button_pressed_cb(void *data, Evas_Object *obj,
void *event_info);
-static void on_cbhm_item_changed(cbhm_h cbhm_handle, int item_count,
- void *data);
-static void on_monitor_item_changed(cbhm_h cbhm_handle, bool active_state,
- void *data);
-static void _text_type_button_pressed_cb(void *data, Evas_Object *obj,
+static void _html_type_button_pressed_cb(void *data, Evas_Object *obj,
void *event_info);
static void _markup_type_button_pressed_cb(void *data, Evas_Object *obj,
void *event_info);
-static void _html_type_button_pressed_cb(void *data, Evas_Object *obj,
+static void _rem_cb_button_pressed_cb(void *data, Evas_Object *obj,
void *event_info);
-static void _selection_type_set_cb(cbhm_sel_type_e type,
- void *data);
-static void _selection_type_show(void *data, Evas_Object *obj,
+static void _remove_monitor_callback_button_pressed_cb(void *data, Evas_Object *obj,
void *event_info);
-static char *get_selection_type(cbhm_sel_type_e type);
+static void _show_clipboard_button_pressed_cb(void *data, Evas_Object *obj,
+ void *event_info);
+static void _show_cbhm_state_button_pressed_cb(void *data, Evas_Object *obj,
+ void *event_info);
+static void _text_type_button_pressed_cb(void *data, Evas_Object *obj,
+ void *event_info);
+
+
+static Evas_Object *add_control_layout(cbhm_view *this,
+ Evas_Object *parent);
+static void update(cbhm_view *this);
+
+static void _app_destroy_cb(void* this);
+/**
+ * @function get_selection_type
+ * @since_tizen 4.0
+ * @description Get Selection Type
+ * @parameter cbhm_sel_type_e: Type
+ * @return static char *
+ */
static char *get_selection_type(cbhm_sel_type_e type)
{
char msg[40];
/**
- * @function cbhm_callbacks_view_add
+ * @function on_cbhm_item_changed
+ * @since_tizen 4.0
+ * @description Callback on CBHM Item Changed
+ * @parameter cbhm_handle: CBHM Handle, int: Item Count, void*: Void Pointer
+ * @return static void
+ */
+static void on_cbhm_item_changed(cbhm_h cbhm_handle, int item_count, void *data)
+{
+ cbhm_view *this = (cbhm_view*) data;
+ RETM_IF(NULL == this, "cbhm_view is null");
+ char msg[100];
+ snprintf(msg, sizeof(msg), "CBHM Item Changed Callback Hit with item number %d", item_count);
+ ui_utils_label_set_text(this->lon_label, msg,
+ "left");
+}
+
+
+/**
+ * @function on_cbhm_selection_get
+ * @since_tizen 4.0
+ * @description Callback on Selection Get
+ * @parameter cbhm_handle: CBHM Handle ,const char*: Buffer, size_t: len, void *: Data
+ * @return static int
+ */
+static int on_cbhm_selection_get(cbhm_h cbhm_handle, const char *buf, size_t len, void *data)
+{
+ cbhm_view *this = (cbhm_view*) data;
+ char msg[100];
+
+ snprintf(msg, sizeof(msg), "Data from Clipboard : %s", buf);
+ ui_utils_label_set_text(this->lat_label, msg,
+ "left");
+ return 0;
+}
+
+
+/**
+ * @function on_monitor_item_changed
+ * @since_tizen 4.0
+ * @description Callback on Monitor Item Changed
+ * @parameter cbhm_handle: CBHM Handle ,bool: active state, void*: Void Pointer
+ * @return static void
+ */
+static void on_monitor_item_changed(cbhm_h cbhm_handle, bool active_state, void *data)
+{
+ cbhm_view *this = (cbhm_view*) data;
+ RETM_IF(NULL == this, "cbhm_view is null");
+ char msg[100];
+ snprintf(msg, sizeof(msg), "CBHM Monitor Changed Callback Hit with active state %d", active_state);
+ ui_utils_label_set_text(this->lon_label, msg,
+ "left");
+return;
+}
+
+
+/**
+ * @function _selection_type_set_cb
+ * @since_tizen 4.0
+ * @description Selection Type Set Cb
+ * @parameter cbhm_sel_type_e: Type, void *: Data
+ * @return static void
+ */
+static void _selection_type_set_cb(cbhm_sel_type_e type, void *data)
+{
+ int nRet;
+ char *hello_str;
+ cbhm_view *this = (cbhm_view*) data;
+ hello_str = (char *) malloc(50);
+ snprintf(hello_str, 50, "String : %s", get_selection_type(type));
+
+ nRet = cbhm_selection_type_set(this->cbhm_handle, type);
+ RETM_IF(nRet != CBHM_ERROR_NONE, "cbhm_selection_type_set failed");
+
+ nRet = cbhm_selection_set(this->cbhm_handle, type, hello_str, strlen(hello_str));
+ RETM_IF(nRet != CBHM_ERROR_NONE, "cbhm_selection_set failed");
+}
+
+
+
+/**
+ * @function _selection_type_show
+ * @since_tizen 4.0
+ * @description Show the selection type
+ * @parameter void* : Data, Evas_Object*: Evas Object Pointer, void* : Event Information
+ * @return static void
+ */
+static void _selection_type_show(void *data, Evas_Object *obj, void *event_info)
+{
+ cbhm_view *this = (cbhm_view*) data;
+ int nRet;
+ cbhm_sel_type_e sType;
+
+ nRet = cbhm_latest_item_type_get(this->cbhm_handle, &sType);
+ RETM_IF(nRet != CBHM_ERROR_NONE, "cbhm_latest_item_type_get failed");
+
+ switch(sType)
+ {
+ case CBHM_SEL_TYPE_MARKUP :
+ ui_utils_label_set_text(this->lat_label, "Selection Type is Markup", "left");
+ break;
+ case CBHM_SEL_TYPE_TEXT :
+ ui_utils_label_set_text(this->lat_label, "Selection Type is Text", "left");
+ break;
+ case CBHM_SEL_TYPE_HTML :
+ ui_utils_label_set_text(this->lat_label, "Selection Type is HTML", "left");
+ break;
+ default :
+ ui_utils_label_set_text(this->lat_label, "Unknown Type", "left");
+ }
+}
+
+
+
+/**
+ * @function cbhm_view_add
* @since_tizen 4.0
- * @description CBHM Callbacks View Add
+ * @description CBHM View Add
* @parameter Evas_Object*: Evas Object Pointer, tbt_info*: Tbt Info Pointer, Elm_Object_Item*: Elm Object Item Pointer
- * @return cbhm_callbacks_view*
+ * @return cbhm_view*
*/
-cbhm_callbacks_view *cbhm_view_add(Evas_Object *navi, tbt_info *tbt_info, Elm_Object_Item *item)
+cbhm_view *cbhm_view_add(Evas_Object *navi, tbt_info *tbt_info, Elm_Object_Item *item)
{
RETVM_IF(NULL == navi, NULL, "navi is null");
int nRet;
char msg[100];
- cbhm_callbacks_view *this = NULL;
+ cbhm_view *this = NULL;
- this = calloc(1, sizeof(cbhm_callbacks_view));
+ this = calloc(1, sizeof(cbhm_view));
RETVM_IF(!this, NULL, "calloc failed");
this->view = calloc(1, sizeof(common_view));
RETVM_IF(!this->view, NULL, "calloc failed");
tbt_info->layout_group = "cbhm_test";
- tbt_info->layout_file = get_edje_path("cbhm_callback_viewer.edj");
+ tbt_info->layout_file = get_edje_path("cbhm_viewer.edj");
common_view_add(navi, tbt_info, item, this->view, _app_destroy_cb, this);
elm_label_line_wrap_set(this->lat_label, ELM_WRAP_CHAR);
elm_label_line_wrap_set(this->lat_label, ELM_WRAP_CHAR);
- ui_utils_label_set_text(this->lat_label, "???", "left");
- ui_utils_label_set_text(this->lon_label, "???", "left");
+ ui_utils_label_set_text(this->lat_label, "", "left");
+ ui_utils_label_set_text(this->lon_label, "", "left");
elm_object_part_content_set(this->view->layout, "_title",
this->lat_label);
elm_object_part_content_set(this->view->layout, "controlr_part",
table);
- if(this->apptype == TBT_APP_CBHM_CHANGE_CALLBACK)
+
+ if(this->apptype == TBT_APP_CBHM_CHANGE_CALLBACK || this->apptype == TBT_APP_CBHM_COUNT_GET || this->apptype == TBT_APP_CBHM_SELECTION_GET)
{
//Create an editfield
this->editfield = ui_utils_entry_add(this, this->view->layout, ELM_INPUT_PANEL_LAYOUT_NORMAL, "Trial Text");
}
-/**
- * @function add_control_layout
- * @since_tizen 4.0
- * @description Add Control Layout
- * @parameter cbhm_callbacks_view*: CBHM Callbacks View Pointer, Evas_Object*: Evas Object Pointer
- * @return static Evas_Object*
- */
-static Evas_Object *add_control_layout(cbhm_callbacks_view *this, Evas_Object *parent)
-{
- RETVM_IF(NULL == this, NULL, "view is NULL");
-
- Evas_Object *table = elm_table_add(parent);
-
- evas_object_size_hint_weight_set(table, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(table, EVAS_HINT_FILL, EVAS_HINT_FILL);
- evas_object_show(table);
-
- elm_table_padding_set(table, TABLE_PADDING_HORIZONTAL,
- TABLE_PADDING_VERTICAL);
- if(this->apptype == TBT_APP_CBHM_CHANGE_CALLBACK )
- {
- this->button1 = ui_utils_push_button_add(this, table, "Add Callback",
- _add_cb_button_pressed_cb);
- this->button2 = ui_utils_push_button_add(this, table, "Remove Callback",
- _rem_cb_button_pressed_cb);
- this->button3= ui_utils_push_button_add(this, table, "Clear Label",
- _clear_label_button_pressed_cb);
- this->button4= ui_utils_push_button_add(this, table, "Show ClipBoard",
- _show_clipboard_button_pressed_cb);
- }
- else if(this->apptype == TBT_APP_CBHM_MONITOR_CALLBACK)
- {
- this->button1= ui_utils_push_button_add(this, table, "Add Monitor CB",
- _add_monitor_callback_button_pressed_cb);
- this->button2 = ui_utils_push_button_add(this, table, "Remove Monitor CB",
- _remove_monitor_callback_button_pressed_cb);
- this->button3= ui_utils_push_button_add(this, table, "Clear Label",
- _clear_label_button_pressed_cb);
- this->button4 = ui_utils_push_button_add(this, table, "Show Clipboard",
- _show_clipboard_button_pressed_cb);
- }
- else
- {
- this->button1 = ui_utils_push_button_add(this, table, "Copy Text",
- _text_type_button_pressed_cb);
- this->button2 = ui_utils_push_button_add(this, table, "Copy Markup",
- _markup_type_button_pressed_cb);
- this->button3 = ui_utils_push_button_add(this, table, "Copy HTML",
- _html_type_button_pressed_cb);
- this->button4 = ui_utils_push_button_add(this, table, "Display Type",
- _selection_type_show);
- }
- elm_table_pack(table, this->button1, 0, 0, 1, 1);
- elm_table_pack(table, this->button2, 1, 0, 2, 1);
- elm_table_pack(table, this->button3, 0, 1, 1, 2);
- elm_table_pack(table, this->button4, 1, 1, 2, 2);
- return table;
-}
/**
* @function _add_cb_button_pressed_cb
*/
static void _add_cb_button_pressed_cb(void *data, Evas_Object *obj, void *event_info)
{
- cbhm_callbacks_view *this = (cbhm_callbacks_view*) data;
- RETM_IF(NULL == this, "cbhm_callbacks_view is null");
+ cbhm_view *this = (cbhm_view*) data;
+ RETM_IF(NULL == this, "cbhm_view is null");
int nRet = 0;
}
/**
- * @function _rem_cb_button_pressed_cb
+ * @function _add_monitor_callback_button_pressed_cb
* @since_tizen 4.0
- * @description Remove Callback Button Pressed Cb
+ * @description Add Monitor Callback Button Pressed Cb
* @parameter void*: Void Pointer, Evas_Object*: Evas Object Pointer, void*: Void Pointer
* @return static void
*/
-static void _rem_cb_button_pressed_cb(void *data, Evas_Object *obj, void *event_info)
+static void _add_monitor_callback_button_pressed_cb(void *data, Evas_Object *obj, void *event_info)
{
- cbhm_callbacks_view *this = (cbhm_callbacks_view*) data;
- int nRet = 0;
- RETM_IF(NULL == this, "cbhm_callbacks_view is null");
-
- if(this->callbackAdded == true)
+ cbhm_view *this = (cbhm_view*) data;
+ if(this->monitorAdded == false)
{
- nRet = cbhm_item_changed_callback_remove(this->cbhm_handle, on_cbhm_item_changed, data);
- RETM_IF(nRet != CBHM_ERROR_NONE, "cbhm_item_changed_callback_remove failed");
- this->callbackAdded = false;
+ int nRet = cbhm_monitor_callback_add(this->cbhm_handle, on_monitor_item_changed, data);
+ RETM_IF(nRet != CBHM_ERROR_NONE, "cbhm_monitor_callback_add failed");
+ ui_utils_label_set_text(this->lat_label, "Add Monitor Callback", "left");
+ this->monitorAdded = true;
}
+}
- update(this);
+
+/**
+ * @function on_cbhm_item_changed
+ * @since_tizen 4.0
+ * @description Callback on CBHM Item Changed
+ * @parameter cbhm_handle: CBHM Handle, int: Item Count, void*: Void Pointer
+ * @return static void
+ */
+static void _cbhm_count_get_button_pressed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ cbhm_view *this = (cbhm_view*) data;
+ char msg[100];
+ int item_count = cbhm_item_count_get(this->cbhm_handle);
+ snprintf(msg, sizeof(msg), "CBHM Item Count is : %d", item_count);
+ ui_utils_label_set_text(this->lat_label, msg,
+ "left");
+}
+
+
+/**
+ * @function _cbhm_selection_get_button_pressed_cb
+ * @since_tizen 4.0
+ * @description Selection Text Get Button Pressed Cb
+ * @parameter void*: Void Pointer, Evas_Object*: Evas Object Pointer, void*: Void Pointer
+ * @return static void
+ */
+static void _cbhm_selection_get_button_pressed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ cbhm_view *this = (cbhm_view*) data;
+ int nRet;
+ cbhm_sel_type_e eType = CBHM_SEL_TYPE_TEXT;
+ nRet = cbhm_selection_get(this->cbhm_handle, eType, on_cbhm_selection_get, data);
+ RETM_IF(nRet != CBHM_ERROR_NONE, "cbhm_selection_get failed");
}
+
+
/**
* @function _clear_label_button_pressed_cb
* @since_tizen 4.0
*/
static void _clear_label_button_pressed_cb(void *data, Evas_Object *obj, void *event_info)
{
- cbhm_callbacks_view *this = (cbhm_callbacks_view*) data;
- RETM_IF(NULL == this, "cbhm_callbacks_view is null");
+ cbhm_view *this = (cbhm_view*) data;
+ RETM_IF(NULL == this, "cbhm_view is null");
ui_utils_label_set_text(this->lat_label, "Cleared Label", "left");
- ui_utils_label_set_text(this->lon_label, "Waiting for Event", "left");
+ if(this->apptype == TBT_APP_CBHM_CHANGE_CALLBACK || this->apptype == TBT_APP_CBHM_MONITOR_CALLBACK)
+ ui_utils_label_set_text(this->lon_label, "Cleared Label", "left");
}
+/**
+ * @function _hide_clipboard_button_pressed_cb
+ * @since_tizen 4.0
+ * @description Hide Clipboard Button Pressed Cb
+ * @parameter void*: Void Pointer, Evas_Object*: Evas Object Pointer, void*: Void Pointer
+ * @return static void
+ */
+static void _hide_clipboard_button_pressed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ cbhm_view *this = (cbhm_view*) data;
+ RETM_IF(NULL == this, "cbhm_view is null");
+ int nRet = cbhm_hide(this->cbhm_handle);
+ RETM_IF(nRet != CBHM_ERROR_NONE, "cbhm_hide failed");
+
+}
/**
- * @function _show_clipboard_button_pressed_cb
+ * @function _html_type_button_pressed_cb
* @since_tizen 4.0
- * @description Show Clipboard Button Pressed Cb
+ * @description HTML type Button Pressed Cb
* @parameter void*: Void Pointer, Evas_Object*: Evas Object Pointer, void*: Void Pointer
* @return static void
*/
-static void _show_clipboard_button_pressed_cb(void *data, Evas_Object *obj, void *event_info)
+static void _html_type_button_pressed_cb(void *data, Evas_Object *obj, void *event_info)
{
- cbhm_callbacks_view *this = (cbhm_callbacks_view*) data;
- RETM_IF(NULL == this, "cbhm_callbacks_view is null");
- int nRet = cbhm_show(this->cbhm_handle);
- RETM_IF(nRet != CBHM_ERROR_NONE, "cbhm_show failed");
- ui_utils_label_set_text(this->lat_label, "Show Clipboard", "left");
+ _selection_type_set_cb(CBHM_SEL_TYPE_HTML, data);
}
/**
- * @function _add_monitor_callback_button_pressed_cb
+ * @function _markup_type_button_pressed_cb
* @since_tizen 4.0
- * @description Add Monitor Callback Button Pressed Cb
+ * @description Markup Type BUtton Pressed Cb
* @parameter void*: Void Pointer, Evas_Object*: Evas Object Pointer, void*: Void Pointer
* @return static void
*/
-static void _add_monitor_callback_button_pressed_cb(void *data, Evas_Object *obj, void *event_info)
+
+static void _markup_type_button_pressed_cb(void *data, Evas_Object *obj, void *event_info)
{
- cbhm_callbacks_view *this = (cbhm_callbacks_view*) data;
- if(this->monitorAdded == false)
+ _selection_type_set_cb(CBHM_SEL_TYPE_MARKUP, data);
+}
+
+
+/**
+ * @function _rem_cb_button_pressed_cb
+ * @since_tizen 4.0
+ * @description Remove Callback Button Pressed Cb
+ * @parameter void*: Void Pointer, Evas_Object*: Evas Object Pointer, void*: Void Pointer
+ * @return static void
+ */
+static void _rem_cb_button_pressed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ cbhm_view *this = (cbhm_view*) data;
+ int nRet = 0;
+ RETM_IF(NULL == this, "cbhm_view is null");
+
+ if(this->callbackAdded == true)
{
- int nRet = cbhm_monitor_callback_add(this->cbhm_handle, on_monitor_item_changed, data);
- RETM_IF(nRet != CBHM_ERROR_NONE, "cbhm_monitor_callback_add failed");
- ui_utils_label_set_text(this->lat_label, "Add Monitor Callback", "left");
- this->monitorAdded = true;
+ nRet = cbhm_item_changed_callback_remove(this->cbhm_handle, on_cbhm_item_changed, data);
+ RETM_IF(nRet != CBHM_ERROR_NONE, "cbhm_item_changed_callback_remove failed");
+ this->callbackAdded = false;
}
+
+ update(this);
}
*/
static void _remove_monitor_callback_button_pressed_cb(void *data, Evas_Object *obj, void *event_info)
{
- cbhm_callbacks_view *this = (cbhm_callbacks_view*) data;
+ cbhm_view *this = (cbhm_view*) data;
if(this->monitorAdded == true)
{
int nRet = cbhm_monitor_callback_remove(this->cbhm_handle, on_monitor_item_changed, data);
}
}
+
/**
- * @function _text_type_button_pressed_cb
+ * @function _show_clipboard_button_pressed_cb
* @since_tizen 4.0
- * @description Text Type Button Pressed Cb
+ * @description Show Clipboard Button Pressed Cb
* @parameter void*: Void Pointer, Evas_Object*: Evas Object Pointer, void*: Void Pointer
* @return static void
*/
-static void _text_type_button_pressed_cb(void *data, Evas_Object *obj, void *event_info)
+static void _show_clipboard_button_pressed_cb(void *data, Evas_Object *obj, void *event_info)
{
- _selection_type_set_cb(CBHM_SEL_TYPE_TEXT, data);
+ cbhm_view *this = (cbhm_view*) data;
+ RETM_IF(NULL == this, "cbhm_view is null");
+
+ int nRet = cbhm_show(this->cbhm_handle);
+ RETM_IF(nRet != CBHM_ERROR_NONE, "cbhm_show failed");
+
}
/**
- * @function _markup_type_button_pressed_cb
+ * @function _show_clipboard_button_pressed_cb
* @since_tizen 4.0
- * @description Markup Type BUtton Pressed Cb
+ * @description Show Clipboard Button Pressed Cb
* @parameter void*: Void Pointer, Evas_Object*: Evas Object Pointer, void*: Void Pointer
* @return static void
*/
-
-static void _markup_type_button_pressed_cb(void *data, Evas_Object *obj, void *event_info)
+static void _show_cbhm_state_button_pressed_cb(void *data, Evas_Object *obj, void *event_info)
{
- _selection_type_set_cb(CBHM_SEL_TYPE_MARKUP, data);
+ cbhm_view *this = (cbhm_view*) data;
+ cbhm_state_type_e sType;
+ RETM_IF(NULL == this, "cbhm_view is null");
+ int nRet = cbhm_state_get(this->cbhm_handle, &sType);
+ RETM_IF(nRet != CBHM_ERROR_NONE, "cbhm_state_get failed");
+
+ switch(sType)
+ {
+ case CBHM_STATE_NONE :
+ ui_utils_label_set_text(this->lat_label, "Clip Board State is : None", "left");
+ break;
+ case CBHM_STATE_SHOW :
+ ui_utils_label_set_text(this->lat_label, "Clip Board State is : Show", "left");
+ break;
+ case CBHM_STATE_HIDE :
+ ui_utils_label_set_text(this->lat_label, "Clip Board State is : Hide", "left");
+ break;
+ default :
+ ui_utils_label_set_text(this->lat_label, "Unknown State", "left");
+ }
}
/**
- * @function _html_type_button_pressed_cb
+ * @function _text_type_button_pressed_cb
* @since_tizen 4.0
- * @description HTML type Button Pressed Cb
+ * @description Text Type Button Pressed Cb
* @parameter void*: Void Pointer, Evas_Object*: Evas Object Pointer, void*: Void Pointer
* @return static void
*/
-static void _html_type_button_pressed_cb(void *data, Evas_Object *obj, void *event_info)
+static void _text_type_button_pressed_cb(void *data, Evas_Object *obj, void *event_info)
{
- _selection_type_set_cb(CBHM_SEL_TYPE_HTML, data);
+ _selection_type_set_cb(CBHM_SEL_TYPE_TEXT, data);
}
/**
- * @function _selection_type_set_cb
+ * @function add_control_layout
* @since_tizen 4.0
- * @description Selection Type Set Cb
- * @parameter cbhm_sel_type_e: Type, void *: Data
- * @return static void
+ * @description Add Control Layout
+ * @parameter cbhm_view*: CBHM Callbacks View Pointer, Evas_Object*: Evas Object Pointer
+ * @return static Evas_Object*
*/
-static void _selection_type_set_cb(cbhm_sel_type_e type, void *data)
+static Evas_Object *add_control_layout(cbhm_view *this, Evas_Object *parent)
{
- int nRet;
- char *hello_str;
- cbhm_callbacks_view *this = (cbhm_callbacks_view*) data;
- hello_str = (char *) malloc(50);
- snprintf(hello_str, 50, "String : %s", get_selection_type(type));
-
- nRet = cbhm_selection_type_set(this->cbhm_handle, type);
- RETM_IF(nRet != CBHM_ERROR_NONE, "cbhm_selection_type_set failed");
-
- nRet = cbhm_selection_set(this->cbhm_handle, type, hello_str, strlen(hello_str));
- RETM_IF(nRet != CBHM_ERROR_NONE, "cbhm_selection_set failed");
-}
+ RETVM_IF(NULL == this, NULL, "view is NULL");
+ Evas_Object *table = elm_table_add(parent);
-/**
- * @function _selection_type_show
- * @since_tizen 4.0
- * @description Show the selection type
- * @parameter void* : Data, Evas_Object*: Evas Object Pointer, void* : Event Information
- * @return static void
- */
-static void _selection_type_show(void *data, Evas_Object *obj, void *event_info)
-{
- cbhm_callbacks_view *this = (cbhm_callbacks_view*) data;
- int nRet;
- cbhm_sel_type_e sType;
+ evas_object_size_hint_weight_set(table, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(table, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(table);
- nRet = cbhm_latest_item_type_get(this->cbhm_handle, &sType);
- RETM_IF(nRet != CBHM_ERROR_NONE, "cbhm_latest_item_type_get failed");
+ elm_table_padding_set(table, TABLE_PADDING_HORIZONTAL,
+ TABLE_PADDING_VERTICAL);
+ int button_table = 1;
- switch(sType)
+ switch(this->apptype)
{
- case CBHM_SEL_TYPE_MARKUP :
- ui_utils_label_set_text(this->lat_label, "Selection Type is Markup", "left");
+ case TBT_APP_CBHM_CHANGE_CALLBACK :
+ this->button1 = ui_utils_push_button_add(this, table, "Add Callback",
+ _add_cb_button_pressed_cb);
+ this->button2 = ui_utils_push_button_add(this, table, "Remove Callback",
+ _rem_cb_button_pressed_cb);
+ this->button3= ui_utils_push_button_add(this, table, "Clear Label",
+ _clear_label_button_pressed_cb);
+ this->button4= ui_utils_push_button_add(this, table, "Show ClipBoard",
+ _show_clipboard_button_pressed_cb);
break;
- case CBHM_SEL_TYPE_TEXT :
- ui_utils_label_set_text(this->lat_label, "Selection Type is Text", "left");
+ case TBT_APP_CBHM_MONITOR_CALLBACK :
+
+ this->button1= ui_utils_push_button_add(this, table, "Add Monitor CB",
+ _add_monitor_callback_button_pressed_cb);
+ this->button2 = ui_utils_push_button_add(this, table, "Remove Monitor CB",
+ _remove_monitor_callback_button_pressed_cb);
+ this->button3= ui_utils_push_button_add(this, table, "Clear Label",
+ _clear_label_button_pressed_cb);
+ this->button4 = ui_utils_push_button_add(this, table, "Show Clipboard",
+ _show_clipboard_button_pressed_cb);
break;
- case CBHM_SEL_TYPE_HTML :
- ui_utils_label_set_text(this->lat_label, "Selection Type is HTML", "left");
+ case TBT_APP_CBHM_TYPE_GET :
+ this->button1 = ui_utils_push_button_add(this, table, "Copy Text",
+ _text_type_button_pressed_cb);
+ this->button2 = ui_utils_push_button_add(this, table, "Copy Markup",
+ _markup_type_button_pressed_cb);
+ this->button3 = ui_utils_push_button_add(this, table, "Copy HTML",
+ _html_type_button_pressed_cb);
+ this->button4 = ui_utils_push_button_add(this, table, "Display Type",
+ _selection_type_show);
+ break;
+ case TBT_APP_CBHM_SELECTION_GET :
+ this->button1 = ui_utils_push_button_add(this, table, "Show ClipBoard",
+ _show_clipboard_button_pressed_cb);
+ this->button2 = ui_utils_push_button_add(this, table, "Clear Label",
+ _clear_label_button_pressed_cb);
+ this->button3 = ui_utils_push_button_add(this, table, "Get Selection",
+ _cbhm_selection_get_button_pressed_cb);
+ button_table = 0;
+ break;
+ case TBT_APP_CBHM_COUNT_GET :
+ this->button1 = ui_utils_push_button_add(this, table, "Show ClipBoard",
+ _show_clipboard_button_pressed_cb);
+ this->button2 = ui_utils_push_button_add(this, table, "Clear Label",
+ _clear_label_button_pressed_cb);
+ this->button3 = ui_utils_push_button_add(this, table, "Show Count",
+ _cbhm_count_get_button_pressed_cb);
+ button_table = 0;
+ break;
+ case TBT_APP_CBHM_STATE_GET :
+ this->button1 = ui_utils_push_button_add(this, table, "Show State",
+ _show_cbhm_state_button_pressed_cb);
+ this->button2 = ui_utils_push_button_add(this, table, "Show ClipBoard",
+ _show_clipboard_button_pressed_cb);
+ this->button3 = ui_utils_push_button_add(this, table, "Clear Label",
+ _clear_label_button_pressed_cb);
+ this->button4 = ui_utils_push_button_add(this, table, "Hide Clipboard",
+ _hide_clipboard_button_pressed_cb);
break;
default :
- ui_utils_label_set_text(this->lat_label, "Unknown Type", "left");
+ break;
+ }
+
+ if(button_table == 1)
+ {
+ elm_table_pack(table, this->button1, 0, 0, 1, 1);
+ elm_table_pack(table, this->button2, 1, 0, 2, 1);
+ elm_table_pack(table, this->button3, 0, 1, 1, 2);
+ elm_table_pack(table, this->button4, 1, 1, 2, 2);
}
+ else
+ {
+ elm_table_pack(table, this->button1, 0, 0, 1, 1);
+ elm_table_pack(table, this->button2, 1, 0, 2, 1);
+ elm_table_pack(table, this->button3, 0, 1, 2, 2);
+ }
+ return table;
}
* @function update
* @since_tizen 4.0
* @description Update
- * @parameter cbhm_callbacks_view*: CBHM Callbacks View Pointer
+ * @parameter cbhm_view*: CBHM Callbacks View Pointer
* @return static void
*/
-static void update(cbhm_callbacks_view *this)
+static void update(cbhm_view *this)
{
- RETM_IF(NULL == this, "cbhm_callbacks_view is null");
+ RETM_IF(NULL == this, "cbhm_view is null");
- if (this->callbackAdded)
+ if(this->apptype == TBT_APP_CBHM_CHANGE_CALLBACK || this->apptype == TBT_APP_CBHM_MONITOR_CALLBACK)
{
- ui_utils_label_set_text(this->lat_label, "Callback added", "left");
- ui_utils_label_set_text(this->lon_label, "Waiting for callback...",
- "left");
+ if (this->callbackAdded)
+ {
+ ui_utils_label_set_text(this->lat_label, "Callback added", "left");
+ ui_utils_label_set_text(this->lon_label, "Waiting for callback...",
+ "left");
+ }
+ else
+ {
+ ui_utils_label_set_text(this->lat_label, "No Callback Added", "left");
+ ui_utils_label_set_text(this->lon_label, "Waiting for callback...",
+ "left");
+ }
}
else
{
- ui_utils_label_set_text(this->lat_label, "No Callback Added", "left");
- ui_utils_label_set_text(this->lon_label, "Waiting for callback...",
- "left");
+ ui_utils_label_set_text(this->lat_label, "Label", "left");
}
}
-/**
- * @function on_cbhm_item_changed
- * @since_tizen 4.0
- * @description Callback on CBHM Item Changed
- * @parameter cbhm_handle: CBHM Handle, int: Item Count, void*: Void Pointer
- * @return static void
- */
-static void on_cbhm_item_changed(cbhm_h cbhm_handle, int item_count, void *data)
-{
- cbhm_callbacks_view *this = (cbhm_callbacks_view*) data;
- RETM_IF(NULL == this, "cbhm_callbacks_view is null");
- char msg[100];
- snprintf(msg, sizeof(msg), "CBHM Item Changed Callback Hit with item number %d", item_count);
- ui_utils_label_set_text(this->lon_label, msg,
- "left");
-}
-
-
-/**
- * @function on_monitor_item_changed
- * @since_tizen 4.0
- * @description Callback on Monitor Item Changed
- * @parameter cbhm_handle: CBHM Handle ,bool: active state, void*: Void Pointer
- * @return static void
- */
-static void on_monitor_item_changed(cbhm_h cbhm_handle, bool active_state, void *data)
-{
- cbhm_callbacks_view *this = (cbhm_callbacks_view*) data;
- RETM_IF(NULL == this, "cbhm_callbacks_view is null");
- char msg[100];
- snprintf(msg, sizeof(msg), "CBHM Monitor Changed Callback Hit with active state %d", active_state);
- ui_utils_label_set_text(this->lon_label, msg,
- "left");
-return;
-}
-
-
/**
* @function _app_destroy_cb
* @since_tizen 4.0
{
RETM_IF(NULL == this, "data is NULL");
- cbhm_callbacks_view *view = NULL;
- view = (cbhm_callbacks_view*) this;
+ cbhm_view *view = NULL;
+ view = (cbhm_view*) this;
RETM_IF(NULL == view, "view is NULL");
__is_cbhm_test_running = false;
SAFE_DELETE(view->view);
SAFE_DELETE(view);
}
-
-
#endif