static void
_smart_add(Evas_Object *obj)
{
    Smart_Data *sd;

    /* Initialize smart data and clipping */
    sd = calloc(1, sizeof(Smart_Data));
    if (!sd) return;
    sd->obj = obj;
    sd->parent = NULL;
    sd->children = NULL;
    sd->clip = evas_object_rectangle_add(evas_object_evas_get(obj));
    evas_object_smart_member_add(sd->clip, obj);
   
    /* Set up edje object and canvas */
    sd->bg = edje_object_add(evas_object_evas_get(obj));
    edje_object_file_set(sd->bg, "../../data/themes/elexika.edj", "result_list");
    evas_object_move(sd->bg, 0, 0);
    evas_object_clip_set(sd->bg, sd->clip);
    evas_object_smart_member_add(sd->bg, obj);
    evas_object_show(sd->bg);

    sd->overlay = edje_object_add(evas_object_evas_get(obj));
    edje_object_file_set(sd->overlay, "../../data/themes/elexika.edj", "overlay");
    evas_object_move(sd->overlay, 0, 0);
    evas_object_clip_set(sd->overlay, sd->clip);
    evas_object_smart_member_add(sd->overlay, obj);
    evas_object_show(sd->overlay);

    evas_object_smart_data_set(obj, sd);
}
void
elexika_result_list_append(Evas_Object *obj, Eina_List *list)
{
    Evas_Object *o;
    Smart_Data *sd;
    Evas_Coord minw, minh;
    Eina_List *l;
    Match *match;

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

    for (l = list; l; l = l->next) {
        match = l->data;
        o = edje_object_add(evas_object_evas_get(sd->obj));
        edje_object_file_set(o, "../../data/themes/elexika.edj", "result");
        edje_object_part_text_set(o, "result.text", match->str);

        evas_object_clip_set(o, sd->clip);
        evas_object_smart_member_add(o, obj);
        sd->children = eina_list_append(sd->children, o);
        if (eina_list_count(sd->children) % 2 == 0)
            edje_object_signal_emit(o, "result,state,even", "result_list");

        evas_object_stack_below(o, sd->overlay);
        evas_object_show(o);
    }

    _sizing_eval(obj);
}
Beispiel #3
0
static Oid *
_oid_track(Edje * ed, Evas_Object * o)
{
   Oid *oi;

   char buf[64];

   SI_RETURN(NULL);

   oi = calloc(1, sizeof(Oid));
   if (!oi)
      return NULL;
   oi->oid = _oid_alloc(ed);
   if (!oi->oid)
     {
	free(oi);
	return NULL;
     }
   oi->ed = ed;
   oi->obj = o;
   evas_object_smart_member_add(oi->obj, oi->ed->obj);
   evas_object_clip_set(oi->obj, oi->ed->base->clipper);
   evas_object_geometry_get(oi->obj, &(oi->x), &(oi->y), &(oi->w), &(oi->h));
   snprintf(buf, sizeof(buf), "%i", oi->oid);
   if (!si->oid.hash)
      si->oid.hash = eina_hash_string_superfast_new(NULL);
   eina_hash_add(si->oid.hash, buf, oi);
   return oi;
}
Beispiel #4
0
/* local subsystem functions */
static E_Layout_Item *
_e_layout_smart_adopt(E_Smart_Data *sd, Evas_Object *obj)
{
   E_Layout_Item *li;

   li = evas_object_data_get(obj, "e_layout_data");
   if (li) e_layout_unpack(obj);
   li = calloc(1, sizeof(E_Layout_Item));
   if (!li) return NULL;
   li->sd = sd;
   li->obj = obj;
   /* defaults */
   li->x = 0;
   li->y = 0;
   li->w = 0;
   li->h = 0;
   evas_object_clip_set(obj, sd->clip);
   evas_object_smart_member_add(obj, li->sd->obj);
   evas_object_data_set(obj, "e_layout_data", li);
   evas_object_event_callback_add(obj, EVAS_CALLBACK_FREE,
				  _e_layout_smart_item_del_hook, NULL);
   if ((!evas_object_visible_get(sd->clip)) &&
       (evas_object_visible_get(sd->obj)))
     evas_object_show(sd->clip);
   return li;
}
/* ***************************************************************************
 *  other internals
 * ***************************************************************************/
