Beispiel #1
0
static void
_smart_toggle_smart_add(Evas_Object *o)
{
	Evas *e = evas_object_evas_get(o);
	EVAS_SMART_DATA_ALLOC(o, smart_toggle_t);

	_smart_toggle_parent_sc->add(o);

	priv->theme = edje_object_add(e);
	edje_object_file_set(priv->theme, SYNTHPOD_DATA_DIR"/synthpod.edj",
		"/synthpod/smart_toggle/theme"); //TODO
	evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_IN, _mouse_in, priv);
	evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_OUT, _mouse_out, priv);
	evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _mouse_down, priv);
	evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_WHEEL, _mouse_wheel, priv);
	evas_object_show(priv->theme);
	evas_object_smart_member_add(priv->theme, o);

	_smart_toggle_smart_init(o);
}
Beispiel #2
0
/* Edje: render() */
static Etk_Bool
_edje_render(Etk_Tree_Model * model, Etk_Tree_Row * row, Etk_Geometry geometry,
	     void *cell_data,
	     Evas_Object * cell_objects[ETK_TREE_MAX_OBJECTS_PER_MODEL],
	     Evas * evas)
{
	//g_debug("render called");

	Etk_Tree_Model_Edje *edje_model;
	Etk_Tree_Model_Edje_Data *edje_data;

	if (!(edje_model = (Etk_Tree_Model_Edje *) model) ||
	    !(edje_data = cell_data) || !evas || !edje_data->parameters)
		return ETK_FALSE;

	if (!
	    (cell_objects[0] =
	     etk_cache_find(edje_model->cache, edje_data->parameters, NULL))) {
		//g_debug("Rendering");

		cell_objects[0] = edje_object_add(evas);
		if (!cell_objects[0])
			return ETK_FALSE;
	}
	if (!edje_file_group_exists(edje_model->file, edje_model->part)) {
		g_error("%s does not exist in %s", edje_model->part,
			edje_model->file);
	}
	edje_object_file_set(cell_objects[0], edje_model->file,
			     edje_model->part);
	edje_extern_object_min_size_set(cell_objects[0], geometry.w,
					geometry.h);
	g_hash_table_foreach(edje_data->parameters, _edje_set_text_cb,
			     cell_objects[0]);
	evas_object_move(cell_objects[0], geometry.x, geometry.y);

	evas_object_resize(cell_objects[0], geometry.w, geometry.h);
	evas_object_show(cell_objects[0]);

	return ETK_TRUE;
}
/* internal calls */
static Evas_Object *
_theme_obj_new(Evas *e, const char *custom_dir, const char *group)
{
   Evas_Object *o;

   o = edje_object_add(e);
   if (!e_theme_edje_object_set(o, "base/theme/modules/illume", group))
     {
	if (custom_dir)
	  {
	     char buf[PATH_MAX];

	     snprintf(buf, sizeof(buf), "%s/illume.edj", custom_dir);
	     if (edje_object_file_set(o, buf, group))
	       {
		  printf("OK FALLBACK %s\n", buf);
	       }
	  }
     }
   return o;
}
Beispiel #4
0
static Evas_Object *
engage_element_icon_new(Evas * evas, const char *file, const char *group)
{
  int             iw, ih;
  Evas_Object    *result = NULL;

  /* edje */
  if (group) {
    if (file && file[0] == '/') {
      result = edje_object_add(evas);
      if (edje_object_file_set(result, file, group) > 0) {
        evas_object_move(result, -9999, -9999);
        evas_object_resize(result, 4, 4);
      }
    } else {
      evas_object_del(result);
      result = NULL;
    }
  }
  /* image */
  else {
    if (file && file[0] == '/') {
      result = evas_object_image_add(evas);
      evas_object_image_file_set(result, file, NULL);
      switch (evas_object_image_load_error_get(result)) {
      case EVAS_LOAD_ERROR_NONE:
        evas_object_move(result, -9999, -9999);
        evas_object_resize(result, 4, 4);
        break;
      default:
        evas_object_del(result);
        result = NULL;
      }
    } else {
      evas_object_del(result);
      result = NULL;
    }
  }
  return (result);
}
static E_Gadcon_Client *
_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
{
   Evas_Object *o;
   E_Gadcon_Client *gcc;
   Instance *inst;
   char buf[PATH_MAX];

   inst = E_NEW(Instance, 1);

   inst->ci = _tclock_config_item_get(id);
   if (!inst->ci->id) inst->ci->id = eina_stringshare_add(id);

   o = edje_object_add(gc->evas);
   snprintf(buf, sizeof(buf), "%s/tclock.edj", tclock_config->mod_dir);
   if (!e_theme_edje_object_set(o, "base/theme/modules/tclock", 
                                "modules/tclock/main"))
     edje_object_file_set(o, buf, "modules/tclock/main");
   evas_object_show(o);

   gcc = e_gadcon_client_new(gc, name, id, style, o);
   gcc->data = inst;
   inst->gcc = gcc;
   inst->tclock = o;

   evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
                                  _tclock_cb_mouse_down, inst);
   evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_IN,
                                  _tclock_cb_mouse_in, inst);
   evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_OUT,
                                  _tclock_cb_mouse_out, inst);

   tclock_config->instances =
     eina_list_append(tclock_config->instances, inst);

   _tclock_cb_check(inst);
   if (!check_timer)
     check_timer = ecore_timer_add(1.0, _tclock_cb_check, NULL);
   return gcc;
}
Beispiel #6
0
void create_buttons() {

	
	container_outer = edje_object_add(evas);
	edje_object_file_set(container_outer, default_theme, "widgets/scrollframe");
	evas_object_move(container_outer, 0, 0);
	edje_object_signal_emit(container_outer, "hbar", "hide");
	evas_object_resize(container_outer, barwidth - 19, container_height);
	evas_object_show(container_outer);

	edje_object_signal_callback_add(container_outer, "drag*", "vbar_bar", _scrolldrag, NULL);
	
	container = esmart_container_new(evas);
	edje_object_part_swallow(container_outer, "item", container);
	esmart_container_direction_set(container, CONTAINER_DIRECTION_VERTICAL);
	
	get_theme_list();

#define ADD_BUTTON(A, B, C)\
	A = edje_object_add(evas);\
	edje_object_file_set(A, default_theme, "widgets/button");\
	evas_object_resize(A, 120, 24);\
	edje_object_part_text_set(A, "label", C);\
	evas_object_show(A);
	
	ADD_BUTTON(b_default, 40, "Default Theme");
	evas_object_move(b_default, 5, container_height + 10);
	edje_object_signal_callback_add(b_default, "click", "", _preview_theme, NULL);
	 
	ADD_BUTTON(b_apply, 60, "Apply");
	evas_object_move(b_apply, 5, container_height + 40);
	edje_object_signal_callback_add(b_apply, "click", "", _set_theme, NULL);
	
	ADD_BUTTON(b_exit, 80, "Exit");
	evas_object_move(b_exit, 5, container_height + 60);
	edje_object_signal_callback_add(b_exit, "click", "", _ethemes_exit, NULL);
	

#undef ADD_BUTTON
}
Beispiel #7
0
void
theme_init(const char *theme)
{
   Evas_Object *o;
   char buf[4096];
   
   if (!theme) theme = "default";
   o = edje_object_add(evas);
   if ((theme) && 
       (theme[0] != '/') && 
       (!!strncmp(theme, "./", 2)) &&
	(!!strncmp(theme, "../", 3)))
     snprintf(buf, sizeof(buf), THEMES"/%s.edj", theme);
   else
     snprintf(buf, sizeof(buf), "%s", theme);
   edje_object_file_set(o, buf, "exquisite/theme");
   evas_object_move(o, 0, 0);
   evas_object_resize(o, scr_w, scr_h);
   edje_object_signal_callback_add(o, "exquisite", "done", _theme_cb_exit_done, NULL);
   evas_object_show(o);
   o_bg = o;
}
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;
}
Beispiel #9
0
Evas_Object *
elm_keypad_add(Evas_Object * parent)
{
	// Evas_Object *obj; Instead I'm using the wd->widget variable
	Evas *e;
	Widget_Data *wd;

	wd = ELM_NEW(Widget_Data);
	e = evas_object_evas_get(parent);
	wd->widget = elm_widget_add(e);
	elm_widget_data_set(wd->widget, wd);
	elm_widget_del_hook_set(wd->widget, _del_hook);

	wd->keypad = edje_object_add(e);
	g_debug("keypad evas object: %d", wd->keypad);
	edje_object_file_set(wd->keypad, KEYPAD_FILE, "keypad");
	edje_object_signal_callback_add(wd->keypad, "*", "input",
					_signal_clicked, wd->widget);
	edje_object_signal_callback_add(wd->keypad, "0", "mouse_up",
					_zero_mouse_up, wd->widget);
	edje_object_signal_callback_add(wd->keypad, "0", "mouse_down",
					_zero_mouse_down, wd->widget);

	edje_object_part_text_set(wd->keypad, "text2_desc", D_("ABC"));
	edje_object_part_text_set(wd->keypad, "text3_desc", D_("DEF"));
	edje_object_part_text_set(wd->keypad, "text4_desc", D_("GHI"));
	edje_object_part_text_set(wd->keypad, "text5_desc", D_("JKL"));
	edje_object_part_text_set(wd->keypad, "text6_desc", D_("MNO"));
	edje_object_part_text_set(wd->keypad, "text7_desc", D_("PQRS"));
	edje_object_part_text_set(wd->keypad, "text8_desc", D_("TUV"));
	edje_object_part_text_set(wd->keypad, "text9_desc", D_("XYZ"));

	elm_widget_resize_object_set(wd->widget, wd->keypad);
	//evas_object_smart_callback_add(wd->widget, "sub-object-del", _sub_del, wd->widget);

	_sizing_eval(wd->widget);
	return wd->widget;
}
void eyelight_viewer_tableofcontents_start(Eyelight_Viewer* pres,int select)
{
    Evas_Object *o;
    int w_win, h_win;
    const char* data;

    evas_output_viewport_get(pres->evas, NULL, NULL, &w_win, &h_win);

    pres->state = EYELIGHT_VIEWER_STATE_TABLEOFCONTENTS;
    pres->tableofcontents_current = select;

    o = edje_object_add(pres->evas);
    pres->tableofcontents_background = o;
    if(edje_object_file_set(o, pres->theme, "eyelight/tableofcontents") ==  0)
    {
        WARN("table of contents is not supported by the theme");
        return ;
    }

    data = edje_object_data_get(o, "nb_slides");
    pres->tableofcontents_nb_slides = atoi(data);
    evas_object_show(o);
    evas_object_resize(o, pres->current_size_w, pres->current_size_h);
    edje_object_scale_set(o, pres->current_scale);
    evas_object_move(o, pres->current_pos_x, pres->current_pos_y);
    evas_object_smart_member_add(o,pres->smart_obj);
    evas_object_clip_set(o, pres->current_clip);

    edje_object_signal_callback_add(o,"tableofcontents,slide,next","eyelight",_eyelight_viewer_tableofcontents_next_cb,pres);
    edje_object_signal_callback_add(o,"tableofcontents,slide,previous","eyelight",_eyelight_viewer_tableofcontents_previous_cb,pres);
    edje_object_signal_callback_add(o,"tableofcontents,next,end","eyelight",_eyelight_viewer_tableofcontents_next_end_cb,pres);
    edje_object_signal_callback_add(o,"tableofcontents,previous,end","eyelight",_eyelight_viewer_tableofcontents_previous_end_cb,pres);

    _eyelight_viewer_tableofcontents_slides_load(pres);

    edje_object_signal_emit(pres->tableofcontents_background,
           "show","eyelight");
}
Beispiel #11
0
void
itask_item_new(Itask *it, E_Border *bd)
{
   Itask_Item *ic;

   if (!itask_item_add_check(it, bd))
     return;

   if (itask_item_find(it, bd))
     return;

   e_object_ref(E_OBJECT(bd));

   ic = E_NEW(Itask_Item, 1);
   ic->itask = it;
   ic->border = bd;

   ic->o_holder = edje_object_add(evas_object_evas_get(it->o_box));

   if (!e_theme_edje_object_set(ic->o_holder, "base/theme/modules/itask", "e/modules/itask/button"))
     edje_object_file_set(ic->o_holder, itask_theme_path, "e/modules/itask/button");

   if (it->ci->ibox_style)
     edje_object_signal_emit(ic->o_holder, "e,state,icon", "e");
   else
     edje_object_signal_emit(ic->o_holder, "e,state,combo", "e");
   
   itask_item_set_icon(ic);
   itask_item_set_label(ic);

   evas_object_event_callback_add(ic->o_holder, EVAS_CALLBACK_MOUSE_DOWN, _itask_item_cb_mouse_down, ic);
   evas_object_event_callback_add(ic->o_holder, EVAS_CALLBACK_MOUSE_UP,   _itask_item_cb_mouse_up, ic);
   evas_object_event_callback_add(ic->o_holder, EVAS_CALLBACK_MOUSE_MOVE, _itask_item_cb_mouse_move, ic);

   it->items = eina_list_append(it->items, ic);

   itask_update(ic->itask);
}
Beispiel #12
0
static E_Gadcon_Client *
_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style) 
{
   Instance *inst;
   E_Gadcon_Client *gcc;
   char buf[PATH_MAX];

   snprintf(buf, sizeof(buf), "%s/net.edj", e_module_dir_get(net_cfg->mod));

   inst = E_NEW(Instance, 1);
   inst->ci = _net_config_item_get(id);
 
   inst->o_net = edje_object_add(gc->evas);
   if (!e_theme_edje_object_set(inst->o_net, "base/theme/modules/net",
				"modules/net/main"))
     edje_object_file_set(inst->o_net, buf, "modules/net/main");
   edje_object_signal_callback_add(inst->o_net, "e,action,mouse,in", "",
				   _net_cb_mouse_in, inst);
   edje_object_signal_callback_add(inst->o_net, "e,action,mouse,out", "",
				   _net_cb_mouse_out, inst);
   evas_object_show(inst->o_net);

   if (!inst->ci->show_text)
     edje_object_signal_emit(inst->o_net, "e,state,text,hide", "e");
   else
     edje_object_signal_emit(inst->o_net, "e,state,text,show", "e");
   
   gcc = e_gadcon_client_new(gc, name, id, style, inst->o_net);
   gcc->data = inst;
   inst->gcc = gcc;
   inst->timer = ecore_timer_add(0.5, _net_cb_poll, inst);

   evas_object_event_callback_add(inst->o_net, EVAS_CALLBACK_MOUSE_DOWN, 
				  _net_cb_mouse_down, inst);

   net_cfg->instances = eina_list_append(net_cfg->instances, inst);
   return gcc;
}
Beispiel #13
0
Url_Bar *
url_bar_add(Evas_Object *webView, int width)
{
    Evas *evas;
    Url_Bar *url_bar;
    if (!webView)
        return NULL;
    evas = evas_object_evas_get(webView);

    url_bar = (Url_Bar *)malloc(sizeof(Url_Bar));
    url_bar->webView = webView;

    url_bar->area = evas_object_rectangle_add(evas);
    evas_object_name_set(url_bar->area, "url_barArea");
    evas_object_color_set(url_bar->area, 255, 255, 255, 255);

    url_bar->entry = edje_object_add(evas);
    Eina_Bool ret = edje_object_file_set(url_bar->entry, THEME_DIR"/entry.edj", "control/entry/base/default");
    if (!ret) {
        evas_object_del(url_bar->area);

        free(url_bar);
        return NULL;
    }

    edje_object_part_text_set(url_bar->entry, "url.text", "");

    /* Set URL bar dimensions and show it */
    url_bar_width_set(url_bar, width);
    evas_object_show(url_bar->area);
    evas_object_show(url_bar->entry);

    evas_object_event_callback_add(url_bar->entry, EVAS_CALLBACK_MOUSE_DOWN, on_urlbar_mouse_down, url_bar);
    evas_object_event_callback_add(url_bar->entry, EVAS_CALLBACK_KEY_DOWN, on_urlbar_key_down, url_bar);
    evas_object_event_callback_add(url_bar->entry, EVAS_CALLBACK_FOCUS_OUT, on_urlbar_focus_out, url_bar);

    return url_bar;
}
Beispiel #14
0
void *
init(Elation_Module *em)
{
   Elation_Module_Private *pr;
   
   pr = calloc(1, sizeof(Elation_Module_Private));
   if (!pr) return NULL;
   
   /* set up module methods */
   em->shutdown = shutdown;
   em->resize = resize;
   em->show = show;
   em->hide = hide;
   em->focus = focus;
   em->unfocus = unfocus;
   em->action = action;

   pr->overlay = edje_object_add(em->info->evas);
   edje_object_file_set(pr->overlay, PACKAGE_DATA_DIR"/data/theme.edj", "media");
   edje_object_signal_emit(pr->overlay, "media", "0");
   
   return pr;
}
Beispiel #15
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;
}
Beispiel #16
0
/*  Theme Change  */
void
cc_update_theme()
{
	int             w, h;
	char           *edjefn;

	if (!controlcentre)
		return;

	edjefn = malloc(PATH_MAX);
	snprintf(edjefn, PATH_MAX, PACKAGE_DATA_DIR "/themes/%s.edj",
		 main_config->theme);
	edje_object_file_set(controlcentre->edje, edjefn, CC_PART);
	free(edjefn);

	/* EDJE and ECORE min, max and resizing */
	edje_object_size_max_get(controlcentre->edje, &w, &h);
	ecore_evas_size_max_set(controlcentre->win, w, h);
	edje_object_size_min_get(controlcentre->edje, &w, &h);
	ecore_evas_size_min_set(controlcentre->win, w, h);
	ecore_evas_resize(controlcentre->win, w, h);
	evas_object_resize(controlcentre->edje, w, h);
	evas_object_resize(controlcentre->dragger, w, h);
}
Beispiel #17
0
static Evas_Object *teste(Evas *canvas)
{
  Evas_Object *edje;
  edje = edje_object_add(canvas);

  if (!edje)
    {
      printf("Erro cód 165");
      return NULL;
    }

  if(!edje_object_file_set(edje, "/home/luciana/Public/Enlightenment/Edje Post it/Teste_2/teste_2.edj",
			   "teste"))
     {
       printf("Erro cód 23");
       /* evas_object_del(edje); */
       return NULL;
     }

  /* evas_object_move(edje, 0, 0); */
  evas_object_resize(edje, WIDTH, HEIGHT);
  evas_object_show(edje);
  return edje;
}
Beispiel #18
0
void Widget::applyCursor()
{
    const char *file;
    Evas_Coord x, y;

    String theme = edjeThemeRecursive();
    if (!theme.isNull())
        file = edjeThemeRecursive().utf8().data();

    m_data->m_cursorObject = edje_object_add(evas());
    if (!edje_object_file_set(m_data->m_cursorObject, file, m_data->m_cursorGroup.utf8().data())) {
        evas_object_del(m_data->m_cursorObject);
        m_data->m_cursorObject = 0;
        ecore_evas_object_cursor_set(ecoreEvas(), 0, 0, 0, 0);
        applyFallbackCursor();
    } else {
        Evas_Coord w, h;
        const char *d;

        edje_object_size_min_get(m_data->m_cursorObject, &w, &h);
        if ((w <= 0) || (h <= 0))
            edje_object_size_min_calc(m_data->m_cursorObject, &w, &h);
        if ((w <= 0) || (h <= 0))
            w = h = 16;
        evas_object_resize(m_data->m_cursorObject, w, h);

        d = edje_object_data_get(m_data->m_cursorObject, "hot.x");
        x = d ? atoi(d) : 0;

        d = edje_object_data_get(m_data->m_cursorObject, "hot.y");
        y = d ? atoi(d) : 0;

        ecore_evas_object_cursor_set(ecoreEvas(), m_data->m_cursorObject,
                                     EVAS_LAYER_MAX, x, y);
    }
}
Beispiel #19
0
Ind_Win *
e_mod_ind_win_new(E_Zone *zone) 
{
   Ind_Win *iwin;
   Ecore_X_Window_State states[2];
   Evas_Coord h = 0;

   /* create our new indicator window object */
   iwin = E_OBJECT_ALLOC(Ind_Win, IND_WIN_TYPE, _e_mod_ind_win_cb_free);
   if (!iwin) return NULL;

   h = (il_ind_cfg->height * e_scale);
   iwin->zone = zone;

   /* create new window */
   iwin->win = e_win_new(zone->container);
   iwin->win->data = iwin;

   /* set some properties on the window */
   e_win_title_set(iwin->win, _("Illume Indicator"));
   e_win_name_class_set(iwin->win, "Illume-Indicator", "Illume-Indicator");
   e_win_no_remember_set(iwin->win, EINA_TRUE);

   /* hook into window resize so we can resize our objects */
   e_win_resize_callback_set(iwin->win, _e_mod_ind_win_cb_resize);

   /* set this window to not show in taskbar or pager */
   states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
   states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
   ecore_x_netwm_window_state_set(iwin->win->evas_win, states, 2);

   /* set this window to not accept or take focus */
   ecore_x_icccm_hints_set(iwin->win->evas_win, 0, 0, 0, 0, 0, 0, 0);

   /* create the popup */
   iwin->popup = e_popup_new(zone, 0, 0, zone->w, h);
   e_popup_name_set(iwin->popup, "indicator");
   e_popup_layer_set(iwin->popup, 200);

   /* create our event rectangle */
   iwin->o_event = evas_object_rectangle_add(iwin->win->evas);
   evas_object_color_set(iwin->o_event, 0, 0, 0, 0);
   evas_object_event_callback_add(iwin->o_event, EVAS_CALLBACK_MOUSE_DOWN, 
                                  _e_mod_ind_win_cb_mouse_down, iwin);
   evas_object_event_callback_add(iwin->o_event, EVAS_CALLBACK_MOUSE_UP, 
                                  _e_mod_ind_win_cb_mouse_up, iwin);
   evas_object_event_callback_add(iwin->o_event, EVAS_CALLBACK_MOUSE_MOVE, 
                                  _e_mod_ind_win_cb_mouse_move, iwin);
   evas_object_move(iwin->o_event, 0, 0);
   evas_object_show(iwin->o_event);

   /* create our base object */
   iwin->o_base = edje_object_add(iwin->win->evas);
   if (!e_theme_edje_object_set(iwin->o_base, 
                                "base/theme/modules/illume-indicator", 
                                "modules/illume-indicator/window")) 
     {
        char buff[PATH_MAX];

        snprintf(buff, sizeof(buff), 
                 "%s/e-module-illume-indicator.edj", _ind_mod_dir);
        edje_object_file_set(iwin->o_base, buff, 
                             "modules/illume-indicator/window");
     }
   evas_object_move(iwin->o_base, 0, 0);
   evas_object_show(iwin->o_base);

   e_popup_edje_bg_object_set(iwin->popup, iwin->o_base);

   /* create our gadget container */
   iwin->gadcon = e_gadcon_swallowed_new("illume-indicator", zone->id, 
                                         iwin->o_base, "e.swallow.content");
   edje_extern_object_min_size_set(iwin->gadcon->o_container, zone->w, h);
   e_gadcon_min_size_request_callback_set(iwin->gadcon, 
                                          _e_mod_ind_win_cb_min_size_request, 
                                          iwin);
   e_gadcon_size_request_callback_set(iwin->gadcon, 
                                      _e_mod_ind_win_cb_size_request, iwin);
   e_gadcon_frame_request_callback_set(iwin->gadcon, 
                                       _e_mod_ind_win_cb_frame_request, iwin);
   e_gadcon_orient(iwin->gadcon, E_GADCON_ORIENT_FLOAT);
   e_gadcon_zone_set(iwin->gadcon, zone);
   e_gadcon_ecore_evas_set(iwin->gadcon, iwin->win->ecore_evas);

   e_gadcon_util_menu_attach_func_set(iwin->gadcon, 
                                      _e_mod_ind_win_cb_menu_items_append, 
                                      iwin);
   e_gadcon_populate(iwin->gadcon);

   /* hook into property change so we can adjust w/ e_scale */
   iwin->hdls = 
     eina_list_append(iwin->hdls, 
                      ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY, 
                                              _e_mod_ind_win_cb_win_prop, iwin));

   /* hook into zone resize so we can set minimum window width when zone 
    * size changes */
   iwin->hdls = 
     eina_list_append(iwin->hdls, 
                      ecore_event_handler_add(E_EVENT_ZONE_MOVE_RESIZE, 
                                              _e_mod_ind_win_cb_zone_resize, 
                                              iwin));

   iwin->hdls = 
     eina_list_append(iwin->hdls, 
                      ecore_event_handler_add(E_EVENT_BORDER_HIDE, 
                                              _e_mod_ind_win_cb_border_hide, 
                                              iwin));

   iwin->hdls = 
     eina_list_append(iwin->hdls, 
                      ecore_event_handler_add(E_EVENT_BORDER_SHOW, 
                                              _e_mod_ind_win_cb_border_show, 
                                              iwin));

   /* set minimum size of this window & popup */
   e_win_size_min_set(iwin->win, zone->w, h);
   ecore_evas_size_min_set(iwin->popup->ecore_evas, zone->w, h);

   /* position and resize this window */
   e_win_move_resize(iwin->win, zone->x, zone->y, zone->w, h);
   e_popup_move_resize(iwin->popup, zone->x, zone->y, zone->w, h);

   /* show the window */
   e_win_show(iwin->win);
   e_popup_show(iwin->popup);

   /* set this window on proper zone */
   e_border_zone_set(iwin->win->border, zone);
   iwin->win->border->user_skip_winlist = 1;
   iwin->win->border->lock_focus_in = 1;
   iwin->win->border->lock_focus_out = 1;

   /* set this window to be a dock window. This needs to be done after show 
    * as E will sometimes reset the window type */
   ecore_x_netwm_window_type_set(iwin->win->evas_win, ECORE_X_WINDOW_TYPE_DOCK);

   /* tell conformant apps our position and size */
   ecore_x_e_illume_indicator_geometry_set(zone->black_win, zone->x, zone->y, 
                                           zone->w, h);

   return iwin;
}
Beispiel #20
0
/* Image: render() */
static Etk_Bool _image_render(Etk_Tree_Model *model, Etk_Tree_Row *row, Etk_Geometry geometry, void *cell_data, Evas_Object *cell_objects[ETK_TREE_MAX_OBJECTS_PER_MODEL], Evas *evas)
{
   Etk_Tree_Model_Image *image_model;
   Etk_Tree_Model_Image_Data *image_data;
   int image_width, image_height;
   Etk_Geometry image_geometry;
   Etk_Bool object_created = ETK_FALSE;
   float aspect;
   char *ext;

   if (!(image_model = (Etk_Tree_Model_Image *)model) || !(image_data = cell_data) || !evas)
      return ETK_FALSE;

   if (!image_data->filename || image_data->type == ETK_TREE_MODEL_NOT_FOUND)
      return ETK_FALSE;

   /* If we don't know yet what the image's type is, we "guess" it */
   if (image_data->type == ETK_TREE_MODEL_UNKNOWN_YET)
   {
      if (!image_data->key)
         image_data->type = ETK_TREE_MODEL_NORMAL;
      else if ((ext = strrchr(image_data->filename, '.')) && strcasecmp(ext + 1, "eet") == 0)
         image_data->type = ETK_TREE_MODEL_NORMAL;
      else
         image_data->type = ETK_TREE_MODEL_EDJE;
   }

   /* If the object is not already in the cache, we load it */
   if (!(cell_objects[0] = etk_cache_find(image_model->cache, image_data->filename, image_data->key)))
   {
      if (image_data->type == ETK_TREE_MODEL_NORMAL)
      {
         cell_objects[0] = evas_object_image_add(evas);
         evas_object_pass_events_set(cell_objects[0], 1);

         evas_object_image_file_set(cell_objects[0], image_data->filename, image_data->key);
         if (!evas_object_image_load_error_get(cell_objects[0]))
            object_created = ETK_TRUE;
         else
            image_data->type = ETK_TREE_MODEL_NOT_FOUND;
      }
      /* If it's not a normal image file, then it's an Edje file... */
      else
      {
         cell_objects[0] = edje_object_add(evas);
         evas_object_pass_events_set(cell_objects[0], 1);

         if (edje_object_file_set(cell_objects[0], image_data->filename, image_data->key))
            object_created = ETK_TRUE;
         else
            image_data->type = ETK_TREE_MODEL_NOT_FOUND;
      }
   }

   /* If loading the image has failed, we destroy the object and return */
   if (image_data->type == ETK_TREE_MODEL_NOT_FOUND)
   {
      if (cell_objects[0])
      {
         evas_object_del(cell_objects[0]);
         cell_objects[0] = NULL;
      }
      return ETK_FALSE;
   }

   /* The image is correctly loaded, we can now render it */
   if (image_data->type == ETK_TREE_MODEL_NORMAL)
      evas_object_image_size_get(cell_objects[0], &image_width, &image_height);
   else
      edje_object_size_min_get(cell_objects[0], &image_width, &image_height);

   if (image_width == 0 || image_height == 0)
   {
      image_width = geometry.h;
      image_height = geometry.h;
   }
   aspect = ((float)image_width / image_height);

   /* No limitation of width */
   if (image_model->width <= 0)
   {
      if (image_height <= geometry.h)
      {
         image_geometry.w = image_width;
         image_geometry.h = image_height;
      }
      else
      {
         image_geometry.w = geometry.h * aspect;
         image_geometry.h = geometry.h;
      }

      image_geometry.x = geometry.x;
      image_geometry.y = geometry.y + ((geometry.h - image_geometry.h) / 2);
   }
   /* The max width is limited */
   else
   {
      if ((image_width > image_model->width || image_height > geometry.h))
      {
         /* The image doesn't fit in, we need to resize it */

         if (geometry.h * aspect > image_model->width)
         {
            image_geometry.w = image_model->width;
            image_geometry.h = image_model->width / aspect;
         }
         else
         {
            image_geometry.w = geometry.h * aspect;
            image_geometry.h = geometry.h;
         }
      }
      else
      {
         image_geometry.w = image_width;
         image_geometry.h = image_height;
      }

      image_geometry.x = geometry.x + ((image_model->width - image_geometry.w) * image_model->halign);
      image_geometry.y = geometry.y + ((geometry.h - image_geometry.h) / 2);
   }

   if (image_data->type == ETK_TREE_MODEL_NORMAL)
      evas_object_image_fill_set(cell_objects[0], 0, 0, image_geometry.w, image_geometry.h);
   evas_object_move(cell_objects[0], image_geometry.x, image_geometry.y);
   evas_object_resize(cell_objects[0], image_geometry.w, image_geometry.h);
   evas_object_show(cell_objects[0]);

   return object_created;
}
Beispiel #21
0
void
setup_cc_with_pos(int x, int y)
{
	ControlCentre  *cc;
	char           *edjefn = malloc(PATH_MAX);
	char           *fontpath = malloc(PATH_MAX);
	Evas_Coord      edje_w, edje_h;
	CCPos          *pos;

	cc = malloc(sizeof(ControlCentre));
	controlcentre = cc;

	pos = get_cc_pos();

	if (x >= 0 || y >= 0) {
		pos->x = x;
		pos->y = y;
	}

	/* Setup the Window */
	if (!strcmp(main_config->render_method, "gl")) {
#ifdef HAVE_ECORE_EVAS_GL
		cc->win =
			ecore_evas_gl_x11_new(NULL, 0, pos->x, pos->y,
					      pos->width, pos->height);
#else
		dml("GL not in Ecore_Evas module.  Falling back on software!",
		    1);
		free(main_config->render_method);
		main_config->render_method = strdup("software");
		cc->win =
			ecore_evas_software_x11_new(NULL, 0, pos->x, pos->y,
						    pos->width, pos->height);
#endif
	} else
		cc->win =
			ecore_evas_software_x11_new(NULL, 0, pos->x, pos->y,
						    pos->width, pos->height);

	ecore_evas_title_set(cc->win, "Enotes");
	ecore_evas_name_class_set(cc->win, "Enotes", "Enotes");

	if (main_config->ontop == 1)
		ecore_evas_layer_set(cc->win, 7);
	else
		ecore_evas_layer_set(cc->win, 2);

	if (main_config->sticky == 1)
		ecore_evas_sticky_set(cc->win, 1);
	else
		ecore_evas_sticky_set(cc->win, 0);

	ecore_evas_borderless_set(cc->win, 1);
	ecore_evas_shaped_set(cc->win, 1);
	if (pos->x != 0 && pos->y != 0)
		ecore_evas_resize(cc->win, pos->x, pos->y);
	ecore_evas_show(cc->win);

//      if(main_config->ontop==1)

	/* Moving the damn thing */
	ecore_evas_move(cc->win, pos->x, pos->y);

	/* Setup the Canvas, Render-Method and Font Path */
	cc->evas = ecore_evas_get(cc->win);
	evas_output_method_set(cc->evas,
			       evas_render_method_lookup(main_config->
							 render_method));
	snprintf(fontpath, PATH_MAX, "%s/fonts", PACKAGE_DATA_DIR);
	evas_font_path_append(cc->evas, fontpath);
	free(fontpath);

	/* Draggable Setup */
	cc->dragger = esmart_draggies_new(cc->win);
	evas_object_name_set(cc->dragger, "dragger");
	evas_object_move(cc->dragger, 0, 0);
	evas_object_layer_set(cc->dragger, 0);
	evas_object_color_set(cc->dragger, 255, 255, 255, 0);
	esmart_draggies_button_set(cc->dragger, 1);
	evas_object_show(cc->dragger);

	/* Setup the EDJE */
	cc->edje = edje_object_add(cc->evas);
	snprintf(edjefn, PATH_MAX, CC_EDJE, PACKAGE_DATA_DIR,
		 main_config->theme);
	edje_object_file_set(cc->edje, edjefn, CC_PART);
	free(edjefn);
	evas_object_move(cc->edje, 0, 0);
	evas_object_layer_set(cc->edje, 1);
	evas_object_name_set(cc->edje, "edje");
	evas_object_pass_events_set(cc->edje, 0);
	evas_object_show(cc->edje);
	if (pos->shaded)
		edje_object_signal_emit(cc->edje, EDJE_SIGNAL_CC_SHADE "_GO",
					"");
	else
		edje_object_signal_emit(cc->edje, EDJE_SIGNAL_CC_UNSHADE "_GO",
					"");

	/* EDJE and ECORE min, max and resizing */
	edje_object_size_max_get(cc->edje, &edje_w, &edje_h);
	ecore_evas_size_max_set(cc->win, edje_w, edje_h);
	edje_object_size_min_get(cc->edje, &edje_w, &edje_h);
	ecore_evas_size_min_set(cc->win, edje_w, edje_h);
	ecore_evas_resize(cc->win, (int) edje_w, (int) edje_h);
	evas_object_resize(cc->edje, edje_w, edje_h);
	evas_object_resize(cc->dragger, edje_w, edje_h);

	/* Ecore Callbacks */
	ecore_evas_callback_resize_set(cc->win, cc_resize);
	ecore_evas_callback_destroy_set(cc->win, cc_close_win);
	ecore_evas_callback_delete_request_set(cc->win, cc_close_win);

	/* Edje Callbacks */
	edje_object_signal_callback_add(cc->edje,
					EDJE_SIGNAL_CC_MINIMIZE, "",
					(void *) cc_minimize, cc->win);
	edje_object_signal_callback_add(cc->edje, EDJE_SIGNAL_CC_CLOSE, "",
					(void *) cc_close, NULL);
	edje_object_signal_callback_add(cc->edje, EDJE_SIGNAL_CC_SAVELOAD, "",
					(void *) cc_saveload, NULL);
	edje_object_signal_callback_add(cc->edje, EDJE_SIGNAL_CC_SETTINGS, "",
					(void *) cc_settings, NULL);
	edje_object_signal_callback_add(cc->edje, EDJE_SIGNAL_CC_NEW, "",
					(void *) cc_newnote, NULL);
	edje_object_signal_callback_add(cc->edje, EDJE_SIGNAL_CC_SHADE, "",
					(void *) cc_shade, NULL);
	edje_object_signal_callback_add(cc->edje, EDJE_SIGNAL_CC_UNSHADE, "",
					(void *) cc_unshade, NULL);

	free(pos);
	return;
}
Beispiel #22
0
int
elicit_theme_set(Elicit *el, const char *theme)
{
  const char *path;
  int w, h;

  if (!theme) theme = "default";
  /* first check if full path is given */
  if (theme[0] == '/')
  {
    if (!edje_file_group_exists(theme, "elicit.main"))
      return 0;
    path = theme;
  }
  else
    path = elicit_theme_find(el, theme);

  if (!path) {
    fprintf(stderr, "[Elicit] Warning: theme \"%s\" not found, falling back to default.\n", theme);
    theme = "default";
    path = elicit_theme_find(el, theme);
  }

  if (!path)
  {
    fprintf(stderr, "[Elicit] Error: theme \"%s\" not found.\n", theme);
    return 0;
  }

  if (el->path.theme) free(el->path.theme);
  el->path.theme = strdup(path);

  if (el->conf.theme != theme)
  {
    if (el->conf.theme) free(el->conf.theme);
    el->conf.theme = strdup(theme);
  }

  elicit_theme_unswallow_objs(el);

  edje_object_file_set(el->obj.main, path, "elicit.main");

  edje_object_size_min_get(el->obj.main, &w, &h);
  if (w > el->conf.w) el->conf.w = w;
  if (h > el->conf.h) el->conf.h = h;
  ecore_evas_size_min_set(el->ee, w, h);
  ecore_evas_resize(el->ee, el->conf.w, el->conf.h);

  evas_object_move(el->obj.main, 0, 0);
  evas_object_resize(el->obj.main, el->conf.w, el->conf.h);
  evas_object_show(el->obj.main);

  elicit_theme_swallow_objs(el);

  edje_object_signal_callback_add(el->obj.main, "elicit,*", "*", cb_edje_signal, el);
  edje_object_signal_callback_add(el->obj.main, "mouse,move", "*", cb_edje_move, el);

  color_changed(el->color);

  /* emit signals to set theme state */
  if (el->conf.grid_visible)
    edje_object_signal_emit(el->obj.main, "elicit,grid,on", "elicit");
  else
    edje_object_signal_emit(el->obj.main, "elicit,grid,off", "elicit");

  if (el->conf.show_band)
    edje_object_signal_emit(el->obj.main, "elicit,band,on", "elicit");
  else
    edje_object_signal_emit(el->obj.main, "elicit,band,off", "elicit");

  return 1;
}
Beispiel #23
0
int elitaire_object_file_set(Evas_Object * elitaire, const char * file)
{
    int i, number;
    Evas_Object * card;
    Elitaire * eli;
    vector<stackLook>::const_iterator iord, iend;
    Eina_Bool change_file;
    card_iterator it, it_end;
    int num_decks;

    eli = (Elitaire *) evas_object_smart_data_get(elitaire);
    if (!eli) return 0;

    /* for the stack images */
    iord = eli->game->getStackLooksBegin();
    iend = eli->game->getStackLooksEnd();

    if (eli->file) change_file = true;
    else change_file = false;

    if (eli->file) {
        free(eli->file);
        eli->file = NULL;
    }

    if (!file) return 0;
    else eli->file = strdup(file);

    /* get the maximal and minimal size of the cards via edje */
    /* I expect that every card in the game has the same size */
    card = edje_object_add(eli->evas);
    if (!edje_object_file_set(card, eli->file, "elitaire/card/00")) return 0;
        
    edje_object_size_max_get(card, &eli->card_max_w, &eli->card_max_h);
    edje_object_size_min_get(card, &eli->card_min_w, &eli->card_min_h);
    evas_object_del(card);

    /*connect the playingCards with elitaire_cards and set the callbacks */
    if (change_file) elitaire_cards_del(eli);

    num_decks = eli->game->getNumDecks();

    for (i = 0; i < num_decks; i++) {
        it = eli->game->getDeckBegin(i);
        it_end = eli->game->getDeckEnd(i);

        while (it != it_end) {
            card = elitaire_card_new(eli, *it);
            evas_object_smart_member_add(card, elitaire);
            evas_object_clip_set(card, eli->clip);
            evas_object_show(card);
            (*it)->data = (void *) card;
            elitaire_card_callback_add(card, EVAS_CALLBACK_MOUSE_DOWN,
                                       elitaire_mouse_down_cb);
            elitaire_card_callback_add(card, EVAS_CALLBACK_MOUSE_UP,
                                       elitaire_mouse_up_cb);
            //evas_object_layer_set(card, 1);
            if (evas_alloc_error() != EVAS_ALLOC_ERROR_NONE) {
                fprintf(stderr,
                        _("Elitaire Error: Callback registering failed!\n"));
                return 0;
            }
            it++;
        }
    }

    /* give the stacks an pic */
    if (change_file)
        elitaire_stacks_del(eli);

    eli->stacks =
        (Evas_Object **) calloc(eli->num_stacks, sizeof(Elitaire*));
    number = 0;

    while (iord != iend) {
        switch (*iord) {
        case STACK:
        case LAST:
            eli->stacks[number] = edje_object_add(eli->evas);
            evas_object_smart_member_add(eli->stacks[number], elitaire);
            edje_object_file_set(eli->stacks[number], eli->file, "elitaire/stack/last");
            evas_object_event_callback_add(eli->stacks[number],
                                           EVAS_CALLBACK_MOUSE_UP,
                                           _elitaire_stack_mouse_up_cb, eli);
            evas_object_show(eli->stacks[number]);
            evas_object_lower(eli->stacks[number]);
            number++;
            break;

        case ALL:
            eli->stacks[number] = edje_object_add(eli->evas);
            evas_object_smart_member_add(eli->stacks[number], elitaire);
            edje_object_file_set(eli->stacks[number], eli->file, "elitaire/stack/all");
            evas_object_event_callback_add(eli->stacks[number],
                                           EVAS_CALLBACK_MOUSE_UP,
                                           _elitaire_stack_mouse_up_cb, eli);
            evas_object_show(eli->stacks[number]);
            evas_object_lower(eli->stacks[number]);
            number++;
            break;
        
        default:
            break;
        }
        iord++;
    }

    if (change_file) {
        elitaire_force_resize(eli);
        elitaire_reinit(eli);
    }
    return 1;
}
Beispiel #24
0
int
main(int argc, char *argv[])
{
    app_t app;
    int i;
    Evas_Object *o;

    ecore_init();
    ecore_app_args_set(argc, (const char **)argv);
    ecore_evas_init();
    edje_init();

    edje_frametime_set(1.0 / 30.0);

    memset(&app, 0, sizeof(app));

    app.ee = ecore_evas_software_x11_new(NULL, 0,  0, 0, WIDTH, HEIGHT);
    ecore_evas_data_set(app.ee, "app", &app);
    ecore_evas_title_set(app.ee, TITLE);
    ecore_evas_name_class_set(app.ee, WM_NAME, WM_CLASS);
    app.theme = THEME;

    for (i=1; i < argc; i++)
        if (strcmp (argv[i], "-fs") == 0)
            ecore_evas_fullscreen_set(app.ee, 1);
        else if (strncmp (argv[i], "-theme=", sizeof("-theme=") - 1) == 0)
            app.theme = argv[i] + sizeof("-theme=") - 1;
        else if (argv[i][0] != '-')
            app.infile = argv[i];

    app.evas = ecore_evas_get(app.ee);

    app.edje_main = edje_object_add(app.evas);
    evas_data_attach_set(app.evas, &app);
    if (!edje_object_file_set(app.edje_main, app.theme, THEME_GROUP)) {
        fprintf(stderr, "Failed to load file \"%s\", part \"%s\".\n",
                app.theme, THEME_GROUP);
        return 1;
    }


    evas_object_move(app.edje_main, 0, 0);
    evas_object_resize(app.edje_main, WIDTH, HEIGHT);

    app.e_box = e_box_add(app.evas);
    e_box_orientation_set(app.e_box, 0);
    e_box_homogenous_set(app.e_box, 0);
    e_box_align_set(app.e_box, 0.0, 0.5);

    edje_object_part_swallow(app.edje_main, "contents_swallow", app.e_box);

    evas_object_show(app.edje_main);
    evas_object_show(app.e_box);
    ecore_evas_show(app.ee);

    _populate(&app);
    app.scroll.initial_delay_ms = 750;
    app.scroll.accel_ms = 600;
    setup_gui_list(&app);

    ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, app_signal_exit, NULL);
    ecore_evas_callback_resize_set(app.ee, resize_cb);

    evas_object_event_callback_add(app.edje_main, EVAS_CALLBACK_KEY_DOWN,
                                   key_down, &app);

    evas_object_focus_set(app.edje_main, 1);

    o = edje_object_part_object_get(app.edje_main, "back_button");
    evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
                                   mouse_down_back_button,
                                   &app);

    ecore_main_loop_begin();

    return 0;
}
Beispiel #25
0
int
main(int argc, char *argv[])
{
    app_t app;
    int i;
    char *engine = "x11-16";

    ecore_init();
    ecore_app_args_set(argc, (const char **)argv);
    ecore_evas_init();
    edje_init();

    edje_frametime_set(1.0 / 30.0);

    memset(&app, 0, sizeof(app));

    app.theme = THEME;
    app.fs = 1;
    app.total_ms = 1000;
    app.fade_in = 1;

    for (i=1; i < argc; i++)
        if (strcmp (argv[i], "-fs") == 0)
            ecore_evas_fullscreen_set(app.ee, 1);
        else if (strncmp (argv[i], "-theme=", sizeof("-theme=") - 1) == 0)
            app.theme = argv[i] + sizeof("-theme=") - 1;
        else if (strncmp (argv[i], "-time=", sizeof("-time=") - 1) == 0)
            app.total_ms = atoi(argv[i] + sizeof("-time=") - 1);
        else if (strncmp (argv[i], "-engine=", sizeof("-engine=") - 1) == 0)
            engine = argv[i] + sizeof("-engine=") - 1;

    if (app.total_ms < 1)
        app.total_ms = 1000;

    app.ee = init_ecore_evas(engine);
    if (!app.ee) {
        fprintf(stderr, "Could not init engine '%s'.\n", engine);
        return 1;
    }
    ecore_evas_data_set(app.ee, "app", &app);
    ecore_evas_title_set(app.ee, TITLE);
    ecore_evas_name_class_set(app.ee, WM_NAME, WM_CLASS);
    ecore_evas_fullscreen_set(app.ee, app.fs);

    fprintf(stderr, "time to fade: %dms\n", app.total_ms);

    app.evas = ecore_evas_get(app.ee);

    app.edje_main = edje_object_add(app.evas);
    evas_data_attach_set(app.evas, &app);
    if (!edje_object_file_set(app.edje_main, app.theme, THEME_GROUP)) {
        fprintf(stderr, "Failed to load file \"%s\", part \"%s\".\n",
                app.theme, THEME_GROUP);
        return 1;
    }

    app.obj = edje_object_part_object_get(app.edje_main, "obj");

    evas_object_move(app.edje_main, 0, 0);
    evas_object_resize(app.edje_main, WIDTH, HEIGHT);

    evas_object_show(app.edje_main);
    ecore_evas_show(app.ee);

    ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, app_signal_exit, NULL);
    ecore_evas_callback_resize_set(app.ee, resize_cb);

    evas_object_event_callback_add(app.edje_main, EVAS_CALLBACK_KEY_DOWN,
                                   key_down, &app);
    evas_object_focus_set(app.edje_main, 1);

    gettimeofday(&app.start, NULL);
    app.anim = ecore_animator_add(do_anim, &app);

    ecore_main_loop_begin();

    return 0;
}
Beispiel #26
0
void utils_slide_delete(List_Item *item)
{
    int i = 0;
    Eina_List *l;
    List_Item *_item;

    EINA_LIST_FOREACH(l_slides, l, _item)
    {
        if(item == _item)
            break;
        else
            i++;
    }


    Evas_Object *lbl, *tb, *bt, *icon;
    char buf[PATH_MAX];
    snprintf(buf, sizeof(buf), "%s/theme.edj", PACKAGE_DATA_DIR);

    _inwin_delete_slide = elm_win_inwin_add(win);
    evas_object_show(_inwin_delete_slide);
    elm_object_style_set(_inwin_delete_slide, "minimal");

    tb = elm_table_add(win);
    elm_win_inwin_content_set(_inwin_delete_slide, tb);

    //icon
    icon = edje_object_add(evas_object_evas_get(win));
    edje_object_file_set(icon, buf, "list/slides/icon");

    evas_object_size_hint_min_set(icon,1024*0.20,768*0.20);
    evas_object_size_hint_max_set(icon,1024*0.20,768*0.20);

    if(item->thumb)
    {
        int w = item->thumb->w;
        int h = item->thumb->h;
        int *image = calloc(w*h, sizeof(int));
        memcpy(image, item->thumb->thumb, sizeof(int)*w*h);

        const Evas_Object *o_image = edje_object_part_object_get(icon, "object.icon");
        evas_object_image_filled_set((Evas_Object*)o_image,1);
        evas_object_color_set((Evas_Object*)o_image,255,255,255,255);
        evas_object_image_size_set((Evas_Object*)o_image, w, h);
        evas_object_image_data_set((Evas_Object*)o_image, image);

        edje_object_signal_emit(icon, "icon,show", "eyelight");
    }
    evas_object_show(icon);
    elm_table_pack(tb, icon, 0, 0, 2, 1);
    //

    bt= elm_button_add(win);
    elm_object_text_set(bt, "Invisible button to add a vertical space");
    elm_table_pack(tb, bt, 0, 1, 1, 1);

    lbl = elm_label_add(win);
    elm_object_text_set(lbl, D_("Are you sure you want to delete this slide ?"));
    elm_table_pack(tb, lbl, 0, 2, 2, 1);
    evas_object_show(lbl);

    bt= elm_button_add(win);
    elm_object_text_set(bt, "Invisible button to add a vertical space");
    elm_table_pack(tb, bt, 0, 3, 1, 1);

    bt= elm_button_add(win);
    elm_object_text_set(bt, D_("Yes, Delete the slide"));
    evas_object_smart_callback_add(bt, "clicked", _utils_slide_delete_cb, item);
    evas_object_color_set(bt, 255, 0, 0, 255);
    elm_table_pack(tb, bt, 0, 4, 1, 1);
    evas_object_show(bt);

    bt= elm_button_add(win);
    elm_object_text_set(bt, D_("No, do not delete the slide"));
    evas_object_smart_callback_add(bt, "clicked", _utils_slide_delete_cancel_cb, item);
    elm_table_pack(tb, bt, 1, 4, 1, 1);
    evas_object_show(bt);
}
Beispiel #27
0
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;
}
static Evas_Object *
_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
{
   Evas_Object *o, *ob, *ol;
   Population *pop;

   pop = cfd->data;
   o = e_widget_list_add(evas, 0, 0);

   ob = e_widget_label_add(evas, D_("Number of penguins:"));
   e_widget_list_object_append(o, ob, 1, 1, 0.5);
   ob = e_widget_slider_add(evas, 1, 0, D_("%1.0f"), 1, 200, 1, 0, NULL, &(cfdata->penguins_count), 200);
   e_widget_list_object_append(o, ob, 1, 1, 0.5);

   ob = e_widget_label_add(evas, D_("Zoom factor:"));
   e_widget_list_object_append(o, ob, 1, 1, 0.5);
   ob = e_widget_slider_add(evas, 1, 0, D_("%1.1f X"), 0.2, 3, 0.2, 0, &(cfdata->zoom), NULL, 200);
   e_widget_list_object_append(o, ob, 1, 1, 0.5);

   ob = e_widget_label_add(evas, D_("Transparency:"));
   e_widget_list_object_append(o, ob, 1, 1, 0.5);
   ob = e_widget_slider_add(evas, 1, 0, D_("%1.0f"), 50, 255, 1, 0, NULL, &(cfdata->alpha), 200);
   e_widget_list_object_append(o, ob, 1, 1, 0.5);

   //Lista
   ob = e_widget_label_add(evas, D_("Select population:"));
   e_widget_list_object_append(o, ob, 1, 1, 0.5);
   ol = e_widget_ilist_add(evas, 24, 24, &(cfdata->theme));

   e_widget_ilist_clear(ol);

   Eina_List *l;
   int count;
   l = pop->themes;
   count = 0;
   while (l)
   {
      char *theme;
      char *name;
      Evas_Object *oi;
      theme = l->data;
      name = edje_file_data_get(theme, "PopulationName");
      if (name)
      {
         oi = edje_object_add(evas);
         edje_object_file_set(oi, theme, "icon");
         //printf("TEMA: %s (%s)\n", name, cfdata->theme);
         e_widget_ilist_append(ol, oi, name, NULL, theme, theme);
         if (strcmp(theme, cfdata->theme) == 0)
         {
            e_widget_ilist_selected_set(ol, count);
         }
         count++;
      }
      l = eina_list_next(l);
   }
   e_widget_ilist_go(ol);
   e_widget_size_min_set(ol, 155, 250);
   e_widget_list_object_append(o, ol, 1, 1, 0.5);

   return o;
}
Beispiel #29
0
//Create a new menu item of type "item_type"
//This item will be automatically freed by calling eclair_menu_free on the parent menu
//Return NULL if failed
Eclair_Menu_Item *eclair_menu_item_new(const char *label, Eclair_Menu *parent, Eclair_Menu_Item_Type item_type, const char *icon_path)
{
   Eclair_Menu_Item *item;
   int result;

   if (!parent)
      return NULL;

   item = calloc(1, sizeof(Eclair_Menu_Item));
   item->type = item_type;

   //We load the edje object of the item
   item->edje_object = edje_object_add(parent->evas);
   if (item->type == ECLAIR_MENU_ITEM_SEPARATOR_ITEM)
      result = edje_object_file_set(item->edje_object, ECLAIR_WIDGETS_THEME, "eclair_menu_separator");
   else
      result = edje_object_file_set(item->edje_object, ECLAIR_WIDGETS_THEME, "eclair_menu_item");
   if (!result)
   {
      evas_object_del(item->edje_object);
      item->edje_object = NULL;
      return 0;
   }
   evas_object_event_callback_add(item->edje_object, EVAS_CALLBACK_MOUSE_IN, _eclair_menu_item_in_cb, item);
   evas_object_event_callback_add(item->edje_object, EVAS_CALLBACK_MOUSE_OUT, _eclair_menu_item_out_cb, item);
   evas_object_event_callback_add(item->edje_object, EVAS_CALLBACK_MOUSE_UP, _eclair_menu_item_up_cb, item);
   evas_object_show(item->edje_object);

   //We load the icon
   if (item->type == ECLAIR_MENU_ITEM_ICON_ITEM)
   {
      char *icon_size_str;
      int icon_size;

      item->icon_object = evas_object_image_add(parent->evas);
      evas_object_image_file_set(item->icon_object, icon_path, NULL);
      if (evas_object_image_load_error_get(item->icon_object))
      {
         evas_object_del(item->icon_object);
         item->icon_object = NULL;
         item->type = ECLAIR_MENU_ITEM_NORMAL_ITEM;
      }
      else
      {
         if ((icon_size_str = edje_file_data_get(ECLAIR_WIDGETS_THEME, "icon_size")))
         {
            icon_size = atoi(icon_size_str);
            evas_object_image_fill_set(item->icon_object, 0, 0, icon_size, icon_size);
            free(icon_size_str);
         }
         else
            evas_object_image_fill_set(item->icon_object, 0, 0, 16, 16);
         edje_object_part_swallow(item->edje_object, "icon", item->icon_object);
         evas_object_pass_events_set(item->icon_object, 1);
         evas_object_show(item->edje_object);
      }
   }

   eclair_menu_append_item(parent, item);

   if (item->type != ECLAIR_MENU_ITEM_SEPARATOR_ITEM)
      eclair_menu_item_label_set(item, label);

   return item;
}