Ejemplo n.º 1
0
static void
frame_content_show(struct MessageNewViewData *data)
{
	struct Window *win = data->win;

	elm_layout_file_set(win->layout, MESSAGE_FILE, "content_edit");

	data->bt1 = elm_button_add(window_evas_object_get(win));
	elm_button_label_set(data->bt1, D_("Close"));
	evas_object_smart_callback_add(data->bt1, "clicked",
				       frame_content_close_clicked, data);
	window_swallow(win, "button_close", data->bt1);
	evas_object_show(data->bt1);

	data->bt2 = elm_button_add(window_evas_object_get(win));
	elm_button_label_set(data->bt2, D_("Continue"));
	evas_object_smart_callback_add(data->bt2, "clicked",
				       frame_content_continue_clicked, data);
	window_swallow(win, "button_continue", data->bt2);
	evas_object_show(data->bt2);

	data->sc = elm_scroller_add(window_evas_object_get(win));
	elm_scroller_policy_set(data->sc, ELM_SCROLLER_POLICY_OFF,
				ELM_SCROLLER_POLICY_ON);
	data->entry = elm_entry_add(window_evas_object_get(win));
	evas_object_size_hint_weight_set(data->entry, 1.0, 1.0);
	evas_object_size_hint_align_set(data->entry, -1.0, -1.0);
	evas_object_smart_callback_add(data->entry, "changed",
				       frame_content_content_changed, data);
	if (data->content != NULL) {
		elm_entry_entry_set(data->entry, data->content);
	}
	elm_scroller_content_set(data->sc, data->entry);
	evas_object_show(data->entry);

	window_swallow(win, "entry", data->sc);
	evas_object_show(data->sc);

	elm_object_focus(data->entry);
}
Ejemplo n.º 2
0
static void
on_contact_select(void *data, Evas_Object *obj, void *event_info)
{
   Data_Contact *ctc = data;
   if (!ctc)
     {
        Evas_Object *win, *bx, *bt, *sc, *en;

        win = window;
        inwin2 = elm_win_inwin_add(win);
        elm_object_style_set(inwin2, "minimal_vertical");
        
        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);
        
        sc = elm_scroller_add(win);
        elm_scroller_content_min_limit(sc, 0, 1);
        evas_object_size_hint_weight_set(sc, 1.0, 1.0);
        evas_object_size_hint_align_set(sc, -1.0, 0.5);
        elm_box_pack_end(bx, sc);
        
        en = elm_entry_add(win);
        elm_entry_single_line_set(en, 1);
        elm_entry_entry_set(en, "Enter number...");
        evas_object_size_hint_weight_set(en, 1.0, 0.0);
        evas_object_size_hint_align_set(en, -1.0, 0.0);
        elm_entry_select_all(en);
        elm_scroller_content_set(sc, en);
        evas_object_show(en);
        evas_object_show(sc);
        number_entry = en;
   
        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_number_ok, NULL);
        evas_object_show(bt);   
        
        elm_win_inwin_content_set(inwin2, bx);
        evas_object_show(bx);

        elm_win_inwin_activate(inwin2);
        elm_object_focus(en);
     }
   else if (eina_list_count(ctc->tel.numbers) > 1)
     {
        Evas_Object *win, *bx, *bx2, *bt, *li, *fr, *ph, *lb;
        Eina_List *l;
        char *name, *file;
        
        win = window;
        inwin2 = 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);

        fr = elm_frame_add(win);
        name = data_contact_name_get(ctc);
        if (name)
          {
             elm_label_label_set(write_lb, name);
             elm_frame_label_set(fr, name);
             free(name);
          }
        evas_object_size_hint_weight_set(fr, 1.0, 0.0);
        evas_object_size_hint_align_set(fr, -1.0, -1.0);
        elm_box_pack_end(bx, fr);        
        evas_object_show(fr);

        bx2 = elm_box_add(win);
        elm_box_horizontal_set(bx2, 1);
        elm_frame_content_set(fr, bx2);
        evas_object_show(bx2);
        
        ph = elm_photo_add(win);
        file = data_contact_photo_file_get(ctc);
        if (file)
          {
             elm_photo_file_set(write_ph, file);
             elm_photo_file_set(ph, file);
             free(file);
          }
        evas_object_size_hint_weight_set(ph, 0.0, 0.0);
        evas_object_size_hint_align_set(ph, -1.0, -1.0);
        elm_box_pack_end(bx2, ph);
        evas_object_show(ph);
        
        lb = elm_label_add(win);
        elm_label_label_set(lb, 
                            "This contact has multiple<br>"
                            "numbers. Select one.");
        evas_object_size_hint_weight_set(lb, 1.0, 0.0);
        evas_object_size_hint_align_set(lb, -1.0, -1.0);
        elm_box_pack_end(bx2, lb);
        evas_object_show(lb);
        
        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 *)(ctc->tel.numbers); l; l = l->next)
          {
             Data_Contact_Tel *tel = l->data;
             // FIXME:
             // tel->flags can be 0 or more of:
             //    DATA_CONTACT_TEL_HOME = (1 << 0),
             //    DATA_CONTACT_TEL_MSG = (1 << 1),
             //    DATA_CONTACT_TEL_WORK = (1 << 2),
             //    DATA_CONTACT_TEL_PREF = (1 << 3),
             //    DATA_CONTACT_TEL_VOICE = (1 << 4),
             //    DATA_CONTACT_TEL_FAX = (1 << 5),
             //    DATA_CONTACT_TEL_CELL = (1 << 6),
             //    DATA_CONTACT_TEL_VIDEO = (1 << 7),
             //    DATA_CONTACT_TEL_PAGER = (1 << 8),
             //    DATA_CONTACT_TEL_BBS = (1 << 9),
             //    DATA_CONTACT_TEL_MODEM = (1 << 10),
             //    DATA_CONTACT_TEL_CAR = (1 << 11),
             //    DATA_CONTACT_TEL_ISDN = (1 << 12),
             //    DATA_CONTACT_TEL_PCS = (1 << 13)
             elm_list_item_append(li, tel->number, NULL, NULL, on_number_select, tel);
          }
        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_number_list_ok, NULL);
        evas_object_show(bt);   
        
        elm_win_inwin_content_set(inwin2, bx);
        evas_object_show(bx);

        elm_win_inwin_activate(inwin2);
        
     }
   else
     {
        Data_Contact_Tel *tel;
        char *name, *file;
        
        tel = ctc->tel.numbers->data;
        if (number) free(number);
        number = strdup(tel->number);
        elm_label_label_set(write_lb, number);
        name = data_contact_name_get(ctc);
        if (name)
          {
             elm_label_label_set(write_lb, name);
             free(name);
          }
        file = data_contact_photo_file_get(ctc);
        if (file)
          {
             elm_photo_file_set(write_ph, file);
             free(file);
          }
     }
}