EAPI void
e_widget_button_icon_set(Evas_Object *obj, Evas_Object *icon)
{
   E_Widget_Data *wd;
   int mw, mh;

   wd = e_widget_data_get(obj);
   if (wd->o_icon)
     {
	e_widget_sub_object_del(obj, wd->o_icon);
	evas_object_hide(wd->o_icon);
	edje_object_part_unswallow(wd->o_button, wd->o_icon);
	evas_object_del(wd->o_icon);
	wd->o_icon = NULL;
     }
   if (icon)
     {
	wd->o_icon = icon;
	edje_object_part_swallow(wd->o_button, "e.swallow.icon", icon);
	evas_object_pass_events_set(icon, 1);
	evas_object_show(icon);
	e_widget_sub_object_add(obj, icon);
	wd->type |= E_WIDGET_BUTTON_ICON;
     }
   else
     wd->type = ~(wd->type & E_WIDGET_BUTTON_ICON);
   _e_wid_button_state_send(wd);
   edje_object_size_min_calc(wd->o_button, &mw, &mh);
   e_widget_size_min_set(obj, mw, mh);
}
Beispiel #2
0
/* Text: objects_create() */
static void _text_objects_create(Etk_Tree_Model *model, Evas_Object *cell_objects[ETK_TREE_MAX_OBJECTS_PER_MODEL], Evas *evas)
{
   if (!evas)
      return;

   cell_objects[0] = edje_object_add(evas);
   etk_theme_edje_object_set_from_parent(cell_objects[0], "text", ETK_WIDGET(model->tree));
   evas_object_pass_events_set(cell_objects[0], 1);
}
Beispiel #3
0
static void
_ecore_evas_buffer_ignore_events_set(Ecore_Evas *ee, int val)
{
   Ecore_Evas_Engine_Buffer_Data *bdata = ee->engine.data;

   if (ee->ignore_events == val) return;
   ee->ignore_events = val;
   if (bdata->image)
     evas_object_pass_events_set(bdata->image, val);
}
Beispiel #4
0
/** ghost line **/
void
ghost_line_create(void)
{
    Evas               *e;

    e = shell->evas;
    if (!o_line)
      {
          o_line = evas_object_line_add(e);
          evas_object_color_set(o_line, ALPHA2, ALPHA2/5, ALPHA2/5, ALPHA2);
          evas_object_layer_set(o_line, 17);
          evas_object_pass_events_set(o_line, 1);
      }
}
Beispiel #5
0
E_API void
e_drag_object_set(E_Drag *drag, Evas_Object *object)
{
   EINA_SAFETY_ON_NULL_RETURN(object);
   EINA_SAFETY_ON_TRUE_RETURN(!!drag->object);
   if (drag->visible)
     evas_object_show(object);
   else
     evas_object_hide(object);
   drag->object = object;
   drag->comp_object = e_comp_object_util_add(object, E_COMP_OBJECT_TYPE_NONE);
   evas_object_layer_set(drag->comp_object, drag->layer);
   evas_object_name_set(drag->comp_object, "E Drag");
   evas_object_pass_events_set(drag->comp_object, 1);
}
Beispiel #6
0
void
itask_item_set_icon(Itask_Item *ic)
{
   if (ic->o_icon) evas_object_del(ic->o_icon);

   ic->o_icon = e_border_icon_add(ic->border, evas_object_evas_get(ic->itask->o_box));
   edje_object_part_swallow(ic->o_holder, "e.swallow.icon", ic->o_icon);
   evas_object_pass_events_set(ic->o_icon, 1);
   evas_object_show(ic->o_icon);

   if (ic->border->iconic)
     itask_icon_signal_emit(ic, "iconify");
   if (ic->border->focused)
     itask_icon_signal_emit(ic, "focused");

}
Beispiel #7
0
bool ui_init_edje(ePlayer *player, const char *name) {
	double edje_w = 0, edje_h = 0;

	debug(DEBUG_LEVEL_INFO, "EDJE: Defining Edje \n");

	if (!(player->gui.edje = edje_object_add(player->gui.evas))) {
		debug(DEBUG_LEVEL_CRITICAL, "Cannot create Edje!\n");
		return false;
	}

	evas_object_name_set(player->gui.edje, "main_edje");

	if (!edje_object_file_set(player->gui.edje,
	                          find_theme(player->cfg.theme),
	                          name)) {
		debug(DEBUG_LEVEL_CRITICAL, "Cannot load theme '%s'!\n",
		      player->cfg.theme);
		return false;
	}
	
	evas_object_move(player->gui.edje, 0, 0);
	evas_object_pass_events_set (player->gui.edje, 1);
	evas_object_show(player->gui.edje);

	/* set max size */
	edje_object_size_max_get(player->gui.edje, &edje_w, &edje_h);
	ecore_evas_size_max_set(player->gui.ee, edje_w, edje_h);

	/* set min size */
	edje_object_size_min_get(player->gui.edje, &edje_w, &edje_h);
	ecore_evas_size_min_set(player->gui.ee, edje_w, edje_h);
	
	/* resize to the min size */
	ecore_evas_resize(player->gui.ee, (int) edje_w, (int) edje_h);
	
	setup_playlist(player);
	ui_refresh_volume(player);

	register_callbacks(player);

	return true;
}
Beispiel #8
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;
}
static void
_e_editable_smart_add(Evas_Object *object)
{
   Evas *evas;
   E_Editable_Smart_Data *sd;
   Evas_Coord ox, oy;

   if ((!object) || !(evas = evas_object_evas_get(object)))
     return;

   sd = malloc(sizeof(E_Editable_Smart_Data));
   if (!sd) return;

   _e_editable_smart_use++;
   evas_object_smart_data_set(object, sd);
   evas_object_geometry_get(object, &ox, &oy, NULL, NULL);

   sd->text = malloc((E_EDITABLE_BLOCK_SIZE + 1) * sizeof(char));
   sd->text[0] = '\0';
   sd->char_length = 0;
   sd->unicode_length = 0;
   sd->allocated_length = E_EDITABLE_BLOCK_SIZE;

   sd->cursor_width = 1;
   sd->selection_on_fg = 0;
   sd->average_char_w = -1;
   sd->average_char_h = -1;

   sd->cursor_pos = 0;
   sd->cursor_visible = 1;
   sd->selection_pos = 0;
   sd->selection_visible = 1;
   sd->password_mode = 0;

   sd->clip_object = evas_object_rectangle_add(evas);
   evas_object_move(sd->clip_object, ox, oy);
   evas_object_smart_member_add(sd->clip_object, object);

   sd->event_object = evas_object_rectangle_add(evas);
   evas_object_color_set(sd->event_object, 0, 0, 0, 0);
   evas_object_clip_set(sd->event_object, sd->clip_object);
   evas_object_move(sd->event_object, ox, oy);
   evas_object_smart_member_add(sd->event_object, object);

   sd->text_object = edje_object_add(evas);
   evas_object_pass_events_set(sd->text_object, 1);
   evas_object_clip_set(sd->text_object, sd->clip_object);
   evas_object_move(sd->text_object, ox, oy);
   evas_object_smart_member_add(sd->text_object, object);

   sd->selection_object = edje_object_add(evas);
   evas_object_pass_events_set(sd->selection_object, 1);
   evas_object_clip_set(sd->selection_object, sd->clip_object);
   evas_object_move(sd->selection_object, ox, oy);
   evas_object_smart_member_add(sd->selection_object, object);

   sd->cursor_object = edje_object_add(evas);
   evas_object_pass_events_set(sd->cursor_object, 1);
   evas_object_clip_set(sd->cursor_object, sd->clip_object);
   evas_object_move(sd->cursor_object, ox, oy);
   evas_object_smart_member_add(sd->cursor_object, object);

   _e_editable_cursor_update(object);
}
void Object::setEventsPass (bool pass)
{
  evas_object_pass_events_set (o, pass);

}
Beispiel #11
0
int
main (int argc, char *argv[])
{
  Evas *evas = NULL;
  Ecore_Evas *ee = NULL;
  Ecore_X_Window win = 0;
  Evas_Object *o = NULL;
  Evas_Object *cont = NULL;
  Evas_Object *image = NULL;
  int iw, ih;

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

  ecore_event_handler_add (ECORE_EVENT_SIGNAL_EXIT, exit_cb, NULL);

  if (ecore_evas_init ())
    {
      ee = ecore_evas_software_x11_new (NULL, 0, 0, 0, 300, 120);
      win = ecore_evas_software_x11_window_get(ee);
      ecore_evas_title_set (ee, "Enlightenment Thumbnail Test");
      ecore_evas_callback_delete_request_set (ee, window_del_cb);
      ecore_evas_callback_resize_set (ee, window_resize_cb);
      ecore_evas_callback_move_set (ee, window_move_cb);

      evas = ecore_evas_get (ee);
      o = esmart_trans_x11_new (evas);
      esmart_trans_x11_type_set(o, Esmart_Trans_X11_Type_Background);
      esmart_trans_x11_window_set(o, win);
      evas_object_move (o, 0, 0);
      evas_object_resize (o, 300, 120);
      evas_object_layer_set (o, -5);
      evas_object_name_set (o, "root_background");
      evas_object_show (o);

      o = evas_object_rectangle_add (evas);
      evas_object_move (o, 0, 0);
      evas_object_resize (o, 300, 120);
      evas_object_layer_set (o, -6);
      evas_object_color_set (o, 255, 255, 255, 0);
      evas_object_name_set (o, "background");
      evas_object_show (o);

      o = esmart_draggies_new (ee);
      evas_object_move (o, 0, 0);
      evas_object_resize (o, 300, 120);
      evas_object_layer_set (o, 255);
      evas_object_color_set (o, 255, 255, 255, 0);
      evas_object_name_set (o, "dragger");
      esmart_draggies_button_set (o, 1);
      evas_object_show (o);


      if (argc < 2)
	{
	  image = evas_object_image_add (evas);
	  evas_object_image_file_set (image, PACKAGE_DATA_DIR "/esmart.png",
				      NULL);
	  evas_object_image_size_get (image, &iw, &ih);
	  evas_object_resize (image, iw, ih);
	  evas_object_image_fill_set (image, 0.0, 0.0, (Evas_Coord) iw,
				      (Evas_Coord) ih);
	  evas_object_layer_set (image, 1000);
	  evas_object_pass_events_set (image, 1);
	  evas_object_show (image);
	}


      cont = esmart_container_new (evas);
      evas_object_move (cont, 0, 0);
      evas_object_resize (cont, 300, 120);
      evas_object_layer_set (cont, 0);
      evas_object_name_set (cont, "container");
      evas_object_show (cont);
      esmart_container_padding_set (cont, 10, 10, 10, 10);
      esmart_container_spacing_set (cont, 5);
      esmart_container_fill_policy_set (cont,
				   CONTAINER_FILL_POLICY_FILL_Y |
				   CONTAINER_FILL_POLICY_KEEP_ASPECT);

      evas_object_event_callback_add (o, EVAS_CALLBACK_MOUSE_DOWN, bg_down_cb,
				      cont);
      evas_object_event_callback_add (o, EVAS_CALLBACK_MOUSE_UP, bg_up_cb,
				      cont);


      while (--argc)
	{
	  if ((o = esmart_thumb_new (ecore_evas_get (ee), argv[argc])))
	    {
	      evas_object_layer_set (o, 2);
	      evas_object_show (o);
	      esmart_container_element_append (cont, o);
	    }
	}
      evas_object_resize (cont, 300, 120);
      ecore_evas_show (ee);

      if (ecore_x_composite_query())
        {
           ee = ecore_evas_software_x11_new (NULL, 0, 0, 0, 320, 120);
           ecore_evas_title_set (ee, "Enlightenment Pixmap Test");
           ecore_evas_callback_delete_request_set (ee, window_del_cb);
           ecore_evas_callback_resize_set (ee, window_resize_cb);
           ecore_evas_callback_move_set (ee, window_move_cb);

           evas = ecore_evas_get (ee);
           o = esmart_xpixmap_new (evas, 0, win);
           evas_object_move (o, 0, 0);
           evas_object_resize (o, 320, 120);
           evas_object_layer_set (o, -5);
           evas_object_name_set (o, "xpixmap");
           evas_object_show (o);

           o = evas_object_rectangle_add (evas);
           evas_object_move (o, 0, 0);
           evas_object_resize (o, 150, 30);
           evas_object_layer_set (o, -3);
           evas_object_color_set (o, 50, 50, 50, 50);
           evas_object_name_set (o, "white_transparent_rect");
           evas_object_show (o);

           ecore_evas_show (ee);
        }

      ecore_main_loop_begin ();
    }
  return (0);
}
EINTERN Eina_Bool
e_mod_comp_pixmap_rotation_handler_message(Ecore_X_Event_Client_Message *ev)
{
   Ecore_X_Atom type;
   Ecore_X_Window win;
   E_Comp_Win *cw = NULL;
   Ecore_X_Damage dmg;
   Eina_Bool r;

   cw = e_mod_comp_border_client_find(ev->win);
   if (!cw)
     {
        cw = e_mod_comp_win_find(ev->win);
        E_CHECK_RETURN(cw, 0);
     }

   type = ev->message_type;
   win = ev->win;

   if (type == ATOM_CM_PIXMAP_ROTATION_BEGIN)
     {
        E_CHECK_RETURN((!cw->pixrot), 0);

        cw->pixrot = e_mod_comp_pixmap_rotation_new();
        E_CHECK_RETURN(cw->pixrot, 0);

        e_mod_comp_pixmap_rotation_state_set(cw->pixrot, 1);

        edje_object_part_unswallow(cw->shobj, cw->obj);
        _win_unredirect(cw);

        e_mod_comp_pixmap_rotation_done_send
           (win, ATOM_CM_PIXMAP_ROTATION_BEGIN_DONE);
     }
   else if (type == ATOM_CM_PIXMAP_ROTATION_END)
     {
        E_CHECK_RETURN(cw->pixrot, 0);
        e_mod_comp_effect_animating_set(cw->c, cw, EINA_FALSE);
        e_mod_comp_pixmap_rotation_handler_release(cw);
     }
   else if (type == ATOM_CM_PIXMAP_ROTATION_REQUEST)
     {
        E_CHECK_RETURN(cw->pixrot, 0);

        r = e_mod_comp_pixmap_rotation_state_get(cw->pixrot);
        E_CHECK_RETURN(r, 0);

        dmg = e_mod_comp_pixmap_rotation_damage_get(cw->pixrot);
        if (dmg) e_mod_comp_win_del_damage(cw, dmg);

        if (cw->obj)
          edje_object_part_unswallow(cw->shobj, cw->obj);
        else
          {
             E_CHECK_RETURN(cw->c, 0);
             cw->obj = evas_object_image_filled_add(cw->c->evas);
             evas_object_image_colorspace_set(cw->obj, EVAS_COLORSPACE_ARGB8888);

             if (cw->argb)
               evas_object_image_alpha_set(cw->obj, 1);
             else
               evas_object_image_alpha_set(cw->obj, 0);

             evas_object_show(cw->obj);
             evas_object_pass_events_set(cw->obj, 1);
          }

        r = e_mod_comp_pixmap_rotation_request
              (cw->pixrot, ev, cw->c->evas, cw->shobj,
              cw->obj, cw->vis, cw->w, cw->h);
        E_CHECK_RETURN(r, 0);

        e_mod_comp_update_resize(cw->up, cw->w, cw->h);
        e_mod_comp_update_add(cw->up, 0, 0, cw->w, cw->h);

        cw->native = 1;
        dmg = e_mod_comp_pixmap_rotation_damage_get(cw->pixrot);
        E_CHECK_RETURN(dmg, 0);
        e_mod_comp_win_add_damage(cw, dmg);
        e_mod_comp_pixmap_rotation_done_send
          (win, ATOM_CM_PIXMAP_ROTATION_REQUEST_DONE);
     }
   else
     return EINA_FALSE;

   return EINA_TRUE;
}
EINTERN Eina_Bool
e_mod_comp_pixmap_rotation_handler_configure(E_Comp_Win *cw,
                                             int w, int h)
{
   Ecore_X_Window win;
   E_CHECK_RETURN(cw, 0);
   E_CHECK_RETURN(cw->pixrot, 0);
   E_CHECK_RETURN(((w == cw->w) && (h == cw->h)), 0);

   win = e_mod_comp_util_client_xid_get(cw);

   /* backup below obj */
   Eina_Bool bottom = EINA_FALSE;

   Evas_Object *below_obj = evas_object_below_get(cw->shobj);
   if (!below_obj)
     {
        if (evas_object_bottom_get(cw->c->evas) == cw->shobj)
          {
             L(LT_EVENT_X,
               "[COMP] %31s w:0x%08x bd:%s shobj is bottom.\n",
               "PIX_ROT", e_mod_comp_util_client_xid_get(cw),
               cw->bd ? "O" : "X");
             bottom = EINA_TRUE;
          }
     }

   if (cw->obj)
     {
        evas_object_hide(cw->obj);
        evas_object_del(cw->obj);
        cw->obj = NULL;
     }
   if (cw->shobj)
     {
        evas_object_hide(cw->obj);
        evas_object_del(cw->shobj);
        cw->shobj = NULL;
     }

   cw->shobj = edje_object_add(cw->c->evas);
   cw->obj = evas_object_image_filled_add(cw->c->evas);
   evas_object_image_colorspace_set(cw->obj, EVAS_COLORSPACE_ARGB8888);

   if (cw->argb)
     evas_object_image_alpha_set(cw->obj, 1);
   else
     evas_object_image_alpha_set(cw->obj, 0);

   e_mod_comp_win_type_setup(cw);
   e_mod_comp_win_shadow_setup(cw);
   e_mod_comp_win_cb_setup(cw);

   evas_object_show(cw->obj);
   evas_object_pass_events_set(cw->obj, 1);
   evas_object_pass_events_set(cw->shobj, 1);

   /* restore stack */
   if (bottom)
     below_obj = evas_object_below_get(cw->shobj);

   evas_object_stack_above(cw->shobj, below_obj);
   L(LT_EVENT_X,
     "[COMP] %31s w:0x%08x bd:%s shobj restore stack.\n",
     "PIX_ROT", e_mod_comp_util_client_xid_get(cw),
     cw->bd ? "O" : "X");

   e_mod_comp_pixmap_rotation_done_send
     (win, ATOM_CM_PIXMAP_ROTATION_RESIZE_PIXMAP);

   return EINA_TRUE;
}
Beispiel #14
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 #15
0
void
_create_tiled_line(Line * line)
{
    int                 flag, sign = 1;
    Eina_List          *list = NULL, *l, *lo;
    Evas               *e;
    Evas_Object        *o;
    Drawing            *d;
    float               x, y, dx, dy, len;
    double              x1, y1, x2, y2;
    XY                 *xy;

    d = drawing;

    dx = line->x2 - line->x1;
    if (dx == 0)
        dx = 1e-40;             /* ok for 1200 dpi? */
    sign = fabs(dx) / dx;

    dy = line->y2 - line->y1;
    len = hypot(dx, dy);

    flag = linestyle_get_odd();

    list = linestyle_get_points(len, line->line_scale);
    ENGY_ASSERT(list);

    trans_rotate(list, atan(-dy / dx) + M_PI * (sign - 1) / 2);
    trans_move(list, line->x1, line->y1);

    e = shell->evas;

    lo = line->list;

    for (l = list->next; l; l = l->next)
      {
          XY                 *a, *b;

          a = (XY *) l->prev->data;
          b = (XY *) l->data;

          flag = !flag;

          if (flag)
            {
                if (!lo || !lo->data)
                  {
                      o = _line_item(e, line->thickness *
                                     shell->context.show_thickness * d->scale);
                      evas_object_layer_set(o, 10);
                      evas_object_pass_events_set(o, 1);
                      line->list = eina_list_append(line->list, o);
                      lo = eina_list_last(line->list);
                  }
                o = lo->data;
                lo = lo->next;
                x1 = w2s_x(a->x);
                y1 = w2s_y(a->y);
                x2 = w2s_x(b->x);
                y2 = w2s_y(b->y);
                if (line->flags & FLAG_VISIBLE)
                  {
                      evas_object_color_set(o,
			line->color.red*line->color.alpha/255,
			line->color.green*line->color.alpha/255,
			line->color.blue*line->color.alpha/255, 
			line->color.alpha);
                  }
                else
                  {
                      evas_object_color_set(o, 0, 0, 0, 0);
                  }

                if (line->flags & FLAG_SELECTED)
                    evas_object_color_set(o, 
				    ALPHA5, 
				    ALPHA5/5, 
				    ALPHA5/5, 
				    ALPHA5);
                if (line->flags & FLAG_DELETED)
                    evas_object_color_set(o, 0, 0, 0, 0);
                _line_item_xy(e, o, x1, y1, x2, y2,
                              line->thickness *
                              shell->context.show_thickness * d->scale);
                evas_object_show(o);
            }
      }

    for (l = list; l; l = l->next)
        FREE(l->data);
    list = eina_list_free(list);
}
Beispiel #16
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 #17
0
int
_edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *group, const char *parent, Eina_List *group_path)
{
   Edje *ed;
   Evas *tev;
   Edje_Real_Part *rp;
   Eina_List *textblocks = NULL;
   Eina_List *sources = NULL;
   Eina_List *externals = NULL;
   Eina_List *old_swallows;
   unsigned int n;
   Eina_List *parts = NULL;
   int group_path_started = 0;

   ed = _edje_fetch(obj);
   if (!ed) return 0;
   if (!file) file = "";
   if (!group) group = "";
   if (((ed->path) && (!strcmp(file, ed->path))) &&
       (ed->group) && (!strcmp(group, ed->group)))
     return 1;

   tev = evas_object_evas_get(obj);
   evas_event_freeze(tev);
   old_swallows = _edje_swallows_collect(ed);

   if (_edje_script_only(ed)) _edje_script_only_shutdown(ed);
   if (_edje_lua_script_only(ed)) _edje_lua_script_only_shutdown(ed);
   _edje_file_del(ed);

   eina_stringshare_replace(&ed->path, file);
   eina_stringshare_replace(&ed->group, group);

   ed->parent = eina_stringshare_add(parent);

   ed->load_error = EDJE_LOAD_ERROR_NONE;
   _edje_file_add(ed);
   ed->block_break = 0;

   if (ed->file && ed->file->external_dir)
     {
	unsigned int i;

	for (i = 0; i < ed->file->external_dir->entries_count; ++i)
	  edje_module_load(ed->file->external_dir->entries[i].entry);
     }

   _edje_textblock_styles_add(ed);
   _edje_textblock_style_all_update(ed);

   ed->has_entries = EINA_FALSE;

   if (ed->collection)
     {
	if (ed->collection->prop.orientation != EDJE_ORIENTATION_AUTO)
          ed->is_rtl = (ed->collection->prop.orientation ==
                        EDJE_ORIENTATION_RTL);

	if (ed->collection->script_only)
	  {
	     ed->load_error = EDJE_LOAD_ERROR_NONE;
	     _edje_script_only_init(ed);
	  }
	else if (ed->collection->lua_script_only)
	  {
	     ed->load_error = EDJE_LOAD_ERROR_NONE;
	     _edje_lua_script_only_init(ed);
	  }
	else
	  {
	     unsigned int i;

	     /* colorclass stuff */
	     for (i = 0; i < ed->collection->parts_count; ++i)
	       {
		  Edje_Part *ep;
		  unsigned int k;

		  ep = ed->collection->parts[i];

		  /* Register any color classes in this parts descriptions. */
		  if ((ep->default_desc) && (ep->default_desc->color_class))
		    _edje_color_class_member_add(ed, ep->default_desc->color_class);

		  for (k = 0; k < ep->other.desc_count; k++)
		    {
		       Edje_Part_Description_Common *desc;

		       desc = ep->other.desc[k];

		       if (desc->color_class)
			 _edje_color_class_member_add(ed, desc->color_class);
		    }
	       }
	     /* build real parts */
	     for (n = 0; n < ed->collection->parts_count; n++)
	       {
		  Edje_Part *ep;

		  ep = ed->collection->parts[n];
		  rp = eina_mempool_malloc(_edje_real_part_mp, sizeof(Edje_Real_Part));
		  if (!rp)
		    {
                       /* FIXME: destroy all allocated ressource, need to have a common exit point */
		       ed->load_error = EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
                       evas_event_thaw(tev);
                       evas_event_thaw_eval(tev);
		       return 0;
		    }

		  memset(rp, 0, sizeof (Edje_Real_Part));

		  if ((ep->dragable.x != 0) || (ep->dragable.y != 0))
		    {
		       rp->drag = calloc(1, sizeof (Edje_Real_Part_Drag));
		       if (!rp->drag)
			 {
			    ed->load_error = EDJE_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
			    eina_mempool_free(_edje_real_part_mp, rp);
                            evas_event_thaw(tev);
                            evas_event_thaw_eval(tev);
                            return 0;
			 }

		       rp->drag->step.x = FROM_INT(ep->dragable.step_x);
		       rp->drag->step.y = FROM_INT(ep->dragable.step_y);
		    }

		  rp->edje = ed;
		  _edje_ref(rp->edje);
		  rp->part = ep;
		  parts = eina_list_append(parts, rp);
		  rp->param1.description = 
                    _edje_part_description_find(ed, rp, "default", 0.0);
		  rp->chosen_description = rp->param1.description;
		  if (!rp->param1.description)
		    ERR("no default part description!");

		  switch (ep->type)
		    {
		     case EDJE_PART_TYPE_RECTANGLE:
			rp->object = evas_object_rectangle_add(ed->base.evas);
			break;
                     case EDJE_PART_TYPE_PROXY:
		     case EDJE_PART_TYPE_IMAGE:
			rp->object = evas_object_image_add(ed->base.evas);
			break;
		     case EDJE_PART_TYPE_TEXT:
			_edje_text_part_on_add(ed, rp);
			rp->object = evas_object_text_add(ed->base.evas);
			evas_object_text_font_source_set(rp->object, ed->path);
			break;
		     case EDJE_PART_TYPE_GROUP:
                        sources = eina_list_append(sources, rp);
		     case EDJE_PART_TYPE_SWALLOW:
		     case EDJE_PART_TYPE_EXTERNAL:
                        if (ep->type == EDJE_PART_TYPE_EXTERNAL)
                          externals = eina_list_append(externals, rp);
			rp->object = evas_object_rectangle_add(ed->base.evas);
			evas_object_color_set(rp->object, 0, 0, 0, 0);
			evas_object_pass_events_set(rp->object, 1);
			evas_object_pointer_mode_set(rp->object, EVAS_OBJECT_POINTER_MODE_NOGRAB);
			_edje_callbacks_focus_add(rp->object, ed, rp);
			break;
		     case EDJE_PART_TYPE_TEXTBLOCK:
			textblocks = eina_list_append(textblocks, rp);
			rp->object = evas_object_textblock_add(ed->base.evas);
			break;
		     case EDJE_PART_TYPE_BOX:
                        sources = eina_list_append(sources, rp);
			rp->object = evas_object_box_add(ed->base.evas);
                        rp->anim = _edje_box_layout_anim_new(rp->object);
			break;
		     case EDJE_PART_TYPE_TABLE:
                        sources = eina_list_append(sources, rp);
			rp->object = evas_object_table_add(ed->base.evas);
			break;
		     case EDJE_PART_TYPE_GRADIENT:
			ERR("SPANK ! SPANK ! SPANK ! YOU ARE USING GRADIENT IN PART %s FROM GROUP %s INSIDE FILE %s !! THEY ARE NOW REMOVED !",
			    ep->name, group, file);
		     default:
			ERR("wrong part type %i!", ep->type);
			break;
		    }

		  if (rp->object)
		    {
		       evas_object_smart_member_add(rp->object, ed->obj);
//		       evas_object_layer_set(rp->object, evas_object_layer_get(ed->obj));
		       if (ep->type != EDJE_PART_TYPE_SWALLOW && ep->type != EDJE_PART_TYPE_GROUP && ep->type != EDJE_PART_TYPE_EXTERNAL)
			 {
			    if (ep->mouse_events)
			      {
				 _edje_callbacks_add(rp->object, ed, rp);
				 if (ep->repeat_events)
				   evas_object_repeat_events_set(rp->object, 1);
				 
				 if (ep->pointer_mode != EVAS_OBJECT_POINTER_MODE_AUTOGRAB)
				   evas_object_pointer_mode_set(rp->object, ep->pointer_mode);
			      }
			    else
			      {
				 evas_object_pass_events_set(rp->object, 1);
				 evas_object_pointer_mode_set(rp->object, EVAS_OBJECT_POINTER_MODE_NOGRAB);
			      }
			    if (ep->precise_is_inside)
			      evas_object_precise_is_inside_set(rp->object, 1);
			 }
		       if (rp->part->clip_to_id < 0)
			 evas_object_clip_set(rp->object, ed->base.clipper);
		    }
	       }
	     if (n > 0)
	       {
		  Eina_List *l;

		  ed->table_parts = malloc(sizeof(Edje_Real_Part *) * n);
		  ed->table_parts_size = n;
		  /* FIXME: check malloc return */
		  n = 0;
		  EINA_LIST_FOREACH(parts, l, rp)
		    {
		       ed->table_parts[n] = rp;
		       n++;
		    }
		  eina_list_free(parts);
		  for (i = 0; i < ed->table_parts_size; i++)
		    {
		       rp = ed->table_parts[i];
		       if (rp->param1.description) /* FIXME: prevent rel to gone radient part to go wrong. You may
						      be able to remove this when all theme are correctly rewritten. */
			 {
			    if (rp->param1.description->rel1.id_x >= 0)
			      rp->param1.rel1_to_x = ed->table_parts[rp->param1.description->rel1.id_x % ed->table_parts_size];
			    if (rp->param1.description->rel1.id_y >= 0)
			      rp->param1.rel1_to_y = ed->table_parts[rp->param1.description->rel1.id_y % ed->table_parts_size];
			    if (rp->param1.description->rel2.id_x >= 0)
			      rp->param1.rel2_to_x = ed->table_parts[rp->param1.description->rel2.id_x % ed->table_parts_size];
			    if (rp->param1.description->rel2.id_y >= 0)
			      rp->param1.rel2_to_y = ed->table_parts[rp->param1.description->rel2.id_y % ed->table_parts_size];
			 }
		       if (rp->part->clip_to_id >= 0)
			 {
			    rp->clip_to = ed->table_parts[rp->part->clip_to_id % ed->table_parts_size];
			    if (rp->clip_to)
			      {
				 evas_object_pass_events_set(rp->clip_to->object, 1);
				 evas_object_pointer_mode_set(rp->clip_to->object, EVAS_OBJECT_POINTER_MODE_NOGRAB);
				 evas_object_clip_set(rp->object, rp->clip_to->object);
			      }
			 }
		       if (rp->drag)
			 {
			    if (rp->part->dragable.confine_id >= 0)
			      rp->drag->confine_to = ed->table_parts[rp->part->dragable.confine_id % ed->table_parts_size];
			 }

		       /* replay events for dragable */
		       if (rp->part->dragable.event_id >= 0)
			 {
			    rp->events_to =
			      ed->table_parts[rp->part->dragable.event_id % ed->table_parts_size];
			    /* events_to may be used only with dragable */
			    if (!rp->events_to->part->dragable.x &&
				!rp->events_to->part->dragable.y)
			      rp->events_to = NULL;
			 }

		       rp->swallow_params.min.w = 0;
		       rp->swallow_params.min.h = 0;
		       rp->swallow_params.max.w = -1;
		       rp->swallow_params.max.h = -1;

		       if (rp->part->type == EDJE_PART_TYPE_TEXT
			   || rp->part->type == EDJE_PART_TYPE_TEXTBLOCK)
			 {
			    Edje_Part_Description_Text *text;

			    text = (Edje_Part_Description_Text *) rp->param1.description;

			    if (ed->file->feature_ver < 1)
			      {
				 text->text.id_source = -1;
				 text->text.id_text_source = -1;
			      }

			    if (text->text.id_source >= 0)
			      rp->text.source = ed->table_parts[text->text.id_source % ed->table_parts_size];
			    if (text->text.id_text_source >= 0)
			      rp->text.text_source = ed->table_parts[text->text.id_text_source % ed->table_parts_size];
			    if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
			      {
				 _edje_entry_real_part_init(rp);
				 if (!ed->has_entries)
				   ed->has_entries = EINA_TRUE;
			      }
			 }
		    }
	       }
	     
	     _edje_programs_patterns_init(ed);

	     n = ed->collection->programs.fnmatch_count +
	       ed->collection->programs.strcmp_count +
	       ed->collection->programs.strncmp_count +
	       ed->collection->programs.strrncmp_count +
	       ed->collection->programs.nocmp_count;
	     if (n > 0)
	       {
		  Edje_Program *pr;

		  ed->table_programs = malloc(sizeof(Edje_Program *) * n);
		  if (ed->table_programs)
		    {
		       ed->table_programs_size = n;

#define EDJE_LOAD_BUILD_TABLE(Array, Ed, It, Tmp)	\
		       for (It = 0; It < Ed->collection->programs.Array##_count; ++It) \
			 {						\
			    Tmp = Ed->collection->programs.Array[It];	\
			    Ed->table_programs[Tmp->id] = Tmp;		\
			 }

		       EDJE_LOAD_BUILD_TABLE(fnmatch, ed, i, pr);
		       EDJE_LOAD_BUILD_TABLE(strcmp, ed, i, pr);
		       EDJE_LOAD_BUILD_TABLE(strncmp, ed, i, pr);
		       EDJE_LOAD_BUILD_TABLE(strrncmp, ed, i, pr);
		       EDJE_LOAD_BUILD_TABLE(nocmp, ed, i, pr);
		    }
	       }
	     _edje_ref(ed);
	     _edje_block(ed);
	     _edje_freeze(ed);
//	     if (ed->collection->script) _edje_embryo_script_init(ed);
	     _edje_var_init(ed);
	     for (i = 0; i < ed->table_parts_size; i++)
	       {
		  rp = ed->table_parts[i];
		  evas_object_show(rp->object);
		  if (_edje_block_break(ed)) break;
		  if (rp->drag)
		    {
		       if (rp->part->dragable.x < 0) rp->drag->val.x = FROM_DOUBLE(1.0);
		       if (rp->part->dragable.y < 0) rp->drag->val.x = FROM_DOUBLE(1.0);
		       _edje_dragable_pos_set(ed, rp, rp->drag->val.x, rp->drag->val.y);
		    }
	       }
             ed->recalc_call = 1;
	     ed->dirty = 1;
#ifdef EDJE_CALC_CACHE
	     ed->all_part_change = 1;
#endif
	     if ((evas_object_clipees_get(ed->base.clipper)) &&
		 (evas_object_visible_get(obj)))
	       evas_object_show(ed->base.clipper);

	     /* instantiate 'internal swallows' */
             EINA_LIST_FREE(externals, rp)
               {
                  Edje_Part_Description_External *external;
                  Evas_Object *child_obj;

                  external = (Edje_Part_Description_External *) rp->part->default_desc;
                  child_obj = _edje_external_type_add(rp->part->source,
                                                      evas_object_evas_get(ed->obj), ed->obj,
                                                      external->external_params, rp->part->name);
                  if (child_obj)
                    {
                       _edje_real_part_swallow(rp, child_obj, EINA_TRUE);
                       rp->param1.external_params = _edje_external_params_parse(child_obj,
                                                                                external->external_params);
                       _edje_external_recalc_apply(ed, rp, NULL, rp->chosen_description);
                    }
               }