2 #include "clipdrawer.h"
7 #define _EDJ(ly) elm_layout_edje_get(ly)
10 #define IM "/mnt/ums/Images/Wallpapers/"
11 static const char *images[] = {
12 IM"TFT_01_480x800.jpg",
13 IM"TFT_02_480x800.jpg",
14 IM"TFT_03_480x800.jpg",
15 IM"TFT_04_480x800.jpg",
16 IM"TFT_05_480x800.jpg",
17 IM"OCTA_01_480x800.jpg",
18 IM"OCTA_02_480x800.jpg",
19 IM"OCTA_03_480x800.jpg",
20 IM"OCTA_04_480x800.jpg",
21 IM"OCTA_05_480x800.jpg",
26 _image_click(void *data, Evas_Object *obj, void *event_info)
30 file = evas_object_data_get(data, "URI");
32 len = strlen(file) + strlen(dir);
34 snprintf(p,len+10,"file:///%s/%s",dir,file);
36 elm_selection_set(1,data,2,p);
39 static void _list_click( void *data, Evas_Object *obj, void *event_info )
41 Elm_List_Item *it = (Elm_List_Item *) elm_list_selected_item_get( obj );
45 elm_list_item_selected_set(it, 0);
51 cpdata = elm_list_item_label_get(it);
54 clen = strlen(cpdata);
56 snprintf(p, clen, "%s", cpdata);
57 elm_selection_set(1, obj, /*mark up*/1, p);
60 int clipdrawer_update_contents(void *data)
62 struct appdata *ad = data;
65 elm_list_clear(ad->txtlist);
66 for (i = 0; i < HISTORY_QUEUE_NUMBER; i++)
68 pos = get_current_history_position()+i;
69 if (pos > HISTORY_QUEUE_NUMBER-1)
70 pos = pos-HISTORY_QUEUE_NUMBER;
71 if (get_item_contents_by_pos(pos) != NULL)
72 elm_list_item_append(ad->txtlist, get_item_contents_by_pos(pos), NULL, NULL, NULL, ad);
74 elm_list_go(ad->txtlist);
76 /* FIXME : sometimes when list update, screen isn't updated */
81 static int clipdrawer_init(void *data)
83 struct appdata *ad = data;
85 evas_object_resize(ad->win_main, 480, 400);
86 evas_object_move(ad->win_main, 0, 400);
87 evas_object_resize(ad->ly_main, 480, 400);
88 evas_object_move(ad->ly_main, 0, 400);
90 ad->scrl = elm_scroller_add(ad->win_main);
91 edje_object_part_swallow(_EDJ(ad->ly_main), "cbhmdrawer/imglist", ad->scrl);
92 evas_object_size_hint_weight_set(ad->scrl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
93 elm_scroller_bounce_set(ad->scrl, EINA_TRUE, EINA_FALSE);
94 elm_scroller_policy_set(ad->scrl, ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_OFF);
95 elm_win_resize_object_add(ad->win_main, ad->scrl);
96 evas_object_show(ad->scrl);
98 evas_object_resize(ad->scrl,480,95);
100 ad->imgbox = elm_box_add(ad->win_main);
101 elm_box_horizontal_set(ad->imgbox, TRUE);
102 evas_object_size_hint_weight_set(ad->imgbox, EVAS_HINT_EXPAND, 0);
103 evas_object_size_hint_align_set(ad->imgbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
104 elm_scroller_content_set(ad->scrl, ad->imgbox);
105 evas_object_show(ad->imgbox);
109 for (i = 0 ; i < N_IMAGES ; i ++)
111 pt = elm_photo_add(ad->win_main);
112 elm_photo_file_set(pt, images[i]);
113 evas_object_size_hint_weight_set(pt, EVAS_HINT_EXPAND,
115 evas_object_size_hint_align_set(pt, EVAS_HINT_FILL,
117 elm_photo_size_set(pt, 145);
118 elm_box_pack_end(ad->imgbox, pt);
119 evas_object_show(pt);
120 evas_object_data_set(pt,"URI",images[i]);
122 evas_object_smart_callback_add(pt, "clicked", _image_click, pt);
125 ad->txtlist = elm_list_add(ad->win_main);
126 elm_layout_content_set(ad->ly_main, "cbhmdrawer/txtlist", ad->txtlist);
127 elm_list_horizontal_mode_set(ad->txtlist, ELM_LIST_COMPRESS);
128 evas_object_smart_callback_add(ad->txtlist, "selected", _list_click, ad);
129 elm_list_item_append(ad->txtlist, "default", NULL, NULL, NULL, ad);
131 elm_list_go(ad->txtlist);
133 if (get_item_counts() != 0)
134 clipdrawer_update_contents(ad);
139 int clipdrawer_create_view(void *data)
141 struct appdata *ad = data;
148 void clipdrawer_activate_view(void *data)
150 struct appdata *ad = data;
153 elm_win_activate(ad->win_main);