2 # include "elementary_config.h"
4 #include <Elementary.h>
5 #ifndef ELM_LIB_QUICKLAUNCH
7 static Evas_Object *glb;
10 _bt_copy_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
12 Evas_Object *en = (Evas_Object*)(data);
13 const char *txt = elm_object_text_get(en);
15 elm_object_text_set(glb, txt);
16 elm_cnp_selection_set(elm_object_parent_widget_get(en), ELM_SEL_TYPE_CLIPBOARD,
17 ELM_SEL_FORMAT_TEXT, txt, strlen(txt));
21 _bt_paste_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
23 Evas_Object *en = (Evas_Object*)(data);
25 elm_cnp_selection_get(en, ELM_SEL_TYPE_CLIPBOARD, ELM_SEL_FORMAT_TEXT,
30 _bt_clear_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
32 Evas_Object *en = (Evas_Object*)(data);
34 elm_object_text_set(glb, "");
35 elm_object_cnp_selection_clear(elm_object_parent_widget_get(en), ELM_SEL_TYPE_CLIPBOARD);
39 test_cnp(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
41 Evas_Object *win, *bg, *gd, *bt, *en, *lb;
43 win = elm_win_add(NULL, "CopyPaste", ELM_WIN_BASIC);
44 elm_win_title_set(win, "CopyPaste");
45 elm_win_autodel_set(win, EINA_TRUE);
48 elm_win_resize_object_add(win, bg);
49 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
52 gd = elm_grid_add(win);
53 elm_grid_size_set(gd, 100, 100);
54 elm_win_resize_object_add(win, gd);
55 evas_object_size_hint_weight_set(gd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
58 en = elm_entry_add(win);
59 elm_entry_scrollable_set(en, EINA_TRUE);
60 elm_entry_line_wrap_set(en, ELM_WRAP_CHAR);
61 evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
62 evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL);
63 elm_object_text_set(en, "Elementary provides ");
64 elm_grid_pack(gd, en, 10, 10, 60, 30);
67 bt = elm_button_add(win);
68 elm_object_text_set(bt, "Copy from left entry");
69 evas_object_smart_callback_add(bt, "clicked", _bt_copy_clicked, en);
70 elm_grid_pack(gd, bt, 70, 10, 22, 30);
73 bt = elm_button_add(win);
74 elm_object_text_set(bt, "Clear clipboard");
75 evas_object_smart_callback_add(bt, "clicked", _bt_clear_clicked, en);
76 elm_grid_pack(gd, bt, 70, 70, 22, 20);
79 en = elm_entry_add(win);
80 elm_entry_scrollable_set(en, EINA_TRUE);
81 elm_entry_line_wrap_set(en, ELM_WRAP_CHAR);
82 evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
83 evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL);
84 elm_object_text_set(en, "rich copying and pasting functionality,");
85 elm_grid_pack(gd, en, 10, 40, 60, 30);
88 bt = elm_button_add(win);
89 elm_object_text_set(bt, "Paste to left entry");
90 evas_object_smart_callback_add(bt, "clicked", _bt_paste_clicked, en);
91 elm_grid_pack(gd, bt, 70, 40, 22, 30);
94 lb = elm_label_add(win);
95 elm_object_text_set(lb, "<b>Clipboard:</b>");
96 evas_object_size_hint_weight_set(lb, 0.0, 0.0);
97 evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, EVAS_HINT_FILL);
98 elm_grid_pack(gd, lb, 10, 70, 60, 10);
101 glb = elm_label_add(win);
102 elm_object_text_set(glb, "");
103 evas_object_size_hint_weight_set(glb, 0.0, 0.0);
104 evas_object_size_hint_align_set(glb, EVAS_HINT_FILL, EVAS_HINT_FILL);
105 elm_grid_pack(gd, glb, 10, 80, 60, 10);
106 evas_object_show(glb);
108 evas_object_resize(win, 480, 200);
109 evas_object_show(win);