static void 
_elitaire_card_shadow_on(Evas_Object * card)
{
    Elitaire_Card * data = NULL;

    data = (Elitaire_Card *) evas_object_smart_data_get(card);

    if (data) {
        Evas_Coord x, y, w, h, dy;
        int n;

        if (data->shadow) return;
            
        data->shadow = edje_object_add(data->eli->evas);
        evas_object_smart_member_add(data->shadow, card);
        if (!edje_object_file_set(data->shadow, data->eli->file, "elitaire/card/shadow"))
            fprintf(stderr, _("Elitaire Error: The shadow pic is missed!\n"));

        n = elitaire_card_chain_length_calc(card);
        dy = elitaire_card_offset_get(data->eli);

        evas_object_geometry_get(card, &x, &y, &w, &h);
        evas_object_move(data->shadow, x, y);
        evas_object_resize(data->shadow, w, h + n * dy);
        evas_object_clip_set(data->shadow, data->eli->clip);
        evas_object_show(data->shadow);
        evas_object_stack_below(data->shadow, data->image);
    }
}
Beispiel #6
0
static void
_smart_add(Evas_Object *obj)
{
    Smart_Data *sd;

    /* Initialize smart data and clipping */
    sd = calloc(1, sizeof(Smart_Data));
    if (!sd) return;
    sd->obj = obj;
    sd->parent = NULL;
    sd->clip = evas_object_rectangle_add(evas_object_evas_get(obj));
    evas_object_smart_member_add(sd->clip, obj);
   
    /* Set up edje object and canvas */
    sd->edje = edje_object_add(evas_object_evas_get(obj));
    edje_object_file_set(sd->edje, enscribi_theme_find("enscribi"), "enscribi/input");
    evas_object_move(sd->edje, 0, 0);
    evas_object_show(sd->edje);
    sd->canvas = enscribi_canvas_add(evas_object_evas_get(obj));
    edje_object_part_swallow(sd->edje, "canvas", sd->canvas);

    /* Set up callbacks */
    edje_object_signal_callback_add(sd->edje, "canvas,matches,updated", "canvas",
            _enscribi_input_frame_cb_matches, sd);
    edje_object_signal_callback_add(sd->edje, "result,finished", "result",
            _enscribi_input_frame_cb_finished, sd);

    evas_object_smart_data_set(obj, sd);
}
Beispiel #7
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);
}
Beispiel #8
0
/*==========================================================================
 * The two external functions, new and button set
 *========================================================================*/
