Exemplo n.º 1
0
static void _ewk_view_single_smart_add(Evas_Object* ewkView)
{
    Ewk_View_Smart_Data* smartData;

    _parent_sc.sc.add(ewkView);

    smartData = static_cast<Ewk_View_Smart_Data*>(evas_object_smart_data_get(ewkView));
    if (!smartData)
        return;

    Evas_Object* clip = evas_object_rectangle_add(smartData->base.evas);
    evas_object_show(clip);

    evas_object_event_callback_add
        (smartData->backing_store, EVAS_CALLBACK_DEL, _ewk_view_single_on_del, clip);
}
Exemplo n.º 2
0
static int 
_elitaire_card_dragged_cb(void * data)
{
    Elitaire_Card_Job * job;
    Evas_Object * card;
    Elitaire_Card * eli_card;
    Evas_Coord mx, my;
    Evas * evas;

    job = (Elitaire_Card_Job *) data;
    card = job->card;
    eli_card = (Elitaire_Card *) evas_object_smart_data_get(card);

    evas = evas_object_evas_get(card);
    evas_pointer_canvas_xy_get(evas, &mx, &my);

    if ((evas_pointer_button_down_mask_get(evas) - 1) % 2) {
        /* Job now ends */
        Evas_Coord to_x, to_y, x, y, w, h;
        Elitaire *eli;
        int clstack, moved = 0;

        eli = elitaire_card_elitaire_get(card);
        evas_object_geometry_get(card, &x, &y, &w, &h);

        clstack = elitaire_clicked_stack_get(eli, x + w / 2, y + h / 2);

        if (clstack >= 0)
            moved =
                eli->game->move(elitaire_card_playingCard_get(card), clstack);
        if (!moved) {
            if (eli->animate) {
                elitaire_card_xy_get(card, &to_x, &to_y);
                if (!(x == to_x && y == to_y))
                    elitaire_card_slide(card, to_x, to_y);
            }
            else
                elitaire_reinit(eli);
        }
        elitaire_job_del(eli_card->jobs, data);
        return 0;
    }

    evas_object_move(card, mx - job->x.ec, my - job->y.ec);

    return 1;
}
Exemplo n.º 3
0
static Eina_Bool 
_elitaire_card_job_wait_time(Elitaire_Job_List * list, void * data)
{
    int fr;
    Elitaire_Card * ecard;
    Elitaire_Card_Job * job;

    job = (Elitaire_Card_Job *) data;
    ecard = (Elitaire_Card *) evas_object_smart_data_get(job->card);

    fr = ecard->eli->frame_rate;

    ecard->waiting = true;
    job->timer = ecore_animator_add(_elitaire_card_wait_time_cb, data);

    return 0;
}
Exemplo n.º 4
0
static Eina_Bool 
_elitaire_card_job_flip(Elitaire_Job_List * list, void * data)
{
    Elitaire_Card_Job * job;
    Evas_Object * image;
    Elitaire_Card * eli_card;
    Evas_Coord x;

    job = (Elitaire_Card_Job *) data;
    eli_card = (Elitaire_Card *) evas_object_smart_data_get(job->card);
    
    image = eli_card->image;
    evas_object_geometry_get(image, &x, NULL, NULL, NULL);
    _elitaire_card_job_timer_add(list, data, _elitaire_card_flip_cb);

    return 0;
}
Exemplo n.º 5
0
EAPI void
e_icon_size_get(const Evas_Object *obj, int *w, int *h)
{
   E_Smart_Data *sd;

   if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERRNR();
   if (!(sd = evas_object_smart_data_get(obj)))
     {
        if (w) *w = 0;
        if (h) *h = 0;
        return;
     }
   if (sd->edje)
     edje_object_size_min_calc(sd->obj, w, h);
   else
     evas_object_image_size_get(sd->obj, w, h);
}
Exemplo n.º 6
0
/**
 * Enables the entry object: the user will be able to type text
 *
 * @param entry the entry object to enable
 */
