Merge remote-tracking branch 'remotes/origin/upstream'
[framework/uifw/elementary.git] / src / bin / test_cnp.c
1 #include <Elementary.h>
2 #ifdef HAVE_CONFIG_H
3 # include "elementary_config.h"
4 #endif
5 #ifndef ELM_LIB_QUICKLAUNCH
6 <<<<<<< HEAD
7 =======
8
9 static Evas_Object *glb;
10
11 >>>>>>> remotes/origin/upstream
12 static void
13 _bt_copy_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
14 {
15    Evas_Object *en = (Evas_Object*)(data);
16    const char *txt = elm_object_text_get(en);
17
18 <<<<<<< HEAD
19    elm_cnp_selection_set(ELM_SEL_TYPE_CLIPBOARD, elm_object_parent_widget_get(en),
20 =======
21    elm_object_text_set(glb, txt);
22    elm_cnp_selection_set(elm_object_parent_widget_get(en), ELM_SEL_TYPE_CLIPBOARD,
23 >>>>>>> remotes/origin/upstream
24                          ELM_SEL_FORMAT_TEXT, txt, strlen(txt));
25 }
26
27 static void
28 _bt_paste_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
29 {
30    Evas_Object *en = (Evas_Object*)(data);
31
32 <<<<<<< HEAD
33    elm_cnp_selection_get(ELM_SEL_TYPE_CLIPBOARD, ELM_SEL_FORMAT_TEXT,
34                          en, NULL, NULL);
35 =======
36    elm_cnp_selection_get(en, ELM_SEL_TYPE_CLIPBOARD, ELM_SEL_FORMAT_TEXT,
37                          NULL, NULL);
38 }
39
40 static void
41 _bt_clear_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
42 {
43    Evas_Object *en = (Evas_Object*)(data);
44
45    elm_object_text_set(glb, "");
46    elm_object_cnp_selection_clear(elm_object_parent_widget_get(en), ELM_SEL_TYPE_CLIPBOARD);
47 >>>>>>> remotes/origin/upstream
48 }
49
50 void
51 test_cnp(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
52 {
53 <<<<<<< HEAD
54    Evas_Object *win, *bg, *gd, *bt, *en;
55 =======
56    Evas_Object *win, *bg, *gd, *bt, *en, *lb;
57 >>>>>>> remotes/origin/upstream
58
59    win = elm_win_add(NULL, "CopyPaste", ELM_WIN_BASIC);
60    elm_win_title_set(win, "CopyPaste");
61    elm_win_autodel_set(win, EINA_TRUE);
62
63    bg = elm_bg_add(win);
64    elm_win_resize_object_add(win, bg);
65    evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
66    evas_object_show(bg);
67
68    gd = elm_grid_add(win);
69    elm_grid_size_set(gd, 100, 100);
70    elm_win_resize_object_add(win, gd);
71    evas_object_size_hint_weight_set(gd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
72    evas_object_show(gd);
73
74    en = elm_entry_add(win);
75    elm_entry_scrollable_set(en, EINA_TRUE);
76    elm_entry_line_wrap_set(en, ELM_WRAP_CHAR);
77    evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
78    evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL);
79 <<<<<<< HEAD
80    elm_object_text_set(en,
81                                 "Elementary provides "
82                                 );
83    elm_grid_pack(gd, en, 10, 10, 60, 40);
84 =======
85    elm_object_text_set(en, "Elementary provides ");
86    elm_grid_pack(gd, en, 10, 10, 60, 30);
87 >>>>>>> remotes/origin/upstream
88    evas_object_show(en);
89
90    bt = elm_button_add(win);
91    elm_object_text_set(bt, "Copy from left entry");
92    evas_object_smart_callback_add(bt, "clicked", _bt_copy_clicked, en);
93 <<<<<<< HEAD
94    elm_grid_pack(gd, bt, 70, 10, 22, 40);
95 =======
96    elm_grid_pack(gd, bt, 70, 10, 22, 30);
97    evas_object_show(bt);
98
99    bt = elm_button_add(win);
100    elm_object_text_set(bt, "Clear clipboard");
101    evas_object_smart_callback_add(bt, "clicked", _bt_clear_clicked, en);
102    elm_grid_pack(gd, bt, 70, 70, 22, 20);
103 >>>>>>> remotes/origin/upstream
104    evas_object_show(bt);
105
106    en = elm_entry_add(win);
107    elm_entry_scrollable_set(en, EINA_TRUE);
108    elm_entry_line_wrap_set(en, ELM_WRAP_CHAR);
109    evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
110    evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL);
111 <<<<<<< HEAD
112    elm_object_text_set(en,
113                                 "rich copying and pasting functionality,"
114                                 );
115    elm_grid_pack(gd, en, 10, 50, 60, 40);
116 =======
117    elm_object_text_set(en, "rich copying and pasting functionality,");
118    elm_grid_pack(gd, en, 10, 40, 60, 30);
119 >>>>>>> remotes/origin/upstream
120    evas_object_show(en);
121
122    bt = elm_button_add(win);
123    elm_object_text_set(bt, "Paste to left entry");
124    evas_object_smart_callback_add(bt, "clicked", _bt_paste_clicked, en);
125 <<<<<<< HEAD
126    elm_grid_pack(gd, bt, 70, 50, 22, 40);
127    evas_object_show(bt);
128
129    evas_object_resize(win, 480, 140);
130 =======
131    elm_grid_pack(gd, bt, 70, 40, 22, 30);
132    evas_object_show(bt);
133
134    lb = elm_label_add(win);
135    elm_object_text_set(lb, "<b>Clipboard:</b>");
136    evas_object_size_hint_weight_set(lb, 0.0, 0.0);
137    evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, EVAS_HINT_FILL);
138    elm_grid_pack(gd, lb, 10, 70, 60, 10);
139    evas_object_show(lb);
140
141    glb = elm_label_add(win);
142    elm_object_text_set(glb, "");
143    evas_object_size_hint_weight_set(glb, 0.0, 0.0);
144    evas_object_size_hint_align_set(glb, EVAS_HINT_FILL, EVAS_HINT_FILL);
145    elm_grid_pack(gd, glb, 10, 80, 60, 10);
146    evas_object_show(glb);
147
148    evas_object_resize(win, 480, 200);
149 >>>>>>> remotes/origin/upstream
150    evas_object_show(win);
151 }
152 #endif