EAPI_MAIN int
elm_main(int    argc,
         char **argv)
{
   Evas_Object *win, *vbox, *hbox, *ic, *ck, *fs_bt, *en, *lb, *sep;

   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

   win = elm_win_util_standard_add("fileselector-button", "File Selector Button Example");
   elm_win_autodel_set(win, EINA_TRUE);

   vbox = elm_box_add(win);
   evas_object_size_hint_weight_set(vbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   elm_win_resize_object_add(win, vbox);
   evas_object_show(vbox);

   ic = elm_icon_add(win);
   elm_icon_standard_set(ic, "file");
   evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);

   /* file selector button */
   fs_bt = elm_fileselector_button_add(win);
   elm_fileselector_button_path_set(fs_bt, "/tmp");
   elm_object_text_set(fs_bt, "Select a file");
   elm_object_part_content_set(fs_bt, "icon", ic);

   elm_box_pack_end(vbox, fs_bt);
   evas_object_show(fs_bt);
   evas_object_show(ic);

   /* attribute setting knobs */
   sep = elm_separator_add(win);
   elm_separator_horizontal_set(sep, EINA_TRUE);
   elm_box_pack_end(vbox, sep);
   evas_object_show(sep);

   hbox = elm_box_add(win);
   elm_box_horizontal_set(hbox, EINA_TRUE);
   elm_box_pack_end(vbox, hbox);
   evas_object_show(hbox);

   ck = elm_check_add(win);
   elm_object_text_set(ck, "editable selection");
   elm_check_state_set(ck, elm_fileselector_button_is_save_get(fs_bt));
   evas_object_smart_callback_add(ck, "changed", _current_sel_toggle, fs_bt);
   elm_box_pack_end(hbox, ck);
   evas_object_show(ck);

   ck = elm_check_add(win);
   elm_object_text_set(ck, "\"inwin\" mode");
   elm_check_state_set(ck, elm_fileselector_button_inwin_mode_get(fs_bt));
   evas_object_smart_callback_add(ck, "changed", _inwin_mode_toggle, fs_bt);
   elm_box_pack_end(hbox, ck);
   evas_object_show(ck);

   ck = elm_check_add(win);
   elm_object_text_set(ck, "folders only");
   elm_check_state_set(ck, elm_fileselector_button_folder_only_get(fs_bt));
   evas_object_smart_callback_add(ck, "changed", _folder_only_toggle, fs_bt);
   elm_box_pack_end(hbox, ck);
   evas_object_show(ck);

   ck = elm_check_add(win);
   elm_object_text_set(ck, "expandable");
   elm_check_state_set(ck, elm_fileselector_button_expandable_get(fs_bt));
   evas_object_smart_callback_add(ck, "changed", _expandable_toggle, fs_bt);
   elm_box_pack_end(hbox, ck);
   evas_object_show(ck);

   lb = elm_label_add(win);
   elm_object_text_set(lb, "Last selection:");
   elm_box_pack_end(vbox, lb);
   evas_object_show(lb);

   en = elm_entry_add(win);
   elm_entry_line_wrap_set(en, EINA_FALSE);
   elm_entry_editable_set(en, EINA_FALSE);
   evas_object_smart_callback_add(fs_bt, "file,chosen", _file_chosen, en);
   elm_box_pack_end(vbox, en);
   evas_object_show(en);

   evas_object_resize(win, 400, 400);
   evas_object_show(win);

   elm_run();
   elm_shutdown();

   return 0;
}
示例#2
0
#include "private.h"

static Elm_Prefs_Item_Type supported_types[] =
{
   ELM_PREFS_TYPE_SEPARATOR,
   ELM_PREFS_TYPE_UNKNOWN
};

static Evas_Object *
elm_prefs_separator_add(const Elm_Prefs_Item_Iface *iface EINA_UNUSED,
                        Evas_Object *prefs,
                        const Elm_Prefs_Item_Type type EINA_UNUSED,
                        const Elm_Prefs_Item_Spec spec EINA_UNUSED,
                        Elm_Prefs_Item_Changed_Cb cb EINA_UNUSED)
{
   Evas_Object *obj = elm_separator_add(prefs);

   return obj;
}

static Eina_Bool
elm_prefs_separator_value_set(Evas_Object *obj,
                              Eina_Value *value)
{
   Eina_Bool val;

   if (eina_value_type_get(value) != EINA_VALUE_TYPE_UCHAR)
     return EINA_FALSE;

   eina_value_get(value, &val);
   elm_separator_horizontal_set(obj, val);
示例#3
0
Evas_Object *
init_panel_camera_light(Evas_Object *win, Eo *camera_node, Eo *light_node, double posX, double posY)
{
   Evas_Object *nnavig = NULL, *bx_navigall = NULL;
   Evas_Object *bx_navigcamup = NULL, *bx_navigcamlow = NULL, *bx_navigligthup = NULL, *bx_navigligthlow = NULL;
   Evas_Object *spX = NULL, *spY = NULL, *spZ = NULL;
   Evas_Object *spangle = NULL, *spaX = NULL, *spaY = NULL, *spaZ = NULL;
   Evas_Object *splX = NULL, *splY = NULL, *splZ = NULL;
   Evas_Object *splangle = NULL, *splaX = NULL, *splaY = NULL, *splaZ = NULL;
   Evas_Object *separator = NULL;
   Axis_Key *camera_xyz = NULL, *light_xyz = NULL;
   Panel_Struct *pobject = NULL;
   Evas_Real px = 0, py = 0, pz = 0;

   if (ELM_WIN_UNKNOWN == elm_win_type_get(win))
     {
        fprintf(stdout, "Not appropriate parent object - at %s line %d\n", __FILE__, __LINE__);
        return NULL;
     }

   if (!_alloc_memory(&camera_xyz, &pobject, &light_xyz)) return NULL;

   /*Navigation panel layout*/
   bx_navigall = elm_box_add(win);
   elm_box_homogeneous_set(bx_navigall, EINA_TRUE);
   evas_object_show(bx_navigall);

   bx_navigcamup = elm_box_add(win);
   elm_box_horizontal_set(bx_navigcamup, EINA_TRUE);
   elm_box_homogeneous_set(bx_navigcamup, EINA_TRUE);
   elm_box_pack_end(bx_navigall, bx_navigcamup);
   evas_object_show(bx_navigcamup);
   bx_navigcamlow = elm_box_add(win);
   elm_box_horizontal_set(bx_navigcamlow, EINA_TRUE);
   elm_box_homogeneous_set(bx_navigcamlow, EINA_TRUE);
   elm_box_pack_end(bx_navigall, bx_navigcamlow);
   evas_object_show(bx_navigcamlow);

   separator = elm_separator_add(win);
   elm_separator_horizontal_set(separator, EINA_TRUE);
   elm_box_pack_end(bx_navigall, separator);
   evas_object_show(separator);

   bx_navigligthup = elm_box_add(win);
   elm_box_horizontal_set(bx_navigligthup, EINA_TRUE);
   elm_box_homogeneous_set(bx_navigligthup, EINA_TRUE);
   elm_box_pack_end(bx_navigall, bx_navigligthup);
   evas_object_show(bx_navigligthup);
   bx_navigligthlow = elm_box_add(win);
   elm_box_horizontal_set(bx_navigligthlow, EINA_TRUE);
   elm_box_homogeneous_set(bx_navigligthlow, EINA_TRUE);
   elm_box_pack_end(bx_navigall, bx_navigligthlow);
   evas_object_show(bx_navigligthlow);

   /*Set UI panel for changing camera and light*/
   /*Init sp camera by default*/
   spX = elm_spinner_add(win);
   elm_spinner_editable_set(spX, EINA_TRUE);
   elm_spinner_min_max_set(spX, -COORDRANGE, COORDRANGE);
   elm_spinner_label_format_set(spX, "camera X: %1.0f");
   elm_spinner_step_set(spX, 1.0);
   pobject->cspX = spX;
   elm_box_pack_end(bx_navigcamup, spX);
   evas_object_show(spX);
   evas_object_smart_callback_add(spX, "changed", _camera_light_changeX_cb, camera_node);

   spY = elm_spinner_add(win);
   elm_spinner_editable_set(spY, EINA_TRUE);
   elm_spinner_min_max_set(spY, -COORDRANGE, COORDRANGE);
   elm_spinner_label_format_set(spY, "camera Y: %1.0f");
   elm_spinner_step_set(spY, 1.0);
   pobject->cspY = spY;
   elm_box_pack_end(bx_navigcamup, spY);
   evas_object_show(spY);
   evas_object_smart_callback_add(spY, "changed", _camera_light_changeY_cb, camera_node);

   spZ = elm_spinner_add(win);
   elm_spinner_editable_set(spZ, EINA_TRUE);
   elm_spinner_min_max_set(spZ, -COORDRANGE, COORDRANGE);
   elm_spinner_label_format_set(spZ, "camera Z: %1.0f");
   elm_spinner_step_set(spY, 1.0);
   pobject->cspZ = spZ;
   elm_box_pack_end(bx_navigcamup, spZ);
   evas_object_show(spZ);
   evas_object_smart_callback_add(spZ, "changed", _camera_light_changeZ_cb, camera_node);

   eo_do(camera_node, evas_canvas3d_node_position_get(EVAS_CANVAS3D_SPACE_PARENT, &px, &py, &pz));
   elm_spinner_value_set(spX, px);
   elm_spinner_value_set(spY, py);
   elm_spinner_value_set(spZ, pz);

   spangle = elm_spinner_add(win);
   elm_spinner_editable_set(spangle, EINA_TRUE);
   elm_spinner_min_max_set(spangle, 0.0, ANGLERANGE);
   elm_spinner_label_format_set(spangle, "angle: %1.0f");
   elm_spinner_step_set(spangle, 1.0);
   pobject->cspangle = spangle;
   evas_object_data_set(spangle, axiskeys, camera_xyz);
   elm_box_pack_end(bx_navigcamlow, spangle);
   elm_spinner_value_set(spangle, 0.0);
   evas_object_show(spangle);
   evas_object_smart_callback_add(spangle, "changed", _camera_light_angle_change_cb, camera_node);

   spaX = elm_spinner_add(win);
   elm_spinner_min_max_set(spaX, 0.0, 1.0);
   elm_spinner_label_format_set(spaX, "axisX: %1.0f");
   elm_spinner_step_set(spaX, 1.0);
   elm_box_pack_end(bx_navigcamlow, spaX);
   evas_object_show(spaX);
   evas_object_smart_callback_add(spaX, "changed", _camera_light_axisX_change_cb, spangle);

   spaY = elm_spinner_add(win);
   elm_spinner_min_max_set(spaY, 0.0, 1.0);
   elm_spinner_label_format_set(spaY, "axisY: %1.0f");
   elm_spinner_step_set(spaY, 1.0);
   elm_box_pack_end(bx_navigcamlow, spaY);
   evas_object_show(spaY);
   evas_object_smart_callback_add(spaY, "changed", _camera_light_axisY_change_cb, spangle);

   spaZ = elm_spinner_add(win);
   elm_spinner_min_max_set(spaZ, 0.0, 1.0);
   elm_spinner_label_format_set(spaZ, "axisZ: %1.0f");
   elm_spinner_step_set(spaZ, 1.0);
   elm_box_pack_end(bx_navigcamlow, spaZ);
   evas_object_show(spaZ);
   evas_object_smart_callback_add(spaZ, "changed", _camera_light_axisZ_change_cb, spangle);

   /*Init spl light by default*/
   splX = elm_spinner_add(win);
   elm_spinner_editable_set(splX, EINA_TRUE);
   elm_spinner_min_max_set(splX, -COORDRANGE, COORDRANGE);
   elm_spinner_label_format_set(splX, "light X: %1.0f");
   elm_spinner_step_set(splX, 1.0);
   pobject->lspX = splX;
   elm_box_pack_end(bx_navigligthup, splX);
   evas_object_show(splX);
   evas_object_smart_callback_add(splX, "changed", _camera_light_changeX_cb, light_node);

   splY = elm_spinner_add(win);
   elm_spinner_editable_set(splY, EINA_TRUE);
   elm_spinner_min_max_set(splY, -COORDRANGE, COORDRANGE);
   elm_spinner_label_format_set(splY, "light Y: %1.0f");
   elm_spinner_step_set(splY, 1.0);
   pobject->lspY = splY;
   elm_box_pack_end(bx_navigligthup, splY);
   evas_object_show(splY);
   evas_object_smart_callback_add(splY, "changed", _camera_light_changeY_cb, light_node);

   splZ = elm_spinner_add(win);
   elm_spinner_editable_set(splZ, EINA_TRUE);
   elm_spinner_min_max_set(splZ, -COORDRANGE, COORDRANGE);
   elm_spinner_label_format_set(splZ, "light Z: %1.0f");
   elm_spinner_step_set(splY, 1.0);
   pobject->lspZ = splZ;
   elm_box_pack_end(bx_navigligthup, splZ);
   evas_object_show(splZ);
   evas_object_smart_callback_add(splZ, "changed", _camera_light_changeZ_cb, light_node);

   eo_do(light_node, evas_canvas3d_node_position_get(EVAS_CANVAS3D_SPACE_PARENT, &px, &py, &pz));
   elm_spinner_value_set(splX, px);
   elm_spinner_value_set(splY, py);
   elm_spinner_value_set(splZ, pz);

   splangle = elm_spinner_add(win);
   elm_spinner_editable_set(splangle, EINA_TRUE);
   elm_spinner_min_max_set(splangle, 0.0, ANGLERANGE);
   elm_spinner_label_format_set(splangle, "angle: %1.0f");
   elm_spinner_step_set(splangle, 1.0);
   pobject->lspangle = splangle;
   evas_object_data_set(splangle, axiskeys, light_xyz);
   elm_box_pack_end(bx_navigligthlow, splangle);
   elm_spinner_value_set(splangle, 0.0);
   evas_object_show(splangle);
   evas_object_smart_callback_add(splangle, "changed", _camera_light_angle_change_cb, light_node);

   splaX = elm_spinner_add(win);
   elm_spinner_min_max_set(splaX, 0.0, 1.0);
   elm_spinner_label_format_set(splaX, "axisX: %1.0f");
   elm_spinner_step_set(splaX, 1.0);
   elm_box_pack_end(bx_navigligthlow, splaX);
   evas_object_show(splaX);
   evas_object_smart_callback_add(splaX, "changed", _camera_light_axisX_change_cb, splangle);

   splaY = elm_spinner_add(win);
   elm_spinner_min_max_set(splaY, 0.0, 1.0);
   elm_spinner_label_format_set(splaY, "axisY: %1.0f");
   elm_spinner_step_set(splaY, 1.0);
   elm_box_pack_end(bx_navigligthlow, splaY);
   evas_object_show(splaY);
   evas_object_smart_callback_add(splaY, "changed", _camera_light_axisY_change_cb, splangle);

   splaZ = elm_spinner_add(win);
   elm_spinner_min_max_set(splaZ, 0.0, 1.0);
   elm_spinner_label_format_set(splaZ, "axisZ: %1.0f");
   elm_spinner_step_set(splaZ, 1.0);
   elm_box_pack_end(bx_navigligthlow, splaZ);
   evas_object_show(splaZ);
   evas_object_smart_callback_add(spaZ, "changed", _camera_light_axisZ_change_cb, splangle);

   nnavig = elm_notify_add(win);
   elm_object_content_set(nnavig, bx_navigall);
   elm_notify_align_set(nnavig, posX, posY);
   evas_object_data_set(nnavig, pb, pobject);

   return nnavig;
}
示例#4
0
文件: flickr_sync.c 项目: Limsik/e17
void
flickr_sync_update(Enlil_Album *album)
{
   Enlil_Album_Data *album_data = enlil_album_user_data_get(album);
   Evas_Object *fr, *tb2, *lbl, *bt, *sep, *pb, *pager;
   Evas_Object *inwin = album_data->netsync.inwin.win;
   Evas_Object *tb = album_data->netsync.inwin.tb;
   int i = 0;
   Eina_List *l;
   Enlil_Photo *photo;
   int nb_photos;
   char buf[1024];

   if (album_data->netsync.inwin.fr) evas_object_del(
                                                     album_data->netsync.inwin.fr);

   //
   fr = elm_frame_add(inwin);
   album_data->netsync.inwin.fr = fr;
   elm_object_text_set(fr, D_("Synchronise an album with flickr"));
   evas_object_size_hint_weight_set(fr, 1.0, 1.0);
   evas_object_size_hint_align_set(fr, -1.0, -1.0);
   evas_object_show(fr);
   elm_table_padding_set(tb, 1, 1);
   elm_table_pack(tb, fr, 0, 0, 3, 1);

   tb2 = elm_table_add(inwin);
   evas_object_size_hint_weight_set(tb2, 1.0, 0.0);
   evas_object_size_hint_align_set(tb2, -1.0, 1.0);
   elm_table_padding_set(tb2, 15, 5);
   evas_object_show(tb2);
   elm_object_content_set(fr, tb2);
   //

   if (album_data->netsync.album_netsync_notuptodate)
   {
      lbl = elm_label_add(inwin);
      elm_object_text_set(lbl, D_("Update the flickr album header."));
      evas_object_show(lbl);
      elm_table_pack(tb2, lbl, 0, i, 1, 1);

      bt = elm_button_add(inwin);
      album_data->netsync.inwin.bt1 = bt;
      elm_object_text_set(bt, D_("Update"));
      evas_object_smart_callback_add(bt, "clicked", _netsync_notuptodate_cb,
                                     album);
      evas_object_size_hint_align_set(bt, 0.5, 0.5);
      evas_object_size_hint_weight_set(bt, 1.0, 0.0);

      evas_object_show(bt);
      elm_table_pack(tb2, bt, 1, i, 1, 1);

      i++;

      sep = elm_separator_add(inwin);
      evas_object_show(sep);
      elm_table_pack(tb2, sep, 0, i, 2, 1);
      i++;
   }

   if (album_data->netsync.album_notinnetsync)
   {
      lbl = elm_label_add(inwin);
      elm_object_text_set(lbl, D_("The album is not in Flickr."));
      evas_object_show(lbl);
      elm_table_pack(tb2, lbl, 0, i, 1, 1);

      bt = elm_button_add(inwin);
      album_data->netsync.inwin.bt2 = bt;
      elm_object_text_set(bt, D_("Add the album in Flickr"));
      evas_object_size_hint_align_set(bt, 0.5, 0.5);
      evas_object_size_hint_weight_set(bt, 1.0, 0.0);

      evas_object_smart_callback_add(bt, "clicked", _album_notinnetsync_cb,
                                     album);
      evas_object_show(bt);
      elm_table_pack(tb2, bt, 1, i, 1, 1);

      i++;

      sep = elm_separator_add(inwin);
      evas_object_show(sep);
      elm_table_pack(tb2, sep, 0, i, 2, 1);
      i++;
   }

   if (album_data->netsync.album_local_notuptodate)
   {
      lbl = elm_label_add(inwin);
      elm_object_text_set(lbl, D_("Update the local album header."));
      evas_object_show(lbl);
      elm_table_pack(tb2, lbl, 0, i, 1, 1);

      bt = elm_button_add(inwin);
      album_data->netsync.inwin.bt3 = bt;
      evas_object_size_hint_align_set(bt, 0.5, 0.5);
      evas_object_size_hint_weight_set(bt, 1.0, 0.0);

      evas_object_smart_callback_add(bt, "clicked", _local_notuptodate_cb,
                                     album);
      elm_object_text_set(bt, D_("Update"));
      evas_object_show(bt);
      elm_table_pack(tb2, bt, 1, i, 1, 1);

      i++;

      sep = elm_separator_add(inwin);
      evas_object_show(sep);
      elm_table_pack(tb2, sep, 0, i, 2, 1);
      i++;
   }

   if (album_data->netsync.photos_notinlocal)
   {
      lbl = elm_label_add(inwin);
      elm_object_text_set(lbl, D_("Some photos are not in the local album."));
      evas_object_show(lbl);
      elm_table_pack(tb2, lbl, 0, i, 1, 1);

      pager = elm_naviframe_add(inwin);
      album_data->netsync.inwin.notinlocal.pager = pager;
      evas_object_size_hint_align_set(pager, 0.5, 0.5);
      evas_object_size_hint_weight_set(pager, 1.0, 0.0);
      evas_object_show(pager);
      elm_table_pack(tb2, pager, 1, i, 1, 1);
      elm_object_style_set(pager, "fade_invisible");

      bt = elm_button_add(inwin);
      album_data->netsync.inwin.notinlocal.bt = bt;
      album_data->netsync.inwin.bt4 = bt;
      evas_object_size_hint_align_set(bt, -1.0, 0.5);
      evas_object_size_hint_weight_set(bt, 1.0, 0.0);
      elm_object_text_set(bt, D_("Download Them All"));
      evas_object_smart_callback_add(bt, "clicked", _photos_notinlocal_cb,
                                     album);
      evas_object_show(bt);
      elm_naviframe_item_simple_push(pager, bt);

      pb = elm_progressbar_add(inwin);
      album_data->netsync.inwin.notinlocal.pb = pb;
      evas_object_size_hint_align_set(pb, -1.0, 0.5);
      evas_object_size_hint_weight_set(pb, 1.0, 0.0);
      elm_progressbar_pulse_set(pb, EINA_TRUE);
      elm_object_text_set(pb, D_("Downloads in progress ..."));
      evas_object_show(pb);
      elm_naviframe_item_simple_push(pager, pb);
      evas_object_size_hint_max_set(pb, 0, 0);

      if (album_data->netsync.inwin.notinlocal.is_updating)
      {
         elm_progressbar_pulse(pb, EINA_TRUE);
         elm_naviframe_item_simple_promote(pager, pb);
      }
      else
         elm_naviframe_item_simple_promote(pager, bt);

      i++;

      sep = elm_separator_add(inwin);
      evas_object_show(sep);
      elm_table_pack(tb2, sep, 0, i, 2, 1);
      i++;
   }

   nb_photos = 0;
   EINA_LIST_FOREACH(enlil_album_photos_get(album), l, photo)
   {
      Enlil_Photo_Data *photo_data = enlil_photo_user_data_get(photo);
      if (photo_data && photo_data->netsync.state == PHOTO_FLICKR_NOTINFLICKR)
      {
         nb_photos++;
      }
   }