示例#1
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;
}
/**
 * @brief Positive test case of elm_nocontents_custom_set()
 */
static void utc_UIFW_elm_nocontents_custom_set_func_01(void)
{
        Evas_Object *no_contents = NULL;
        Evas_Object  *custom_area,*btn , *icon;
        Evas_Object *custom;
	char buf[255] = {0,};
   	no_contents = elm_nocontents_add(main_win);
	evas_object_show(no_contents);
 	custom_area = elm_layout_add (main_win);
	elm_layout_file_set (custom_area, NULL, "winset-test/nocontents/search_google");
        elm_nocontents_custom_set(no_contents,custom_area);
	btn = elm_button_add (main_win);
	icon = elm_icon_add (main_win);
	snprintf (buf, sizeof(buf), "%s/30_SmartSearch_google_icon.png", PKG_DATA_DIR);
	elm_icon_file_set (icon, buf, NULL);
	elm_icon_scale_set (icon, 1, 1);
	elm_button_icon_set (btn, icon);
	elm_layout_content_set (custom_area, "buttons", btn);
	custom = elm_nocontents_custom_get(no_contents);
	if (!custom) {
		tet_infoline("elm_nocontents_custom_set() failed in positive test case");
		tet_result(TET_FAIL);
		return;
	}
	tet_result(TET_PASS);
}
/**
 * @brief Negative test case of ug_init elm_button_icon_get()
 */