EAPI void
e_entry_enable(Evas_Object *entry)
{
   E_Entry_Smart_Data *sd;
   
   if (evas_object_smart_smart_get(entry) != _e_entry_smart) SMARTERRNR();
   if ((!entry) || (!(sd = evas_object_smart_data_get(entry))))
     return;
   if (sd->enabled)
     return;
   
   edje_object_signal_emit(sd->entry_object, "e,state,enabled", "e");
   e_editable_enable(sd->editable_object);
   if (sd->focused)
     e_editable_cursor_show(sd->editable_object);
   sd->enabled = 1;
}
Exemplo n.º 7
0
/* ***************************************************************************
 * callbacks
 * ***************************************************************************/
static int 
_elitaire_card_slide_cb(void * data)
{
    Elitaire_Card_Job * job;
    Evas_Object * card;
    Elitaire_Card * eli_card;
    Evas_Coord to_x, to_y;
    Evas_Coord from_x, from_y;
    Evas_Coord new_x, new_y;
    double m, ft;

    job = (Elitaire_Card_Job *) data;
    card = job->card;
    eli_card = (Elitaire_Card *) evas_object_smart_data_get(card);
    ft = _elitaire_card_job_frametime_get(job);

    if (job->w == eli_card->eli->w) {
        to_x = job->x.ec;
        to_y = job->y.ec;
    }
    else {
        elitaire_card_xy_get(card, &to_x, &to_y);
        job->w = eli_card->eli->w;
        job->x.ec = to_x;
        job->y.ec = to_y;
    }

    evas_object_geometry_get(card, &from_x, &from_y, NULL, NULL);

    m = VELOCITY(eli_card->eli) * ft
        / sqrt((double) (SQR(to_x - from_x) + SQR(to_y - from_y)));

    new_x = (Evas_Coord) (m * (to_x - from_x)) + from_x;
    new_y = (Evas_Coord) (m * (to_y - from_y)) + from_y;

    if (ABS(new_x - from_x) >= ABS(to_x - from_x)
        && ABS(new_y - from_y) >= ABS(to_y - from_y)) {
        /* Job now ends */
        evas_object_move(card, to_x, to_y);
        elitaire_job_del(eli_card->jobs, data);
        return 0;
    }
    evas_object_move(card, new_x, new_y);

    return 1;
}
Exemplo n.º 8
0
Eina_Bool elitaire_object_wait_for_end_of_jobs(Evas_Object * elitaire,
                                        int (*func) (void * data), void * data)
{
    Elitaire * eli;

    eli = (Elitaire *) evas_object_smart_data_get(elitaire);
    if (eli) {
        if (eli->num_card_jobs == 0)
            ecore_timer_add(0.01, func, data);
        else {
            eli->no_job = func;
            eli->no_job_data = data;
            return true;
        }
    }
    return false;
}
Exemplo n.º 9
0
static JSBool
elixir_evas_object_smart_data_get(JSContext *cx, uintN argc, jsval *vp)
{
   Evas_Object *know;
   void *data;
   elixir_value_t val[1];

   if (!elixir_params_check(cx, _evas_object_smart_params, val, argc, JS_ARGV(cx, vp)))
     return JS_FALSE;

   GET_PRIVATE(cx, val[0].v.obj, know);

   data = evas_object_smart_data_get(know);

   JS_SET_RVAL(cx, vp, elixir_void_get_jsval(data));
   return JS_TRUE;
}
Exemplo n.º 10
0
static void _elitaire_object_del(Evas_Object * o)
{
    Elitaire * eli;

    eli = (Elitaire *) evas_object_smart_data_get(o);
    if (!eli) return;

    elitaire_cards_del(eli);
    evas_object_del(eli->clip);
    elitaire_stacks_del(eli);
    
    if (eli->game) {
        delete eli->game;
    }
    // elitaire_job_list_del(eli->jobs);
    free(eli);
}
Exemplo n.º 11
0
static void
_e_layout_smart_del(Evas_Object *obj)
{
   E_Smart_Data *sd;
   
   sd = evas_object_smart_data_get(obj);
   if (!sd) return;
   while (sd->items)
     {
	Evas_Object *child;
	
	child = sd->items->data;
	e_layout_unpack(child);
     }
   evas_object_del(sd->clip);
   free(sd);
}
Exemplo n.º 12
0
static int 
_elitaire_card_drag_cb(void * data)
{
    Elitaire_Card_Job * job;
    Elitaire_Card * eli_card;
    Evas_Coord x, y, w, d;
    Evas_Coord image_x, image_y;
    Evas_Object * card = NULL;

    job = (Elitaire_Card_Job *) data;
    card = job->card;
    eli_card = (Elitaire_Card *) evas_object_smart_data_get(card);

    evas_object_geometry_get(eli_card->shadow, &x, &y, &w, NULL);
    evas_object_geometry_get(eli_card->image, &image_x, &image_y, NULL, NULL);

    d = (Evas_Coord) (VELOCITY(eli_card->eli) / (eli_card->eli->frame_rate * 2));
    image_x -= d;
    image_y -= d;

    if (abs(x - image_x) >= w / 10) {
        /* Job now ends */
        evas_object_move(eli_card->image, x - w / 10, y - w / 10);
        
        if (eli_card->next_card) {
            Evas_Coord dy;

            dy = elitaire_card_offset_get(eli_card->eli);
            evas_object_move(eli_card->next_card, x - w / 10, y - w / 10 + dy);
        }

        elitaire_job_del(eli_card->jobs, data);
        return 0;
    }

    evas_object_move(eli_card->image, image_x, image_y);

    if (eli_card->next_card) {
        Evas_Coord dy;

        dy = elitaire_card_offset_get(eli_card->eli);
        evas_object_move(eli_card->next_card, image_x, image_y + dy);
    }

    return 1;
}
Exemplo n.º 13
0
static void
_source_out(void *data, Evas_Object *edj, const char *emission, const char *source)
{
	Evas_Object *o = data;
	patcher_t *priv = evas_object_smart_data_get(o);
	unsigned short src;
	evas_object_table_pack_get(priv->matrix, edj, &src, NULL, NULL, NULL);
	int src_idx;
	_abs_to_rel(priv, src, 0, &src_idx, NULL);
	
	edje_object_signal_emit(edj, "off", PATCHER_UI);

	Evas_Object *tar = evas_object_table_child_get(priv->matrix, src, priv->max+1);
	edje_object_signal_emit(tar, "off", PATCHER_UI);
	
	for(int j=0; j<priv->sinks; j++)
	{
		int snk;
		_rel_to_abs(priv, 0, j, NULL, &snk);

		if(priv->state[src_idx][j]) // connected
		{
			for(int i=src+1; i<priv->max; i++)
			{
				tar = evas_object_table_child_get(priv->matrix, i, snk);
				edje_object_signal_emit(tar, "clear", PATCHER_UI);
			}

			tar = evas_object_table_child_get(priv->matrix, src, snk);
			edje_object_signal_emit(tar, "clear", PATCHER_UI);
			
			tar = evas_object_table_child_get(priv->matrix, priv->max, snk);
			edje_object_signal_emit(tar, "off", PATCHER_UI);
			
			tar = evas_object_table_child_get(priv->matrix, priv->max+1, snk);
			edje_object_signal_emit(tar, "off", PATCHER_UI);
		}
		else
		{
			tar = evas_object_table_child_get(priv->matrix, src, snk);
			edje_object_signal_emit(tar, "clear", PATCHER_UI);
		}
	}

	priv->src_over = NULL;
}
Exemplo n.º 14
0
static int 
_elitaire_card_drop_cb(void * data)
{
    Elitaire_Card_Job * job;
    Evas_Object * card = NULL;
    Evas_Coord x, y, w, d;
    Evas_Coord image_x, image_y;
    Elitaire_Card * eli_card;

    job = (Elitaire_Card_Job *) data;
    card = job->card;

    eli_card = (Elitaire_Card *) evas_object_smart_data_get(card);

    evas_object_geometry_get(card, &x, &y, &w, NULL);
    evas_object_geometry_get(eli_card->image, &image_x, &image_y, NULL, NULL);

    d = (Evas_Coord) (VELOCITY(eli_card->eli) / eli_card->eli->frame_rate);
    image_x += d;
    image_y += d;

    if (image_x >= x || image_y >= y) {
        /* Job now ends */
        evas_object_move(eli_card->image, x, y);
        if (eli_card->next_card) {
            Evas_Coord dy;

            dy = elitaire_card_offset_get(eli_card->eli);
            evas_object_move(eli_card->next_card, x, y + dy);
        }
        _elitaire_card_shadow_off(card);
        elitaire_stack_layer_reinit(eli_card->eli, eli_card->pcard);
        elitaire_job_del(eli_card->jobs, data);
        return 0;
    }

    evas_object_move(eli_card->image, image_x, image_y);

    if (eli_card->next_card) {
        Evas_Coord dy;

        dy = elitaire_card_offset_get(eli_card->eli);
        evas_object_move(eli_card->next_card, image_x, image_y + dy);
    }
    return 1;
}
Exemplo n.º 15
0
/**
 * Shows the cursor of the editable object
 *
 * @param editable the editable object whose cursor should be shown
 */
