Example #1
0
static void
libclouseau_item_add(Evas_Object *o, Clouseau_Tree_Item *parent)
{
   Clouseau_Tree_Item *treeit;
   Eina_List *children;
   Evas_Object *child;

   treeit = calloc(1, sizeof(Clouseau_Tree_Item));
   if (!treeit) return ;

   treeit->ptr = (uintptr_t) o;
   treeit->is_obj = EINA_TRUE;

   treeit->name = eina_stringshare_add(evas_object_type_get(o));
   treeit->is_clipper = !!evas_object_clipees_get(o);
   treeit->is_visible = evas_object_visible_get(o);
   treeit->info = clouseau_object_information_get(treeit);

   parent->children = eina_list_append(parent->children, treeit);

   /* if (!evas_object_smart_data_get(o)) return ; */

   /* Do this only for smart object */
   children = evas_object_smart_members_get(o);
   EINA_LIST_FREE(children, child)
     libclouseau_item_add(child, treeit);
}
Example #2
0
void
_engage_element_object_resize(Evas_Object * o, Evas_Coord w, Evas_Coord h)
{
  double          fit = 0.0;
  Evas_Coord      iw = w, ih = h;
  Engage_Element *data;

  if ((data = evas_object_smart_data_get(o))) {
    data->iw = w;
    data->ih = h;
    evas_object_resize(data->clip, w, h);
    evas_object_resize(data->behavior, w, h);
    if (!strcmp(evas_object_type_get(data->icon), "image")) {
      if (data->iw < data->ih)
        iw =
          (Evas_Coord) ((double) h * ((double) data->iw / (double) data->ih));
      else
        ih =
          (Evas_Coord) ((double) w * ((double) data->ih / (double) data->iw));

      evas_object_resize(data->icon, iw, ih);
      evas_object_image_fill_set(data->icon, 0.0, 0.0, iw, ih);
      evas_object_move(data->icon, data->x - ((iw - data->w) / 2),
                       data->y - ((ih - data->h) / 2));
    } else {
      evas_object_resize(data->icon, w, h);
    }
  }
}
Example #3
0
EAPI void
e_icon_object_set(Evas_Object *obj, Evas_Object *o)
{
   E_Smart_Data *sd;
   const char *str;

   if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERR();
   if (!(sd = evas_object_smart_data_get(obj))) return;
   str = evas_object_type_get(o);
   if ((!str) || strcmp(str, "image"))
     CRI(EINA_COLOR_RED"******************\ntrying to set an image object of type '%s'! this is not what you want!\n******************\n"EINA_COLOR_RESET, str);

   if (sd->timer) ecore_timer_del(sd->timer);
   sd->timer = NULL;
   if (sd->guessing_animation) ecore_timer_del(sd->guessing_animation);
   sd->guessing_animation = NULL;
   sd->frame = 0;
   sd->frame_count = 0;
   sd->edje = EINA_FALSE;

   /* smart code here */
   if (sd->obj) evas_object_del(sd->obj);
   sd->loading = 0;
   sd->obj = o;
   evas_object_smart_member_add(sd->obj, obj);
   if (evas_object_visible_get(obj)) evas_object_show(sd->obj);
   _e_icon_smart_reconfigure(sd);
}
Example #4
0
EAPI int
e_icon_alpha_get(Evas_Object *obj)
{
   E_Smart_Data *sd;
   
   sd = evas_object_smart_data_get(obj);
   if (!sd) return 0;
   if (!strcmp(evas_object_type_get(sd->obj), "edje"))
     return 0;   
   return evas_object_image_alpha_get(sd->obj);
}
Example #5
0
EAPI void
e_icon_alpha_set(Evas_Object *obj, int alpha)
{
   E_Smart_Data *sd;
   
   sd = evas_object_smart_data_get(obj);
   if (!sd) return;
   if (!strcmp(evas_object_type_get(sd->obj), "edje"))
     return;   
   evas_object_image_alpha_set(sd->obj, alpha);
}
Example #6
0
EAPI void
e_icon_smooth_scale_set(Evas_Object *obj, int smooth)
{
   E_Smart_Data *sd;
   
   sd = evas_object_smart_data_get(obj);
   if (!sd) return;
   if (!strcmp(evas_object_type_get(sd->obj), "edje"))
     return;
   evas_object_image_smooth_scale_set(sd->obj, smooth);
}
Example #7
0
EAPI void *
e_icon_data_get(Evas_Object *obj, int *w, int *h)
{
   E_Smart_Data *sd;
   
   sd = evas_object_smart_data_get(obj);
   if (!sd) return NULL;
   if (!strcmp(evas_object_type_get(sd->obj), "edje"))
     return NULL;   
   evas_object_image_size_get(sd->obj, w, h);
   return evas_object_image_data_get(sd->obj, 0);
}
Example #8
0
EAPI void
e_icon_data_set(Evas_Object *obj, void *data, int w, int h)
{
   E_Smart_Data *sd;
   
   sd = evas_object_smart_data_get(obj);
   if (!sd) return;
   if (!strcmp(evas_object_type_get(sd->obj), "edje"))
     return;   
   evas_object_image_size_set(sd->obj, w, h);
   evas_object_image_data_copy_set(sd->obj, data);
}
Example #9
0
/* local subsystem globals */
static void
_e_icon_smart_reconfigure(E_Smart_Data *sd)
{
   int iw, ih;
   Evas_Coord x, y, w, h;
   
   if (!strcmp(evas_object_type_get(sd->obj), "edje"))
     {
	w = sd->w;
	h = sd->h;
	x = sd->x;
	y = sd->y;
	evas_object_move(sd->obj, x, y);
	evas_object_resize(sd->obj, w, h);
     }
   else
     {
	ih = 0;
	ih = 0;
	evas_object_image_size_get(sd->obj, &iw, &ih);
	if (iw < 1) iw = 1;
	if (ih < 1) ih = 1;
	
	if (sd->fill_inside)
	  {
	     w = sd->w;
	     h = ((double)ih * w) / (double)iw;
	     if (h > sd->h)
	       {
		  h = sd->h;
		  w = ((double)iw * h) / (double)ih;
	       }
	  }
	else
	  {
	     w = sd->w;
	     h = ((double)ih * w) / (double)iw;
	     if (h < sd->h)
	       {
		  h = sd->h;
		  w = ((double)iw * h) / (double)ih;
	       }	
	  }
	x = sd->x + ((sd->w - w) / 2);
	y = sd->y + ((sd->h - h) / 2);
	evas_object_move(sd->obj, x, y);
	evas_object_image_fill_set(sd->obj, 0, 0, w, h);
	evas_object_resize(sd->obj, w, h);
     }
}
Example #10
0
EAPI const char *
e_icon_file_get(Evas_Object *obj)
{
   E_Smart_Data *sd;
   const char *file;
   
   sd = evas_object_smart_data_get(obj);
   if (!sd) return NULL;
   if (!strcmp(evas_object_type_get(sd->obj), "edje"))
     {
	edje_object_file_get(sd->obj, &file, NULL);
	return file;
     }
   evas_object_image_file_get(sd->obj, &file, NULL);
   return file;
}
Example #11
0
Evas_Object    *
engage_element_new(Evas * e, const char *bfile, const char *bgroup,
                   const char *ifile, const char *igroup)
{
  char            buf[PATH_MAX];
  int             w = 48, h = 48;
  Evas_Object    *result = NULL;
  Engage_Element *data = NULL;

  if ((result = engage_element_object_new(e))) {
    if ((data = evas_object_smart_data_get(result))) {
      data->clip = evas_object_rectangle_add(e);
      evas_object_color_set(data->clip, 255, 255, 255, 255);
      evas_object_layer_set(data->clip, 0);
      evas_object_show(data->clip);

      if ((data->behavior = engage_element_behavior_new(e, bfile, bgroup))) {
        evas_object_clip_set(data->behavior, data->clip);
        if ((data->icon = engage_element_icon_new(e, ifile, igroup))) {
          if (!strcmp(evas_object_type_get(data->icon), "image")) {
            evas_object_image_size_get(data->icon, &data->iw, &data->ih);
            evas_object_image_fill_set(data->icon, 0.0, 0.0,
                                       (Evas_Coord) data->iw,
                                       (Evas_Coord) data->ih);

          }
          evas_object_clip_set(data->icon, data->clip);
        } else {
          evas_object_del(result);
          result = NULL;
        }
      }
    }
  }
  return (result);
}
const std::string Object::getType () const
{
  return evas_object_type_get( o );
}
Example #13
0
static void
_default_layout(Container *cont)
{
  Eina_List *l;
  double ax, ay, aw, ah; // element area geom
  double ix, iy, iw, ih; // new x, y, w, h
  double L; // length of all objects at original size (for nonhomog)
  int num; // number of elements
  double error = 0;
  int r,g,b;

  /* FIXME: add a 'changed' flag to prevent excessive recalcs */
  
//  evas_object_geometry_get(cont->grabber, &ax, &ay, &aw, &ah);
  ax = cont->x;
  ay = cont->y;
  aw = cont->w;
  ah = cont->h;

  /* adjust for padding */
  ax += cont->padding.l;
  ay += cont->padding.t;
  aw -= cont->padding.l + cont->padding.r;
  ah -= cont->padding.t + cont->padding.b;

  if (aw == 0 || ah == 0)
    return;

  ix = ax;
  iy = ay;

  if (cont->direction) iy += cont->scroll.offset;
  else ix += cont->scroll.offset;

  L = esmart_container_elements_orig_length_get(cont->obj);
  num = eina_list_count(cont->elements);
  
  
  evas_object_color_get(cont->clipper, &r, &g, &b, NULL);

  for (l = cont->elements; l; l = l->next)
  {
    Container_Element *el = l->data;
    Evas_Coord ew, eh; // old element size

    if(!el)
    {
      continue;
    }
    evas_object_geometry_get(el->obj, NULL, NULL, &ew, &eh);
    if (ew == 0) ew = el->orig_w;
    if (eh == 0) eh = el->orig_h;

    evas_object_resize(el->grabber, ew, eh);

    /* vertical */
    if (cont->direction)
    {
      if (cont->fill & CONTAINER_FILL_POLICY_FILL)
      {
        iw = aw;

        if (cont->fill & CONTAINER_FILL_POLICY_HOMOGENOUS)
          ih = (ah - cont->spacing * (num - 1) ) / num;
        else
          ih = el->orig_h * (ah - cont->spacing * (num - 1) ) / L;
          
      }
      else if (cont->fill & CONTAINER_FILL_POLICY_FILL_X)
      {
        if (cont->fill & CONTAINER_FILL_POLICY_KEEP_ASPECT)
        {
          iw = aw;
          ih = eh * iw/ew;
        }
        else
        {
          iw = aw;
          ih = eh;
        }
      }
      else if (cont->fill & CONTAINER_FILL_POLICY_FILL_Y)
      {
        if (cont->fill & CONTAINER_FILL_POLICY_HOMOGENOUS)
          ih = (ah - cont->spacing * (num - 1) ) / num;
        else
          ih = el->orig_h * (ah - cont->spacing * (num - 1) ) / L;

        if (cont->fill & CONTAINER_FILL_POLICY_KEEP_ASPECT)
          iw = ew * ih/eh;
        else
          iw = ew;
      }
      else
      {
        iw = ew;
        ih = eh;
      }

      if (cont->align == CONTAINER_ALIGN_LEFT)
        ix = ax;
      else if (cont->align == CONTAINER_ALIGN_CENTER)
        ix = ax + (aw - iw) / 2;
      else if (cont->align == CONTAINER_ALIGN_RIGHT)
        ix = ax + aw - iw;

      evas_object_move(el->obj, ix, iy);
      evas_object_resize(el->obj, iw, ih);
      if (!strcmp(evas_object_type_get(el->obj), "image"))
      {
        evas_object_image_fill_set(el->obj, 0, 0, iw, ih);
      }
      evas_object_move(el->grabber, ix, iy);
      evas_object_resize(el->grabber, iw, ih);

      iy += ih + cont->spacing;
    }

    /* horizontal */
    else
    {
      if (cont->fill & CONTAINER_FILL_POLICY_FILL)
      {
        ih = ah;
        
        if (cont->fill & CONTAINER_FILL_POLICY_HOMOGENOUS)
          iw = (aw - cont->spacing * (num - 1) ) / num;
        else
        {
          iw = el->orig_w * (aw - cont->spacing * (num - 1) ) / L;
        }
      }
      else if (cont->fill & CONTAINER_FILL_POLICY_FILL_X)
      {

        if (cont->fill & CONTAINER_FILL_POLICY_HOMOGENOUS)
        {
          iw = (aw - cont->spacing * (num - 1) ) / num;
        }
        else
        {
          iw = el->orig_w * (aw - cont->spacing * (num - 1) ) / L;
        }

        if (cont->fill & CONTAINER_FILL_POLICY_KEEP_ASPECT)
          ih = eh * iw/ew;
        else
          ih = eh;
      }
      else if (cont->fill & CONTAINER_FILL_POLICY_FILL_Y)
      {
        if (cont->fill & CONTAINER_FILL_POLICY_KEEP_ASPECT)
        {
          ih = ah;
          iw = ew * ih/eh;
        }
        else
        {
          ih = ah;
          iw = ew;
        }
      }
      else
      {
        iw = ew;
        ih = eh;
      }

      if (cont->align == CONTAINER_ALIGN_TOP)
        iy = ay;
      else if (cont->align == CONTAINER_ALIGN_CENTER)
        iy = ay + (ah - ih) / 2;
      else if (cont->align == CONTAINER_ALIGN_BOTTOM)
        iy = ay + ah - ih;

      /* make sure that the elements fill the container exactly */
      if (error >= 1)
      {
        iw++;
        error -= 1;
      }
      else if (error <= -1)
      {
        iw--;
        error += 1;
      }

      error += iw - (int)iw; 

      iw = (int)iw;

      evas_object_move(el->obj, ix, iy);
      evas_object_resize(el->obj, iw, ih);
      if (!strcmp(evas_object_type_get(el->obj), "image"))
      {
        evas_object_image_fill_set(el->obj, 0, 0, iw, ih);
      }
      evas_object_move(el->grabber, ix, iy);
      evas_object_resize(el->grabber, iw, ih);
      ix += iw + cont->spacing;
    }

   
    evas_object_geometry_get(el->obj, NULL, NULL, &ew, &eh);
    evas_object_resize(el->grabber, ew, eh);
  }
}