4 #include "xcnphandler.h"
5 #include "clipdrawer.h"
7 #define IM "/mnt/ums/Images/Photo/"
8 static const char *images[] = {
19 _image_click(void *data, Evas_Object *obj, void *event_info)
21 struct appdata *ad = data;
24 file = evas_object_data_get(obj, "URI");
27 snprintf(p,len+10,"file:///%s",file);
29 elm_selection_set(/*secondary*/1,obj,/*ELM_SEL_FORMAT_IMAGE*/4,p);
31 clipdrawer_lower_view(ad);
34 static void _list_click( void *data, Evas_Object *obj, void *event_info )
36 struct appdata *ad = data;
37 Elm_List_Item *it = (Elm_List_Item *) elm_list_selected_item_get(obj);
41 elm_list_item_selected_set(it, 0);
47 cpdata = elm_list_item_label_get(it);
50 cplen = strlen(cpdata);
51 p = malloc(cplen + 1);
52 snprintf(p, cplen+1, "%s", cpdata);
53 elm_selection_set(1, obj, /*ELM_SEL_FORMAT_TEXT*/1, p);
54 // elm_selection_set(1, obj, /*ELM_SEL_FORMAT_MARKUP*/2, p);
56 clipdrawer_lower_view(ad);
59 int clipdrawer_update_contents(void *data)
61 struct appdata *ad = data;
64 elm_list_clear(ad->txtlist);
65 for (i = 0; i < HISTORY_QUEUE_NUMBER; i++)
67 pos = get_current_history_position()+i;
68 if (pos > HISTORY_QUEUE_NUMBER-1)
69 pos = pos-HISTORY_QUEUE_NUMBER;
70 if (get_item_contents_by_pos(pos) != NULL && strlen(get_item_contents_by_pos(pos)) > 0)
72 elm_list_item_append(ad->txtlist, get_item_contents_by_pos(pos), NULL, NULL, NULL, ad);
75 elm_list_go(ad->txtlist);
77 /* FIXME : sometimes when list update, screen isn't updated */
82 int clipdrawer_init(void *data)
84 struct appdata *ad = data;
86 evas_object_resize(ad->win_main, 480, 360);
87 evas_object_move(ad->win_main, 0, 440);
88 evas_object_resize(ad->ly_main, 480, 360);
89 evas_object_move(ad->ly_main, 0, 440);
91 ad->scrl = elm_scroller_add(ad->win_main);
92 edje_object_part_swallow(_EDJ(ad->ly_main), "cbhmdrawer/imglist", ad->scrl);
93 evas_object_size_hint_weight_set(ad->scrl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
94 elm_scroller_bounce_set(ad->scrl, EINA_TRUE, EINA_FALSE);
95 elm_scroller_policy_set(ad->scrl, ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_OFF);
96 elm_win_resize_object_add(ad->win_main, ad->scrl);
97 evas_object_show(ad->scrl);
99 evas_object_resize(ad->scrl,480,95);
101 ad->imgbox = elm_box_add(ad->win_main);
102 elm_box_horizontal_set(ad->imgbox, TRUE);
103 evas_object_size_hint_weight_set(ad->imgbox, EVAS_HINT_EXPAND, 0);
104 evas_object_size_hint_align_set(ad->imgbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
105 elm_scroller_content_set(ad->scrl, ad->imgbox);
106 evas_object_show(ad->imgbox);
110 for (i = 0 ; i < N_IMAGES ; i ++)
112 pt = elm_photo_add(ad->win_main);
113 elm_photo_file_set(pt, images[i]);
114 evas_object_size_hint_weight_set(pt, EVAS_HINT_EXPAND,
116 evas_object_size_hint_align_set(pt, EVAS_HINT_FILL,
118 elm_photo_size_set(pt, 125);
119 elm_box_pack_end(ad->imgbox, pt);
120 evas_object_show(pt);
121 evas_object_data_set(pt,"URI",images[i]);
123 evas_object_smart_callback_add(pt, "clicked", _image_click, ad);
126 ad->txtlist = elm_list_add(ad->win_main);
127 elm_layout_content_set(ad->ly_main, "cbhmdrawer/txtlist", ad->txtlist);
128 elm_list_horizontal_mode_set(ad->txtlist, ELM_LIST_COMPRESS);
129 evas_object_smart_callback_add(ad->txtlist, "selected", _list_click, ad);
130 elm_list_item_append(ad->txtlist, "default", NULL, NULL, NULL, ad);
132 elm_list_go(ad->txtlist);
134 if (get_item_counts() != 0)
135 clipdrawer_update_contents(ad);
140 int clipdrawer_create_view(void *data)
142 struct appdata *ad = data;
149 void clipdrawer_activate_view(void *data)
151 struct appdata *ad = data;
155 evas_object_show(ad->win_main);
156 elm_win_activate(ad->win_main);
160 void clipdrawer_lower_view(void *data)
162 struct appdata *ad = data;
166 evas_object_hide(ad->win_main);
167 elm_win_lower(ad->win_main);