static void utc_UIFW_elm_button_icon_get_func_02(void)
{
   Evas_Object *button = NULL;
   Evas_Object *icon = NULL;
   char buff[PATH_MAX];
   button = elm_button_add(main_win);
   icon = elm_icon_add(main_win);
   snprintf(buff, sizeof(buff), "%s/images/logo_small.png", "/usr/share/elementary");
   elm_icon_file_set(icon, buff, NULL);
   evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
   elm_icon_scale_set(icon, EINA_TRUE, EINA_TRUE);
   elm_button_icon_set(button, icon);
   if(elm_button_icon_get(NULL) != NULL)
      {
        evas_object_del(button);
        button = NULL;
        tet_infoline("elm_button_icon_get() failed in negative test case");
        tet_result(TET_FAIL);
        return;
      }
   tet_result(TET_PASS);
}
示例#4
0
static void
_button_clicked_play_cb(void *data, Evas_Object *obj, void *event_info)
{
    Smart_Data *sd = data;
    Evas_Object *ic;

    ic = elm_icon_add(obj);

    if (!elm_slideshow_timeout_get(sd->slideshow))
    {
        elm_slideshow_timeout_set(sd->slideshow, sd->delay);
        elm_icon_file_set(ic, enna_config_theme_get(), "icon/mp_pause");
    }
    else
    {
        elm_slideshow_timeout_set(sd->slideshow, 0);
        elm_icon_file_set(ic, enna_config_theme_get(), "icon/mp_play");
    }
    elm_button_icon_set(sd->btplay, ic);
    evas_object_size_hint_min_set(sd->btplay, 64, 64);
    evas_object_size_hint_weight_set(sd->btplay, 0.0, 1.0);
    evas_object_size_hint_align_set(sd->btplay, 0.5, 0.5);
}
示例#5
0
文件: bookstore.c 项目: GeeXboX/enna
static void
bs_service_ctrl_btn_add (const char *icon, const char *part,
                         void (*cb) (void *data, Evas_Object *obj, void *ev))
{
    Evas_Object *layout, *ic, *bt;

    layout = elm_layout_add(enna->layout);

    ic = elm_icon_add(layout);
    elm_icon_file_set(ic, enna_config_theme_get(), icon);
    elm_icon_scale_set(ic, 0, 0);
    evas_object_show(ic);

    bt = elm_button_add(layout);
    evas_object_smart_callback_add(bt, "clicked", cb, NULL);
    elm_button_icon_set(bt, ic);
    elm_object_style_set(bt, "mediaplayer");
    evas_object_size_hint_weight_set(bt, 0.0, 1.0);
    evas_object_size_hint_align_set(bt, 0.5, 0.5);
    evas_object_show(bt);

    elm_layout_content_set(mod->o_layout, part, bt);
}
示例#6
0
EAPI int 
elm_main(int argc, char **argv) 
{
   Ecore_X_Window *roots = NULL;
   int num = 0, i = 0;

   roots = ecore_x_window_root_list(&num);
   if ((!roots) || (num <= 0)) return EXIT_FAILURE;

   for (i = 0; i < num; i++) 
     {
        Ecore_X_Window *zones;
        int x = 0, count = 0;

        count = 
          ecore_x_window_prop_window_list_get(roots[i], 
                                         ECORE_X_ATOM_E_ILLUME_ZONE_LIST, 
                                         &zones);
        if (!zones) continue;
        for (x = 0; x < count; x++) 
          {
             Evas_Object *win;
             Evas_Object *bg, *box, *btn, *icon;
             Ecore_X_Window xwin;
             Ecore_X_Window_State states[2];
             char buff[PATH_MAX];
             int zx, zy, zw, zh;

             /* create new window */
             win = elm_win_add(NULL, "Illume-Softkey", ELM_WIN_DOCK);
             elm_win_title_set(win, "Illume Softkey");
             evas_object_smart_callback_add(win, "delete-request", 
                                            _cb_win_del, NULL);
             evas_object_data_set(win, "zone", (const void *)zones[x]);

             xwin = elm_win_xwindow_get(win);
             ecore_x_icccm_hints_set(xwin, 0, 0, 0, 0, 0, 0, 0);
             states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
             states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
             ecore_x_netwm_window_state_set(xwin, states, 2);

             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);
             evas_object_show(bg);

             box = elm_box_add(win);
             elm_box_horizontal_set(box, EINA_TRUE);
             evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, 
                                              EVAS_HINT_EXPAND);
             elm_win_resize_object_add(win, box);
             evas_object_show(box);

             icon = elm_icon_add(win);
             snprintf(buff, sizeof(buff), "%s/images/back.png", 
                      PACKAGE_DATA_DIR);
             elm_icon_file_set(icon, buff, NULL);
             evas_object_size_hint_aspect_set(icon, 
                                              EVAS_ASPECT_CONTROL_VERTICAL, 
                                              1, 1);

             btn = elm_button_add(win);
             elm_button_icon_set(btn, icon);
             evas_object_smart_callback_add(btn, "clicked", 
                                            _cb_btn_back_clicked, win);
             evas_object_size_hint_align_set(btn, 1.0, 0.5);
             elm_box_pack_end(box, btn);
             evas_object_show(btn);
             evas_object_show(icon);

             icon = elm_icon_add(win);
             snprintf(buff, sizeof(buff), "%s/images/close.png", 
                      PACKAGE_DATA_DIR);
             elm_icon_file_set(icon, buff, NULL);
             evas_object_size_hint_aspect_set(icon, 
                                              EVAS_ASPECT_CONTROL_VERTICAL, 
                                              1, 1);

             btn = elm_button_add(win);
             elm_button_icon_set(btn, icon);
             evas_object_smart_callback_add(btn, "clicked", 
                                            _cb_btn_close_clicked, win);
             evas_object_size_hint_align_set(btn, 1.0, 0.5);
             elm_box_pack_end(box, btn);
             evas_object_show(btn);
             evas_object_show(icon);

             ecore_x_window_geometry_get(zones[x], &zx, &zy, &zw, &zh);
             ecore_x_e_illume_softkey_geometry_set(zones[x], zx, 
                                                   (zy + zh - 40), zw, 40);

             evas_object_move(win, zx, (zy + zh - 40));
             evas_object_resize(win, zw, 40);
             evas_object_show(win);
          }
        free(zones);
     }
   free(roots);

   elm_run();

   elm_shutdown();
   return EXIT_SUCCESS;
}
示例#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;
}