EAPI Evas_Object *
esmart_draggies_new (Ecore_Evas * ee)
{
  Evas_Object *o = NULL;
  Evas_Object *result = NULL;
  Esmart_Draggies *data = NULL;

  if (!ee)
    return (NULL);
  if ((result = esmart_dragable_object_new (ecore_evas_get (ee))))
    {
       if ((data = evas_object_smart_data_get (result)))
	 {
	    data->ee = ee;
	    o = evas_object_rectangle_add (ecore_evas_get (ee));
	    evas_object_color_set (o, 255, 255, 255, 0);
	    evas_object_repeat_events_set (o, 1);
	    evas_object_event_callback_add (o, EVAS_CALLBACK_MOUSE_DOWN,
		  _mouse_down_cb, data);
	    evas_object_event_callback_add (o, EVAS_CALLBACK_MOUSE_UP,
		  _mouse_up_cb, data);
	    evas_object_event_callback_add (o, EVAS_CALLBACK_MOUSE_MOVE,
		  _mouse_move_cb, data);
	    data->obj = o;

	    evas_object_smart_member_add(o, result);
	 }
    }
  return (result);
}
Beispiel #9
0
EAPI Eina_Bool
e_icon_file_edje_set(Evas_Object *obj, const char *file, const char *part)
{
   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 */
   if (sd->obj) evas_object_del(sd->obj);
   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_TRUE;

   sd->obj = edje_object_add(evas_object_evas_get(obj));
   edje_object_file_set(sd->obj, file, part);
   if (edje_object_load_error_get(sd->obj) != EDJE_LOAD_ERROR_NONE)
     return EINA_FALSE;
   if (evas_object_visible_get(obj)) evas_object_show(sd->obj);
   evas_object_smart_member_add(sd->obj, obj);
   _e_icon_smart_reconfigure(sd);
   return EINA_TRUE;
}
Beispiel #10
0
EAPI void
e_icon_edje_object_set(Evas_Object *obj, Evas_Object *edje)
{
   E_Smart_Data *sd;

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

   /* smart code here */
   if (sd->obj) evas_object_del(sd->obj);
   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_TRUE;
   sd->obj = edje;

   if (evas_object_visible_get(obj)) evas_object_show(sd->obj);
   evas_object_smart_member_add(sd->obj, obj);
   _e_icon_smart_reconfigure(sd);
}
Beispiel #11
0
static void
_e_icon_obj_prepare(Evas_Object *obj, E_Smart_Data *sd)
{
   if (!sd->obj) return;

   if (sd->edje)
     {
        Evas_Object *pclip;

        pclip = evas_object_clip_get(sd->obj);
        evas_object_del(sd->obj);
#ifdef USE_ICON_CACHE
        sd->ci = NULL;
        eina_stringshare_replace(&sd->file, NULL);
#endif
        sd->obj = evas_object_image_add(evas_object_evas_get(obj));
        if (!sd->animated)
          evas_object_image_scale_hint_set(sd->obj,
                                           EVAS_IMAGE_SCALE_HINT_STATIC);
        evas_object_smart_member_add(sd->obj, obj);
        evas_object_event_callback_add(sd->obj, EVAS_CALLBACK_IMAGE_PRELOADED,
                                       _e_icon_preloaded, obj);
        evas_object_clip_set(sd->obj, pclip);
     }
}
Beispiel #12
0
void eyelight_viewer_slideshow_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_SLIDESHOW;
    pres->slideshow_current = select;

    o = edje_object_add(pres->evas);
    pres->slideshow_background = o;
    if(edje_object_file_set(o, pres->theme, "eyelight/slideshow") ==  0)
        WARN("eyelight_viewer_slideshow_start(), edje_object_file_set() erreur!");

    data = edje_object_data_get(o, "nb_slides");
    pres->slideshow_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_smart_member_add(o, pres->smart_obj);
    evas_object_move(o, pres->current_pos_x, pres->current_pos_y);
    evas_object_clip_set(o, pres->current_clip);

    edje_object_signal_callback_add(o,"slideshow,slide,next","eyelight",_eyelight_viewer_slideshow_next_cb,pres);
    edje_object_signal_callback_add(o,"slideshow,slide,previous","eyelight",_eyelight_viewer_slideshow_previous_cb,pres);
    edje_object_signal_callback_add(o,"slideshow,next,end","eyelight",_eyelight_viewer_slideshow_next_end_cb,pres);
    edje_object_signal_callback_add(o,"slideshow,previous,end","eyelight",_eyelight_viewer_slideshow_previous_end_cb,pres);

    _eyelight_viewer_slideshow_slides_load(pres);
    edje_object_signal_emit(pres->slideshow_background,
           "show","eyelight");
}
/**
 * Creates a new entry widget
 *
 * @param evas the evas where to add the new entry widget
 * @param text_location the location where to store the text of the entry.
 * @param func DOCUMENT ME!
 * @param data  DOCUMENT ME!
 * @param data2 DOCUMENT ME!
 * The current value will be used to initialize the entry
 * @return Returns the new entry widget
 */
