示例#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);
}
示例#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);
}
Evas_Object *
_content_new(Evas_Object *parent, const char *img)
{
   Evas_Object *photo = elm_photo_add(parent);
   elm_photo_file_set(photo, img);
   elm_photo_fill_inside_set(photo, EINA_TRUE);
   elm_object_style_set(photo, "shadow");
   return photo;
}
/* get our images to make slideshow items */
static Evas_Object *
_get(void        *data,
     Evas_Object *obj)
{
   Evas_Object *photo = elm_photo_add(obj);
   elm_photo_file_set(photo, data);
   elm_photo_fill_inside_set(photo, EINA_TRUE);
   elm_object_style_set(photo, "shadow");

   return photo;
}
示例#5
0
static void
on_number_ok(void *data, Evas_Object *obj, void *event_info)
{
   const char *n = elm_entry_entry_get(number_entry);
   if (number) free(number);
   if (n) number = strdup(n);
   else number = NULL;
   elm_photo_file_set(write_ph, NULL);
   elm_label_label_set(write_lb, number);
   evas_object_del(inwin2);
   inwin2 = NULL;
}
示例#6
0
PREFIX value ml_elm_photo_file_set_null(value v_obj)
{
    return Val_bool(elm_photo_file_set((Evas_Object*) v_obj, NULL));
}
示例#7
0
void
create_compose(Data_Message *rep_to, const char *to, const char *text)
{
   Evas_Object *bx, *bx2, *ph, *lb, *bt, *sc, *en;

   if (content) evas_object_del(content);
   
   reply_to = NULL;
   if (number)
     {
        free(number);
        number = NULL;
     }
   
   if (rep_to)
     {
        reply_to = rep_to;
        if (reply_to->from_to)
          number = strdup(reply_to->from_to);
     }
   if (to)
     {
        if (number) free(number);
        number = strdup(to);
     }
   
   bx = elm_box_add(window);
   evas_object_size_hint_weight_set(bx, 1.0, 1.0);
   evas_object_size_hint_align_set(bx, -1.0, -1.0);
   
   content = bx;
   
   bx2 = elm_box_add(window);
   elm_box_horizontal_set(bx2, 1);
   evas_object_size_hint_weight_set(bx2, 1.0, 0.0);
   evas_object_size_hint_align_set(bx2, -1.0, -1.0);
   
   ph = elm_photo_add(window);
   evas_object_smart_callback_add(ph, "clicked", on_to_select, NULL);
   evas_object_size_hint_weight_set(ph, 0.0, 1.0);
   evas_object_size_hint_align_set(ph, -1.0, -1.0);
   elm_box_pack_end(bx2, ph);
   evas_object_show(ph);
   write_ph = ph;
   
   lb = elm_label_add(window);
   elm_label_label_set(lb, "Select...");
   evas_object_size_hint_weight_set(lb, 1.0, 1.0);
   evas_object_size_hint_align_set(lb, -1.0, 0.5);
   elm_box_pack_end(bx2, lb);
   evas_object_show(lb);
   write_lb = lb;
   
   lb = elm_label_add(window);
   elm_label_label_set(lb, "0");
   evas_object_size_hint_weight_set(lb, 0.0, 1.0);
   evas_object_size_hint_align_set(lb, 0.5, 0.5);
   elm_box_pack_end(bx2, lb);
   evas_object_show(lb);
   write_stat = lb;

   if (number)
     {
        Data_Contact *ctc = data_contact_by_tel_find(number);
        if (ctc)
          {
             char *name, *file;
             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);
               }
          }
     }
   
   elm_box_pack_end(bx, bx2);
   evas_object_show(bx2);
   
   sc = elm_scroller_add(window);
   evas_object_size_hint_weight_set(sc, 1.0, 1.0);
   evas_object_size_hint_align_set(sc, -1.0, -1.0);
   elm_box_pack_end(bx, sc);
   
   en = elm_entry_add(window);
   if (text) elm_entry_entry_set(en, text);
   else elm_entry_entry_set(en, "");
   evas_object_size_hint_weight_set(en, 1.0, 1.0);
   evas_object_size_hint_align_set(en, -1.0, -1.0);
   elm_scroller_content_set(sc, en);
   evas_object_smart_callback_add(en, "changed", on_edit, NULL);
   evas_object_show(en);
   
   evas_object_show(sc);
   sms_entry = en;
   
   bt = elm_button_add(window);
   elm_button_label_set(bt, "Send");
   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_send, NULL);
   evas_object_show(bt);   

   elm_box_pack_end(box, bx);
   evas_object_show(bx);
}
示例#8
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);
          }
     }
}