EAPI void
e_editable_cursor_show(Evas_Object *editable)
{
   E_Editable_Smart_Data *sd;

   if (evas_object_smart_smart_get(editable) != _e_editable_smart) SMARTERRNR();
   if ((!editable) || (!(sd = evas_object_smart_data_get(editable))))
     return;
   if (sd->cursor_visible) return;

   sd->cursor_visible = 1;
   if (evas_object_visible_get(editable))
     {
        evas_object_show(sd->cursor_object);
        edje_object_signal_emit(sd->cursor_object, "e,action,show,cursor", "e");
     }
}
Exemplo n.º 16
0
static void
_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
{
    Smart_Data *sd;
    Eina_List *l;
    Evas_Coord dx, dy;

    sd = evas_object_smart_data_get(obj);
    if (!sd) return;
    dx = x - sd->x;
    dy = y - sd->y;
    sd->x = x;
    sd->y = y;
    evas_object_move(sd->clip, x, y);
    evas_object_move(sd->edje, x, y);
    evas_object_move(sd->canvas, x, y);
}
Exemplo n.º 17
0
/**
 * Sets the theme group to be used by the editable object.
 * This function has to be called, or the cursor and the selection won't be
 * visible.
 *
 * @param editable an editable object
 * @param category the theme category to use for the editable object
 * @param group the theme group to use for the editable object
 */