EAPI Evas_Object *
e_widget_entry_add(Evas *evas, char **text_location, void (*func)(void *data, void *data2), void *data, void *data2)
{
   Evas_Object *obj, *o;
   E_Widget_Data *wd;
   Evas_Coord minw, minh;

   obj = e_widget_add(evas);

   e_widget_del_hook_set(obj, _e_wid_del_hook);
   e_widget_focus_hook_set(obj, _e_wid_focus_hook);
   e_widget_disable_hook_set(obj, _e_wid_disable_hook);

   wd = calloc(1, sizeof(E_Widget_Data));
   e_widget_data_set(obj, wd);
   wd->text_location = text_location;

   o = e_entry_add(evas);
   wd->o_entry = o;
   e_widget_sub_object_add(obj, o);
   e_widget_resize_object_set(obj, o);
   evas_object_show(o);

   evas_object_event_callback_add(o, EVAS_CALLBACK_KEY_DOWN, _e_wid_keydown, obj);
   evas_object_event_callback_add(o, EVAS_CALLBACK_MOVE, _e_wid_movresz, obj);
   evas_object_event_callback_add(o, EVAS_CALLBACK_RESIZE, _e_wid_movresz, obj);

   o = evas_object_rectangle_add(evas);
   wd->o_inout = o;
   evas_object_repeat_events_set(o, EINA_TRUE);
   evas_object_color_set(o, 0, 0, 0, 0);
   e_widget_sub_object_add(obj, o);
   evas_object_smart_member_add(o, obj);
   evas_object_show(o);

   evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _e_wid_focus_steal, obj);
   evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_IN, _e_wid_in, obj);
   evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_OUT, _e_wid_out, obj);

   o = wd->o_entry;
   if ((text_location) && (*text_location))
     e_entry_text_set(o, *text_location);

   e_entry_size_min_get(o, &minw, &minh);
   e_widget_size_min_set(obj, minw, minh);
   evas_object_size_hint_min_set(obj, minw, minh);

   wd->func = func;
   wd->data = data;
   wd->data2 = data2;
   evas_object_smart_callback_add(o, "changed", _e_wid_changed_cb, obj);

   return obj;
}
Beispiel #14
0
EAPI void
e_icon_object_set(Evas_Object *obj, Evas_Object *o)
{
   E_Smart_Data *sd;
   
   sd = evas_object_smart_data_get(obj);
   if (!sd) return;
   /* smart code here */
   if (sd->obj) evas_object_del(sd->obj);
   sd->obj = o;
   evas_object_smart_member_add(sd->obj, obj);
   _e_icon_smart_reconfigure(sd);   
}
Beispiel #15
0
EAPI void
e_icon_file_edje_set(Evas_Object *obj, const char *file, const char *part)
{
   E_Smart_Data *sd;
   
   sd = evas_object_smart_data_get(obj);
   if (!sd) return;
   /* smart code here */
   if (sd->obj) evas_object_del(sd->obj);
   sd->obj = edje_object_add(evas_object_evas_get(obj));
   edje_object_file_set(sd->obj, file, part);
   evas_object_smart_member_add(sd->obj, obj);
   _e_icon_smart_reconfigure(sd);
}
Beispiel #16
0
static void _smart_add(Evas_Object * obj)
{
    Smart_Data *sd;

    sd = calloc(1, sizeof(Smart_Data));
    if (!sd)
        return;

    sd->o_edje = edje_object_add(evas_object_evas_get(obj));
    edje_object_file_set(sd->o_edje, enna_config_theme_get(),
                         "activity/photo/panel_infos");
    evas_object_show(sd->o_edje);
    evas_object_smart_member_add(sd->o_edje, obj);
    evas_object_smart_data_set(obj, sd);
}
Beispiel #17
0
static void _smart_add(Evas_Object * obj)
{
    Smart_Data *sd;

    sd = calloc(1, sizeof(Smart_Data));
    if (!sd)
        return;
    sd->obj = evas_object_image_add(evas_object_evas_get(obj));
    sd->x = 0;
    sd->y = 0;
    sd->w = 0;
    sd->h = 0;
    evas_object_smart_member_add(sd->obj, obj);
    evas_object_smart_data_set(obj, sd);
}
static void _ewk_view_single_smart_add(Evas_Object *o)
{
    Ewk_View_Smart_Data *sd;

    _parent_sc.sc.add(o);

    sd = (Ewk_View_Smart_Data *)evas_object_smart_data_get(o);

    Evas_Object *clip = evas_object_rectangle_add(sd->base.evas);
    evas_object_clip_set(sd->backing_store, clip);
    evas_object_smart_member_add(clip, o);
    evas_object_show(clip);

    evas_object_event_callback_add
        (sd->backing_store, EVAS_CALLBACK_DEL, _ewk_view_single_on_del, clip);
}
Beispiel #19
0
static void
_smart_add (Evas_Object *obj)
{
  Smart_Dvi *sp;

  sp = calloc (1, sizeof (Smart_Dvi));
  if (!sp) return;

  sp->obj = evas_object_image_add (evas_object_evas_get (obj));
/*   evas_object_event_callback_add (sp->obj, EVAS_CALLBACK_MOUSE_MOVE, _mouse_move, sp); */
/*   evas_object_event_callback_add (sp->obj, EVAS_CALLBACK_MOUSE_DOWN, _mouse_down, sp); */
/*   evas_object_image_pixels_get_callback_set (sp->obj, _pixels_get, sp); */
  evas_object_smart_member_add (sp->obj, obj);

  evas_object_image_alpha_set (sp->obj, 0);
  evas_object_smart_data_set (obj, sp);
}
Beispiel #20
0
static void
_evas_smart_frame_smart_add(Evas_Object *o)
{
   EVAS_SMART_DATA_ALLOC(o, Evas_Smart_Frame_Data);

   //tmp color bg
   priv->bg = evas_object_rectangle_add(evas_object_evas_get(o));
   evas_object_color_set(priv->bg, bg_color[0] -= 5, bg_color[1] -= 5, bg_color[2] -= 5, 250);
   int bx,by,bw,bh;
   evas_object_geometry_get(priv->bg, &bx, &by, &bw, &bh);
   evas_object_move(priv->bg, bx + 1, by + 1);
   evas_object_resize(priv->bg,bw - 1, bh - 1);

   evas_object_smart_member_add(priv->bg, o);

   _evas_smart_frame_parent_sc->add(o);
}
Beispiel #21
0
/* Private Functions */
static void 
_e_toolbar_smart_add(Evas_Object *obj) 
{
   Evas *evas;
   E_Toolbar_Smart_Data *sd;
   Evas_Object *o;
   char buf[4096];
   
   if ((!obj) || !(evas = evas_object_evas_get(obj))) return;
   
   sd = malloc(sizeof(E_Toolbar_Smart_Data));
   if (!sd) return;
   sd->valign = 0.0;
   sd->path = NULL;
   
   evas_object_smart_data_set(obj, sd);

   snprintf(buf, sizeof(buf), "%s/fileman.edj", e_module_dir_get(conf_module));
   
   o = edje_object_add(evas);
   sd->o_base = o;
   if (!e_theme_edje_object_set(o, "base/theme/modules/fileman", 
				"modules/fileman/toolbar"))
     edje_object_file_set(o, buf, "modules/fileman/toolbar");
   evas_object_smart_member_add(o, obj);
   edje_object_size_min_calc(o, &sd->w, &sd->h);

   o = e_widget_button_add(evas, _("Up"), "widget/up_dir", 
			   _e_toolbar_btn_cb, obj, NULL);
   sd->o_btn = o;
   edje_object_part_swallow(sd->o_base, "e.swallow.button", o);
   evas_object_show(o);
   
   edje_object_part_text_set(sd->o_base, "e.text.location", _("Location:"));

   o = e_widget_entry_add(evas, &(sd->path), NULL, NULL, NULL);
   sd->o_entry = o;
   edje_object_part_swallow(sd->o_base, "e.swallow.entry", o);
   evas_object_show(o);
   
   evas_object_smart_callback_add(sd->o_entry, "key_down", 
				  _e_toolbar_key_down_cb, obj);
}
Beispiel #22
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 #23
0
static void
_e_layout_smart_add(Evas_Object *obj)
{
   E_Smart_Data *sd;
   
   sd = calloc(1, sizeof(E_Smart_Data));
   if (!sd) return;
   sd->obj = obj;
   sd->x = 0;
   sd->y = 0;
   sd->w = 0;
   sd->h = 0;
   sd->vw = 1;
   sd->vh = 1;
   sd->clip = evas_object_rectangle_add(evas_object_evas_get(obj));
   evas_object_smart_member_add(sd->clip, obj);
   evas_object_move(sd->clip, -100001, -100001);
   evas_object_resize(sd->clip, 200002, 200002);
   evas_object_color_set(sd->clip, 255, 255, 255, 255);
   evas_object_smart_data_set(obj, sd);
}
Beispiel #24
0
static void
_emotion_aspect_borders_apply(Evas_Object *obj, Smart_Data *sd, int w, int h, int iw, int ih)
{
   int x, y;

   evas_object_geometry_get(obj, &x, &y, NULL, NULL);

   /* applying calculated borders */
   if (sd->crop.l == 0 && sd->crop.r == 0 &&
       sd->crop.t == 0 && sd->crop.b == 0)
     {
	Evas_Object *old_clipper;
	if (sd->crop.clipper)
	  {
	     old_clipper = evas_object_clip_get(sd->crop.clipper);
	     evas_object_clip_unset(sd->obj);
	     evas_object_clip_set(sd->obj, old_clipper);
	     evas_object_del(sd->crop.clipper);
	     sd->crop.clipper = NULL;
	  }
     }
   else
     {
	if (!sd->crop.clipper)
	  {
	     Evas_Object *old_clipper;
	     sd->crop.clipper = evas_object_rectangle_add(
		evas_object_evas_get(obj));
	     evas_object_color_set(sd->crop.clipper, 255, 255, 255, 255);
	     evas_object_smart_member_add(sd->crop.clipper, obj);
	     old_clipper = evas_object_clip_get(sd->obj);
	     evas_object_clip_set(sd->obj, sd->crop.clipper);
	     evas_object_clip_set(sd->crop.clipper, old_clipper);
	     if (evas_object_visible_get(sd->obj))
	       evas_object_show(sd->crop.clipper);
	  }
     }
   _clipper_position_size_update(obj, x, y, w, h, iw, ih);
}
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 #26
0
/* local subsystem functions */
static E_Table_Item *
_e_table_smart_adopt(E_Smart_Data *sd, Evas_Object *obj)
{
   E_Table_Item *ti;

   ti = calloc(1, sizeof(E_Table_Item));
   if (!ti) return NULL;
   ti->sd = sd;
   ti->obj = obj;
   /* defaults */
   ti->col = 0;
   ti->row = 0;
   ti->colspan = 1;
   ti->rowspan = 1;
   ti->fill_w = 0;
   ti->fill_h = 0;
   ti->expand_w = 0;
   ti->expand_h = 0;
   ti->align.x = 0.5;
   ti->align.y = 0.5;
   ti->min.w = 0;
   ti->min.h = 0;
   ti->max.w = 0;
   ti->max.h = 0;
   evas_object_clip_set(obj, sd->clip);
//   evas_object_stack_above(obj, sd->obj);
   evas_object_smart_member_add(obj, ti->sd->obj);
   evas_object_data_set(obj, "e_table_data", ti);
   evas_object_event_callback_add(obj, EVAS_CALLBACK_FREE,
                                  _e_table_smart_item_del_hook, NULL);
//   evas_object_stack_below(obj, sd->obj);
   if ((!evas_object_visible_get(sd->clip)) &&
       (evas_object_visible_get(sd->obj)))
     evas_object_show(sd->clip);
   return ti;
}
Beispiel #27
0
int
etox_line_wrap(Etox *et, Etox_Line *line)
{
	Eina_List *ll;
	Evas_Object *bit = NULL, *marker, *split_bit = NULL;
	Evas_Coord x, w, y, h;
	int index = -1, ok = 0;
	char *tmp;

#ifdef DEBUG
	printf("etox_line_wrap() - trying to wrap line:\n");
	etox_line_print_bits(line);
#endif

   ok= 1;
   for (ll = line->bits; ll && ok; ll = ll->next)
     {
	bit = ll->data;
	
	tmp = etox_style_get_text(bit);
	evas_object_geometry_get(bit, &x, &y, &w, &h);

	/* if we are down to 1 character... or 1 char +space - abort */
	if (
	    (strlen(tmp) <= 1) ||
	    ((strlen(tmp) == 2) && (tmp[1] == ' '))
	    ) {
	     if (w > et->w) {
		  ok = 0;
#ifdef DEBUG
		  printf("etox_line_wrap() - WARNING: Could not wrap line - etox too small!!\n");
#endif
	       }
	  }
	FREE(tmp);

        /* Find the bit that is on the border (right edje of the etox) */
	if (x + w > et->x + et->w) {
           split_bit = bit;
           break;
        }
     }

   if (!ok) {
      return -1;
   }

   if (!split_bit) {
#ifdef DEBUG
      printf("etox_line_wrap() - WARNING: Could not find the bit to split. Line "
             "width is probably wrong.\n");
#endif
      return -1;
   }

	/* get the index of the character on the edge */
	bit = split_bit;
	if (bit)
		index = etox_style_text_at_position(bit, et->x + et->w, y + (h / 2),
				NULL, NULL, NULL, NULL);
	if (index == -1) {
#ifdef DEBUG
	   printf("etox_line_wrap() - WARNING: Could not find the character within the "
	          "bit to split on. bit geometry is probably wrong?.\n");
#endif
	   return -1;
	}

	/* Adjust the index to find the actual character we want to wrap. Invalid
         * wrap locations:
         *  - index 0 of the first bit
         *  - index 0 of the second bit if this is a wrapped line
         */
	if (index > 0 ||
            (!(bit == line->bits->data) &&
             !(line->flags & ETOX_LINE_WRAPPED && bit == line->bits->next->data))) {
		char *tmp;

		tmp = etox_style_get_text(bit);

		/* If word wrap is on, back up to some whitespace */
		if (et->flags & ETOX_BREAK_WORDS) {
                        Evas_Object *original_bit = bit;
                        int space_index = index;
                        int done = 0;
                        int found_space = 0;

                        /* Back up until we find the proper word wrap index/bit */
			while (!done) {

                           /* If this is a space, we're done! */
                           if (isspace(tmp[space_index])) {
                              found_space = 1;
                              done = 1;
                           }

                           /* If this is the beginning of the bit and it is not the
                            * first bit, back up into the previous bit */
                           else if (space_index == 0 && bit != line->bits->data) {
                              ll = ll->prev;
                              bit = ll->data;
                              FREE(tmp);
                              tmp = etox_style_get_text(bit);
                              space_index = strlen(tmp) - 1;
                              if (space_index < 0) space_index = 0;
                           }

                           /* If we're at the beginning of the line - give up! */
                           else if (space_index == 0) {
                              done = 1;
                              /* Point to the original bit */
                              bit = original_bit;
                              FREE(tmp);
                              tmp = etox_style_get_text(bit);
#ifdef DEBUG
                              printf("etox_line_wrap() - WARNING: Could not word wrap line - "
			             "reverting to soft wrap.\n");
#endif
                           }

                           /* If this is not the beginning of the bit, back up */
                           else if (space_index > 0) {
                              space_index--;
                           }

			}

			/* If a space was found, then use it, otherwise revert to
 			   simple soft wrap and wrap at the character on the edge */
			if (found_space) {
			   index = space_index;
			}
		}

		/* don't start a new line with a space */
		while (index < strlen(tmp) && isspace(tmp[index]))
			index++;

		FREE(tmp);
	}

	/* Wrap if we've found a reasonable position. Invalid wrap locations:
	 *  - index 0 of the first bit
	 *  - index 0 of the second bit if this is a wrapped line
	 */
	if (index > 0 ||
	    (!(bit == line->bits->data) &&
	     !(line->flags & ETOX_LINE_WRAPPED && bit == line->bits->next->data))) {
#ifdef DEBUG
		char *tmp = etox_style_get_text(bit);
		printf("etox_line_wrap() - going to split line at index %d of bit:"
		       "(%s)\n", index, tmp);
		FREE(tmp);
#endif
		etox_line_split(line, bit, index);
		ll = eina_list_data_find_list(et->lines, line);
		ll = ll->next;

		/* create a marker bit. */
		marker = etox_style_new(et->evas, et->context->marker.text,
				et->context->marker.style);
		etox_style_set_type(marker, ETOX_BIT_TYPE_WRAP_MARKER);
		evas_object_smart_member_add(marker, et->smart_obj);
		evas_object_color_set(marker, et->context->marker.r,
				et->context->marker.g,
				et->context->marker.b,
				et->context->marker.a);
		evas_object_clip_set(marker, et->clip);
		etox_style_set_font(marker, et->context->font,
				et->context->font_size);
		evas_object_show(marker);
		if (et->context->marker.placement == ETOX_MARKER_BEGINNING)
			etox_line_prepend(ll->data, marker);
		else
			etox_line_append(line, marker);
	}
	else
		index = -1;

#ifdef DEBUG
		printf("etox_line_wrap() - done\n");
#endif
	return index;
}
Beispiel #28
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;
}
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);
}
Beispiel #30
0
void eyelight_viewer_slideshow_smart_obj_set(Eyelight_Viewer* pres,Evas_Object *obj)
{
    evas_object_smart_member_add(pres->slideshow_background,obj);
}