forked from enlightenment/efl
From: cnook <kimcinoo@gmail.com>
Subject: [E-devel] [Patch][elementary_test] test_cnp The attachment is a patch to enhance the test_cnp in elementary_test. You can check how to use elm_cnp_selection_clear() through the patch. SVN revision: 68153
This commit is contained in:
parent
9beaca57f7
commit
655ada11d0
|
@ -3,12 +3,16 @@
|
||||||
# include "elementary_config.h"
|
# include "elementary_config.h"
|
||||||
#endif
|
#endif
|
||||||
#ifndef ELM_LIB_QUICKLAUNCH
|
#ifndef ELM_LIB_QUICKLAUNCH
|
||||||
|
|
||||||
|
static Evas_Object *glb;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_bt_copy_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
_bt_copy_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||||
{
|
{
|
||||||
Evas_Object *en = (Evas_Object*)(data);
|
Evas_Object *en = (Evas_Object*)(data);
|
||||||
const char *txt = elm_object_text_get(en);
|
const char *txt = elm_object_text_get(en);
|
||||||
|
|
||||||
|
elm_object_text_set(glb, txt);
|
||||||
elm_cnp_selection_set(ELM_SEL_TYPE_CLIPBOARD, elm_object_parent_widget_get(en),
|
elm_cnp_selection_set(ELM_SEL_TYPE_CLIPBOARD, elm_object_parent_widget_get(en),
|
||||||
ELM_SEL_FORMAT_TEXT, txt, strlen(txt));
|
ELM_SEL_FORMAT_TEXT, txt, strlen(txt));
|
||||||
}
|
}
|
||||||
|
@ -22,10 +26,19 @@ _bt_paste_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UN
|
||||||
en, NULL, NULL);
|
en, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_bt_clear_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||||
|
{
|
||||||
|
Evas_Object *en = (Evas_Object*)(data);
|
||||||
|
|
||||||
|
elm_object_text_set(glb, "");
|
||||||
|
elm_cnp_selection_clear(ELM_SEL_TYPE_CLIPBOARD, elm_object_parent_widget_get(en));
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
test_cnp(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
test_cnp(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||||
{
|
{
|
||||||
Evas_Object *win, *bg, *gd, *bt, *en;
|
Evas_Object *win, *bg, *gd, *bt, *en, *lb;
|
||||||
|
|
||||||
win = elm_win_add(NULL, "CopyPaste", ELM_WIN_BASIC);
|
win = elm_win_add(NULL, "CopyPaste", ELM_WIN_BASIC);
|
||||||
elm_win_title_set(win, "CopyPaste");
|
elm_win_title_set(win, "CopyPaste");
|
||||||
|
@ -50,13 +63,19 @@ test_cnp(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __
|
||||||
elm_object_text_set(en,
|
elm_object_text_set(en,
|
||||||
"Elementary provides "
|
"Elementary provides "
|
||||||
);
|
);
|
||||||
elm_grid_pack(gd, en, 10, 10, 60, 40);
|
elm_grid_pack(gd, en, 10, 10, 60, 30);
|
||||||
evas_object_show(en);
|
evas_object_show(en);
|
||||||
|
|
||||||
bt = elm_button_add(win);
|
bt = elm_button_add(win);
|
||||||
elm_object_text_set(bt, "Copy from left entry");
|
elm_object_text_set(bt, "Copy from left entry");
|
||||||
evas_object_smart_callback_add(bt, "clicked", _bt_copy_clicked, en);
|
evas_object_smart_callback_add(bt, "clicked", _bt_copy_clicked, en);
|
||||||
elm_grid_pack(gd, bt, 70, 10, 22, 40);
|
elm_grid_pack(gd, bt, 70, 10, 22, 30);
|
||||||
|
evas_object_show(bt);
|
||||||
|
|
||||||
|
bt = elm_button_add(win);
|
||||||
|
elm_object_text_set(bt, "Clear clipboard");
|
||||||
|
evas_object_smart_callback_add(bt, "clicked", _bt_clear_clicked, en);
|
||||||
|
elm_grid_pack(gd, bt, 70, 70, 22, 20);
|
||||||
evas_object_show(bt);
|
evas_object_show(bt);
|
||||||
|
|
||||||
en = elm_entry_add(win);
|
en = elm_entry_add(win);
|
||||||
|
@ -67,16 +86,30 @@ test_cnp(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __
|
||||||
elm_object_text_set(en,
|
elm_object_text_set(en,
|
||||||
"rich copying and pasting functionality,"
|
"rich copying and pasting functionality,"
|
||||||
);
|
);
|
||||||
elm_grid_pack(gd, en, 10, 50, 60, 40);
|
elm_grid_pack(gd, en, 10, 40, 60, 30);
|
||||||
evas_object_show(en);
|
evas_object_show(en);
|
||||||
|
|
||||||
bt = elm_button_add(win);
|
bt = elm_button_add(win);
|
||||||
elm_object_text_set(bt, "Paste to left entry");
|
elm_object_text_set(bt, "Paste to left entry");
|
||||||
evas_object_smart_callback_add(bt, "clicked", _bt_paste_clicked, en);
|
evas_object_smart_callback_add(bt, "clicked", _bt_paste_clicked, en);
|
||||||
elm_grid_pack(gd, bt, 70, 50, 22, 40);
|
elm_grid_pack(gd, bt, 70, 40, 22, 30);
|
||||||
evas_object_show(bt);
|
evas_object_show(bt);
|
||||||
|
|
||||||
evas_object_resize(win, 480, 140);
|
lb = elm_label_add(win);
|
||||||
|
elm_object_text_set(lb, "<b>Clipboard:</b>");
|
||||||
|
evas_object_size_hint_weight_set(lb, 0.0, 0.0);
|
||||||
|
evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
elm_grid_pack(gd, lb, 10, 70, 60, 10);
|
||||||
|
evas_object_show(lb);
|
||||||
|
|
||||||
|
glb = elm_label_add(win);
|
||||||
|
elm_object_text_set(glb, "");
|
||||||
|
evas_object_size_hint_weight_set(glb, 0.0, 0.0);
|
||||||
|
evas_object_size_hint_align_set(glb, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
elm_grid_pack(gd, glb, 10, 80, 60, 10);
|
||||||
|
evas_object_show(glb);
|
||||||
|
|
||||||
|
evas_object_resize(win, 480, 200);
|
||||||
evas_object_show(win);
|
evas_object_show(win);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue