示例#1
0
int 
emusic_slider_creat(Em_Smart_Data *em)
{
	Evas_Object *slider, *obj;

	sd = calloc(1, sizeof(Smart_Data));
	if (!sd) return FALSE;

	obj = edje_object_add(em->evas);
	if (!edje_object_file_set(obj, emusic_config_theme_get(), "widget/slider"))
	{
		int err = edje_object_load_error_get(obj);
		const char *errmsg = edje_load_error_str(err);
    	ERR("cannot load theme '%s', group '%s': %s\n",
        	emusic_config_theme_get(),"widget/slider", errmsg);
    	evas_object_del(obj);
    	return NULL;
	}
	em->slider = obj;

	slider = elm_slider_add(obj);
	evas_object_smart_callback_add(slider, "changed", _slider_changed_cb, em);
	elm_slider_label_set(slider, "Label");
	elm_slider_unit_format_set(slider, "%1.1f units");
	elm_slider_span_size_set(slider, 120);
	evas_object_size_hint_align_set(slider, EVAS_HINT_FILL, 0.5);
	evas_object_size_hint_weight_set(slider, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	edje_object_part_swallow(obj, "slider.swallow", slider);
	evas_object_show(slider);
	sd->slider = slider;

	return 1;
}
示例#2
0
int 
emusic_playlist_ctl_creat(Em_Smart_Data *em)
{
	Evas_Object *obj, *box, *ic, *bt;

	sd = calloc(1, sizeof(Smart_Data));
	if (!sd) return FALSE;

	obj = edje_object_add(em->evas);
	if (!edje_object_file_set(obj, emusic_config_theme_get(), "widget/playlist_ctl"))
	{
		int err = edje_object_load_error_get(obj);
		const char *errmsg = edje_load_error_str(err);
    	ERR("cannot load theme '%s', group '%s': %s\n",
        	emusic_config_theme_get(),"widget/playlist_ctl", errmsg);
    	evas_object_del(obj);
    	return NULL;
	}
	em->playlist_ctl = obj;

	box = elm_box_add(obj);
	elm_box_homogenous_set(box, 0);
	elm_box_horizontal_set(box, 1);

	ic = elm_icon_add(obj);                                    
	elm_icon_file_set(ic, emusic_config_theme_get(), "icon/mp_playlist");
	bt = elm_button_add(obj);
	evas_object_smart_callback_add(bt, "clicked", _button_clicked_playlist_cb, em);
	elm_button_icon_set(bt, ic);         
	elm_box_pack_end(box, bt);
	evas_object_show(bt);
	evas_object_show(ic);
	
	ic = elm_icon_add(obj);                                    
	elm_icon_file_set(ic, emusic_config_theme_get(), "icon/mp_repeat_off"); 
	bt = elm_button_add(obj);
	evas_object_smart_callback_add(bt, "clicked", _button_clicked_repeat_cb, em);
	elm_button_icon_set(bt, ic);
	elm_box_pack_end(box, bt);
	evas_object_show(bt);
	evas_object_show(ic);
    sd->repeat_btn = bt;

	ic = elm_icon_add(obj);                                    
	elm_icon_file_set(ic, emusic_config_theme_get(), "icon/mp_shuffle_off"); 
	bt = elm_button_add(obj);
	evas_object_smart_callback_add(bt, "clicked", _button_clicked_shuffle_cb, em);
	elm_button_icon_set(bt, ic);
	elm_box_pack_end(box, bt);
	evas_object_show(bt);
	evas_object_show(ic);
    sd->shuffle_btn = bt;

	edje_object_part_swallow(obj, "box.swallow", box);
	evas_object_show(box);

	return TRUE;
}
示例#3
0
Eina_Bool
theme_apply(Evas_Object *edje, const Config *config, const char *group)
{
   const char *errmsg;

   EINA_SAFETY_ON_NULL_RETURN_VAL(edje, EINA_FALSE);
   EINA_SAFETY_ON_NULL_RETURN_VAL(config, EINA_FALSE);
   EINA_SAFETY_ON_NULL_RETURN_VAL(group, EINA_FALSE);

   if (edje_object_file_set(edje, config_theme_path_get(config), group))
     return EINA_TRUE;

   errmsg = edje_load_error_str(edje_object_load_error_get(edje));
   INF("Cannot find theme: file=%s group=%s error='%s', trying default...",
       config_theme_path_get(config), group, errmsg);

   if (edje_object_file_set(edje, config_theme_path_default_get(config), group))
     return EINA_TRUE;

   errmsg = edje_load_error_str(edje_object_load_error_get(edje));
   ERR(_("Could not load any theme for group=%s: %s"), group, errmsg);
   return EINA_FALSE;
}
static Eina_Bool
_parse(void)
{
   Evas_Object *ed;
   Eina_Bool ret;

   ed = edje_edit_object_add(ecore_evas_get(ee));
   if (!edje_object_file_set(ed, file, group))
     {
	Edje_Load_Error err = edje_object_load_error_get(ed);
	const char *errmsg = edje_load_error_str(err);
	ERR("could not load group '%s' from file '%s': %s",
	    group, file, errmsg);
	evas_object_del(ed);
	return EINA_FALSE;
     }

   ret = _parts_parse(ed) && _programs_parse(ed);

   evas_object_del(ed);
   return ret;
}
示例#5
0
static Evas_Object *create_my_group(Evas *canvas, const char *text)
{
   Evas_Object *edje;

   edje = edje_object_add(canvas);
   if (!edje)
     {
        EINA_LOG_CRIT("could not create edje object!");
        return NULL;
     }

   if (!edje_object_file_set(edje, PACKAGE_DATA_DIR"/edje_example.edj",
                             "my_group"))
     {
        int err = edje_object_load_error_get(edje);
        const char *errmsg = edje_load_error_str(err);
        EINA_LOG_ERR("could not load 'my_group' from edje_example.edj: %s",
                     errmsg);

        evas_object_del(edje);
        return NULL;
     }

   if (text)
     {
        if (!edje_object_part_text_set(edje, "text", text))
          {
             EINA_LOG_WARN("could not set the text. "
                           "Maybe part 'text' does not exist?");
          }
     }

   evas_object_move(edje, 0, 0);
   evas_object_resize(edje, WIDTH, HEIGHT);
   evas_object_show(edje);
   return edje;
}
示例#6
0
文件: main_ui.c 项目: mink365/e_music
/*
	Win
*/
int
creat_win(Em_Smart_Data *em)
{
	Evas_Object *obj, *win;

	win = elm_win_add(NULL, "e_music", ELM_WIN_BASIC);
	em->win = win;
	em->evas = evas_object_evas_get(win);

	em->layout = elm_layout_add(win);
	if (!em->layout)
	{
		ERR("could not create layout.\n");
		evas_object_del(win);
		return 0;
	}

	evas_object_size_hint_weight_set(em->layout, 1.0, 1.0);
	elm_win_resize_object_add(win, em->layout);
	evas_object_show(em->layout);

	em->edje = elm_layout_edje_get(em->layout);
	if (!elm_layout_file_set(em->layout, emusic_config_theme_get(), "emusic/main"))
	{
		int err = edje_object_load_error_get(em->edje);
		const char *errmsg = edje_load_error_str(err);
		ERR("cannot load theme '%s', group '%s': %s\n",
				emusic_config_theme_get(), "emusic/main", errmsg);
		evas_object_del(win);
		return 0;
	}

	Evas_Object *pg = elm_pager_add(win);
	em->pager = pg;
	elm_layout_content_set(em->layout, "pager", pg);
	elm_object_style_set(pg, "slide_invisible");
	evas_object_show(pg);


	if (emusic_playlist_toolbar_creat(em)) {
		elm_pager_content_push(pg, em->playlist_view);
	}
	else {
		ERR("could not create playlist dialog.\n");
	}

	Evas_Object *notify = emusic_notify_creat(em);
	if (notify) {
		//edje_object_part_swallow(em->edje, _EDJE_PART_NOTIFY, notify);
	}
	else {
		ERR("could not create notify.\n");
	}

	if (emusic_event_bg_creat(em)) {
		edje_object_part_swallow(em->edje, "event_bg", em->event_bg);
	}
	else {
		ERR("could not create event bg.\n");
	}

	elm_win_title_set(win, "E_Music");
	evas_object_smart_callback_add(win, "delete,request", _win_del, NULL);
	evas_object_resize(win, 800, 400);
	evas_object_show(win);

	return 1;
}
示例#7
0
文件: main_ui.c 项目: mink365/e_music
int 
emusic_play_menu_creat(Em_Smart_Data *em)
{
	Evas_Object *mediaplayer, *ic, *btn;
	
  	mediaplayer = edje_object_add(em->evas);
  	if (!edje_object_file_set(mediaplayer, emusic_config_theme_get(), "main/mediaplayer_view"))
  	{
    	int err = edje_object_load_error_get(mediaplayer);
    	const char *errmsg = edje_load_error_str(err);
    	ERR("cannot load theme '%s', group '%s': %s\n",
        	emusic_config_theme_get(), "main/mediaplayer_view", errmsg);
    	evas_object_del(mediaplayer);
    	return 0;
  	}
  	evas_object_size_hint_weight_set(mediaplayer, 1.0, 1.0);
  	evas_object_show(mediaplayer);

  	em->mediaplayer = mediaplayer;

	/* Setting button */
	ic = elm_icon_add(mediaplayer);                                    
	elm_icon_file_set(ic, emusic_config_theme_get(), "icon/setting"); 
	btn = elm_button_add(mediaplayer);
	evas_object_smart_callback_add(btn, "clicked", _button_clicked_setting_cb, em);
	evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
	elm_button_icon_set(btn, ic);       
	elm_object_style_set(btn, "simple");
	edje_object_part_swallow(mediaplayer, "setting_bt.swallow", btn);
	evas_object_show(btn);
	evas_object_show(ic);
	
	if (emusic_playlist_ctl_creat(em)) {
		edje_object_part_swallow(mediaplayer, "playlist_ctl.swallow", em->playlist_ctl);
	}
	else {
		ERR("could not create playlist_ctl widget.\n");
	}

	if (emusic_info_creat(em)) {
		edje_object_part_swallow(mediaplayer, "songs_ifo.swallow", em->info);
	}
	else {
		ERR("could not create info widget.\n");
	}

	if (emusic_cover_art_creat(em)) {
		edje_object_part_swallow(mediaplayer, "cover_art.swallow", em->cover_art);
	}
	else {
		ERR("could not create cover_art widget.\n");
	}

	if (emusic_play_ctl_creat(em)) {
		edje_object_part_swallow(mediaplayer, "play_ctl.swallow", em->play_ctl);
	}
	else {
		ERR("could not create play_ctl widget.\n");
	}

	if (emusic_slider_creat(em)) {
		edje_object_part_swallow(mediaplayer, "slider.swallow", em->slider);
	}
	else {
		ERR("could not create slider widget.\n");
	}

	/* call the backend-callback to update information */
	emusic_callback_update(em);

	return TRUE;
}