EAPI void
e_editable_theme_set(Evas_Object *editable, const char *category, const char *group)
{
   E_Editable_Smart_Data *sd;
   char *obj_group;
   const char *data;

   if (evas_object_smart_smart_get(editable) != _e_editable_smart) SMARTERRNR();
   if ((!editable) || (!(sd = evas_object_smart_data_get(editable))))
     return;
   if ((!category) || (!group)) return;
   obj_group = alloca(strlen(group) + strlen("/selection") + 1);

   /* Gets the theme for the text object */
   sprintf(obj_group, "%s/text", group);
   e_theme_edje_object_set(sd->text_object, category, obj_group);
   sd->average_char_w = -1;
   sd->average_char_h = -1;

   /* Gets the theme for the cursor */
   sprintf(obj_group, "%s/cursor", group);
   e_theme_edje_object_set(sd->cursor_object, category, obj_group);

   edje_object_size_min_get(sd->cursor_object, &sd->cursor_width, NULL);
   if (sd->cursor_width < 1) sd->cursor_width = 1;

   /* Gets the theme for the selection */
   sprintf(obj_group, "%s/selection", group);
   e_theme_edje_object_set(sd->selection_object, category, obj_group);

   data = edje_object_data_get(sd->selection_object, "on_foreground");
   if ((data) && (strcmp(data, "1") == 0))
     {
        sd->selection_on_fg = 1;
        evas_object_stack_above(sd->selection_object, sd->text_object);
     }
   else
     {
        sd->selection_on_fg = 0;
        evas_object_stack_below(sd->selection_object, sd->text_object);
     }

   _e_editable_text_update(editable);
   _e_editable_cursor_update(editable);
}
Exemplo n.º 18
0
/* callbacks */
static void
_recalc_job(void *data)
{
    Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
    Evas_Coord resw, resh, minminw;
    Eina_List *l;
    Evas_Object *child;
    Smart_Data *sd;

    sd = evas_object_smart_data_get(data);
    if (!sd) return;

    sd->deferred_recalc_job = NULL;

    if (sd->w != sd->w_view) {
        // Width has changed, recalc of all list entries needed
        resh = 0;
        int i = 0;
        for (l = sd->children; l; l = l->next) {
            child = l->data;
            edje_object_size_min_restricted_calc(child, &minw, &minh, sd->w_view, 0);
            evas_object_resize(child, sd->w_view, minh);
            evas_object_move(child, sd->x, sd->y + resh);
            resh = resh + minh;
        }

        if (resh < sd->h_view) 
            resh = sd->h_view;

        sd->w = sd->w_view;
        sd->h = resh;
    }

    if (sd->overlay_visible) {
        evas_object_resize(sd->clip, sd->w_view, sd->h_view);
        evas_object_resize(sd->overlay, sd->w_view, sd->h_view);
        evas_object_size_hint_max_set(sd->obj, sd->w_view, sd->h_view);
    }
    else {
        evas_object_resize(sd->bg, sd->w, sd->h);
        evas_object_resize(sd->clip, sd->w, sd->h);
        evas_object_size_hint_min_set(sd->obj, 0, sd->h);
        evas_object_size_hint_max_set(sd->obj, maxw, sd->h);
    }
}
Exemplo n.º 19
0
EAPI Eina_Bool
e_icon_file_key_set(Evas_Object *obj, const char *file, const char *key)
{
   E_Smart_Data *sd;

   if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERR(0);
   if (!(sd = evas_object_smart_data_get(obj)))
     return EINA_FALSE;

   /* smart code here */
   sd->loading = 0;
   if (sd->fdo)
     {
        eina_stringshare_del(sd->fdo);
        sd->fdo = NULL;
     }

   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;

   _e_icon_obj_prepare(obj, sd);
   if (sd->size != 0)
     evas_object_image_load_size_set(sd->obj, sd->size, sd->size);
   if (sd->preload) evas_object_hide(sd->obj);
   evas_object_image_file_set(sd->obj, file, key);
   if (evas_object_image_load_error_get(sd->obj) != EVAS_LOAD_ERROR_NONE)
     return EINA_FALSE;
   if (!_handle_anim(sd))
     {
        if (sd->preload)
          {
             sd->loading = 1;
             evas_object_image_preload(sd->obj, 0);
          }
        else if (evas_object_visible_get(obj))
          evas_object_show(sd->obj);
     }
   _e_icon_smart_reconfigure(sd);
   return EINA_TRUE;
}
Exemplo n.º 20
0
void elitaire_object_size_min_get(Evas_Object * elitaire, Evas_Coord * minw,
                           Evas_Coord * minh)
{
    Elitaire * eli;

    eli = (Elitaire *) evas_object_smart_data_get(elitaire);

    *minw = (Evas_Coord) (eli->card_min_w * (((float) eli->max_cols)
                                               + eli->spacing * ((float) (eli->max_cols - 1.0)) 
                                               + (float) (2.0 * eli->margin_h)))
                          + eli->offset.l + eli->offset.r;
    *minh = (Evas_Coord) ((float) eli->num_rows * eli->card_min_h
                          + (float) (eli->num_rows -
                                     1.0) * eli->card_min_w * eli->spacing +
                          2.0 * eli->margin_h * eli->card_min_h)
                + eli->offset.t + eli->offset.b;

}
Exemplo n.º 21
0
static int 
_elitaire_card_wait_cb(void * data)
{
    Evas * evas;
    Elitaire_Card_Job * job;

    job = (Elitaire_Card_Job *) data;
    evas = evas_object_evas_get(job->card);

    if (evas_pointer_button_down_mask_get(evas) & job->x.i) return 1;
    else {
        Elitaire_Card * eli_card;

        eli_card = (Elitaire_Card *) evas_object_smart_data_get(job->card);
        elitaire_job_del(eli_card->jobs, data);
        return 0;
    }
}
Exemplo n.º 22
0
static void
_smart_del (Evas_Object *obj)
{
  Smart_Dvi *sp;

  sp = evas_object_smart_data_get (obj);
  if (!sp) return;

  if (sp->filename)
    free (sp->filename);

  if (sp->dvi_document)
    edvi_document_delete (sp->dvi_document);
  if (sp->dvi_page)
    edvi_page_delete (sp->dvi_page);

  free (sp);
}
Exemplo n.º 23
0
Eina_Bool 
elitaire_card_job_clean_up(Elitaire_Job_List * list, void * data)
{
    Elitaire_Card * ecard;
    Evas_Object * card;

    card = (Evas_Object *) data;
    ecard = (Elitaire_Card *) evas_object_smart_data_get(card);

    if (ecard->shadow) {
        _elitaire_card_drop(card);
        elitaire_card_chain_del(card);
        return 0;
    }
    
    if (elitaire_card_next_card_get(card)) elitaire_card_chain_delete(card);
    return 0;
}
Exemplo n.º 24
0
void
smart_slider_value_set(Evas_Object *o, float value)
{
	smart_slider_t *priv = evas_object_smart_data_get(o);
	if(!priv)
		return;

	float new_value = value < priv->min
		? priv->min
		: (value > priv->max
			? priv->max
			: value);

	priv->value = INFINITY;
	priv->drag = (new_value - priv->min) * priv->scale;

	_smart_slider_value_flush(o);
}
Exemplo n.º 25
0
/* Gets the geometry of the char according to its utf-8 pos */
static int
_e_editable_char_geometry_get_from_pos(Evas_Object *editable, int utf_pos, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch)
{
   E_Editable_Smart_Data *sd;
   const Evas_Object *text_obj;
   const char *text;
   Evas_Coord x, w;
   int index = 0, i, last_pos, ret;

   if (cx) *cx = 0;
   if (cy) *cy = 0;
   if (cw) *cw = 0;
   if (ch) *ch = 0;

   if ((!editable) || (!(sd = evas_object_smart_data_get(editable))))
     return 0;
   if (!(text_obj = edje_object_part_object_get(sd->text_object, "e.text.text")))
     return 0;

   text = evas_object_text_text_get(text_obj);
   if ((!text) || (sd->unicode_length <= 0) || (utf_pos <= 0))
     {
        e_editable_char_size_get(editable, cw, ch);
        return 1;
     }
   else
     {
        if (utf_pos >= sd->unicode_length)
          {
            utf_pos = sd->unicode_length - 1;
            last_pos = 1;
          }
        else
          last_pos = 0;

        for (i = 0; i < utf_pos; i++)
          index = evas_string_char_next_get(text, index, NULL);

        ret = evas_object_text_char_pos_get(text_obj, index, &x, cy, &w, ch);
        if (cx) *cx = x - 1 + (last_pos ? w : 0);
        if (cw) *cw = last_pos ? 1 : w;
        return ret;
     }
}
Exemplo n.º 26
0
static void
_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
{
    Smart_Data *sd;
    Eina_List *l;
    Evas_Object *child;
    Evas_Coord minw, minh, resh;

    sd = evas_object_smart_data_get(obj);
    if (!sd) return;
    
    if (sd->w != w || sd->h != h) {
        sd->w_view = w;
        sd->h_view = h;
    }

    printf("Resize: %d %d\n", w, h);
    _sizing_eval(obj);
}
Exemplo n.º 27
0
/**
 * A utility function to get the average size of a character written inside
 * the editable object
 *
 * @param editable an editable object
 * @param w the location where to store the average width of a character
 * @param h the location where to store the average height of a character
 */
