Example #1
0
static void
on_to_select(void *data, Evas_Object *obj, void *event_info)
{
   Evas_Object *win, *li, *bx, *bt;
   Eina_List *l;
   
   win = window;
   inwin = elm_win_inwin_add(win);

   bx = elm_box_add(win);
   evas_object_size_hint_weight_set(bx, 1.0, 0.0);
   evas_object_size_hint_align_set(bx, -1.0, -1.0);
   
   li = elm_list_add(win);
   evas_object_size_hint_weight_set(li, 1.0, 1.0);
   evas_object_size_hint_align_set(li,  -1.0, -1.0);
   elm_box_pack_end(bx, li);

   for (l = (Eina_List *)data_contacts_all_list(); l; l = l->next)
     {
        Data_Contact *ctc = l->data;
        Evas_Object *ph;
        char buf[1024];
        char *file, *name;

        if (!ctc->tel.numbers) continue;
        name = data_contact_name_get(ctc);
        if (!name) continue;
        ph = elm_photo_add(win);
        elm_photo_size_set(ph, 20);
        file = data_contact_photo_file_get(ctc);
        if (file)
          {
             elm_photo_file_set(ph, file);
             free(file);
          }
        elm_list_item_append(li, name, ph, NULL, on_contact_select, ctc);
        evas_object_show(ph);
        free(name);
     }

   elm_list_item_append(li, "... Other", NULL, NULL, on_contact_select, NULL);
   
   elm_list_go(li);
   
   evas_object_show(li);
   
   bt = elm_button_add(window);
   elm_button_label_set(bt, "OK");
   evas_object_size_hint_weight_set(bt, 1.0, 0.0);
   evas_object_size_hint_align_set(bt, -1.0, -1.0);
   elm_box_pack_end(bx, bt);
   evas_object_smart_callback_add(bt, "clicked", on_select_ok, NULL);
   evas_object_show(bt);   
   
   elm_win_inwin_content_set(inwin, bx);
   evas_object_show(bx);
   
   elm_win_inwin_activate(inwin);
}
Example #2
0
static void
_init_photo(Evas_Object *win)
{
   Evas_Object *bg, *bx, *photo;
   const char * const filename = "./data/th-whiterabbit01.jpg";

   bg = elm_bg_add(win);
   elm_bg_color_set(bg, 255, 255, 255);
   evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   elm_win_resize_object_add(win, bg);
   evas_object_show(bg);

   bx = elm_box_add(win);
   elm_box_horizontal_set(bx, EINA_TRUE);
   evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
   elm_box_homogeneous_set(bx, EINA_TRUE);
   elm_win_resize_object_add(win, bx);

   photo = elm_photo_add(win);
   g_assert(elm_photo_file_set(photo, filename));
   elm_photo_size_set(photo, 100);
   elm_photo_aspect_fixed_set(photo, EINA_FALSE);
   evas_object_smart_callback_add(photo, "clicked", _on_photo_clicked, NULL);
   evas_object_size_hint_weight_set(photo, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   elm_photo_fill_inside_set(photo, EINA_TRUE);
   evas_object_size_hint_align_set(photo, EVAS_HINT_FILL, EVAS_HINT_FILL);
   elm_box_pack_end(bx, photo);
   evas_object_show(photo);

   evas_object_show(bx);
}
Example #3
0
EAPI_MAIN int
elm_main(int argc, char **argv) {
	Evas_Object *win = NULL;
	Evas_Object *bg = NULL;
	Evas_Object *photo = NULL;

	win = elm_win_add(NULL, "Main Window", ELM_WIN_BASIC);
	elm_win_title_set(win, "photo");
	elm_win_autodel_set(win, EINA_TRUE);
	elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

	bg = elm_bg_add(win);
	evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	elm_win_resize_object_add(win, bg);

	box = elm_box_add(win);
	evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	elm_win_resize_object_add(win, box);

	photo = elm_photo_add(win);
	elm_box_pack_end(box, photo);

	evas_object_smart_callback_add(win, "focus,in", _register_cb, photo);

	register_request_listener(EVENT_RESIZE, resize, photo);
	register_request_listener(EVENT_SET_DISABLED, set_disabled, photo);
	register_request_listener(EVENT_SET_ENABLED, set_enabled, photo);
	register_request_listener(EVENT_HIDE, hide, photo);
	register_request_listener(EVENT_SHOW, show, photo);
	register_request_listener(EVENT_CLICK, click, photo);

	register_request_listener(ACTION_CLICK, register_action_click, photo);

	evas_object_resize(win, 240, 120);
	evas_object_resize(photo, 120, 60);
	evas_object_move(photo, 60, 40);
	elm_photo_size_set(photo, 120);

	evas_object_show(win);
	evas_object_show(bg);
	evas_object_show(box);
	evas_object_show(photo);

	elm_run();
	request_shutdown();
	elm_shutdown();
	return 0;
}