EAPI void
e_editable_char_size_get(Evas_Object *editable, int *w, int *h)
{
   int tw = 0, th = 0;
   Evas *evas;
   const Evas_Object *text_obj;
   Evas_Object *obj;
   E_Editable_Smart_Data *sd;
   char *text = "Tout est bon dans l'abricot sauf le noyau!"
                "Wakey wakey! Eggs and Bakey!";
   const char *font, *font_source;
   Evas_Text_Style_Type style;
   int font_size;

   if (w) *w = 0;
   if (h) *h = 0;
   if (evas_object_smart_smart_get(editable) != _e_editable_smart) SMARTERRNR();
   if ((!editable) || (!(evas = evas_object_evas_get(editable))))
     return;
   if (!(sd = evas_object_smart_data_get(editable))) return;
   if (!(text_obj = edje_object_part_object_get(sd->text_object, "e.text.text")))
     return;

   if ((sd->average_char_w <= 0) || (sd->average_char_h <= 0))
     {
        font_source = evas_object_text_font_source_get(text_obj);
        evas_object_text_font_get(text_obj, &font, &font_size);
        style = evas_object_text_style_get(text_obj);

        obj = evas_object_text_add(evas);
        evas_object_scale_set(obj, edje_scale_get());
        evas_object_text_font_source_set(obj, font_source);
        evas_object_text_font_set(obj, font, font_size);
        evas_object_text_style_set(obj, style);
        evas_object_text_text_set(obj, text);
        evas_object_geometry_get(obj, NULL, NULL, &tw, &th);
        evas_object_del(obj);
        sd->average_char_w = (tw / strlen(text));
        sd->average_char_h = th;
     }
   if (w) *w = sd->average_char_w;
   if (h) *h = sd->average_char_h;
}
Exemplo n.º 28
0
void 
elitaire_card_slide(Evas_Object * card, Evas_Coord x, Evas_Coord y)
{
    Elitaire_Card_Job * job;
    Elitaire_Card * ecard;

    ecard = (Elitaire_Card *) evas_object_smart_data_get(card);

    job = _elitaire_card_job_new(card);
    job->x.ec = x;
    job->y.ec = y;
    job->w = ecard->eli->w;

    _elitaire_card_drag(card);
    elitaire_job_add(ecard->jobs, _elitaire_card_job_slide, 
    	    			ELITAIRE_JOB_SYNC_NEXT_WAIT, job);
    
    if (!ecard->eli->shadow) _elitaire_card_drop(card);
}
Exemplo n.º 29
0
static JSBool
elixir_evas_object_smart_data_set(JSContext *cx, uintN argc, jsval *vp)
{
   Evas_Object *know;
   void *dt;
   elixir_value_t val[2];

   if (!elixir_params_check(cx, _evas_object_smart_any_params, val, argc, JS_ARGV(cx, vp)))
     return JS_FALSE;

   GET_PRIVATE(cx, val[0].v.obj, know);

   elixir_void_free(evas_object_smart_data_get(know));

   dt = elixir_void_new(cx, JS_THIS_OBJECT(cx, vp), val[1].v.any, NULL);
   evas_object_smart_data_set(know, dt);

   return JS_TRUE;
}
Exemplo n.º 30
0
PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool, bool, bool, bool drawSelectionRect)
{
    Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(evas_object_smart_data_get(browser->mainView()));
    Ewk_View_Private_Data* privateData = static_cast<Ewk_View_Private_Data*>(smartData->_priv);
    const Evas_Object* mainFrame = browser->mainFrame();

    int x, y, width, height;
    if (!ewk_frame_visible_content_geometry_get(mainFrame, EINA_TRUE, &x, &y, &width, &height))
        return 0;

    RefPtr<cairo_surface_t> surface = adoptRef(cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height));
    RefPtr<cairo_t> context = adoptRef(cairo_create(surface.get()));

    const Eina_Rectangle rect = { x, y, width, height };
    if (!ewk_view_paint(privateData, context.get(), &rect))
        return 0;

    if (DumpRenderTreeSupportEfl::isTrackingRepaints(mainFrame)) {
        cairo_push_group(context.get());

        // Paint the gray mask over the original image.
        cairo_set_source_rgba(context.get(), 0, 0, 0, 0.66);
        cairo_paint(context.get());

        // Paint transparent rectangles over the mask to show the repainted regions.
        cairo_set_source_rgba(context.get(), 0, 0, 0, 0);
        cairo_set_operator(context.get(), CAIRO_OPERATOR_SOURCE);

        Eina_List* repaintRects = DumpRenderTreeSupportEfl::trackedRepaintRects(mainFrame);
        void* iter = 0;
        EINA_LIST_FREE(repaintRects, iter) {
            Eina_Rectangle* rect = static_cast<Eina_Rectangle*>(iter);

            cairo_rectangle(context.get(), rect->x, rect->y, rect->w, rect->h);
            cairo_fill(context.get());

            eina_rectangle_free(rect);
        }

        cairo_pop_group_to_source(context.get());
        cairo_paint(context.get());
    }