Esempio n. 1
0
static Eina_Bool _setup(Enesim_Renderer *r, Enesim_Log **error)
{
	Progressbar *thiz;
	Enesim_Matrix matrix;
	double ox, oy;

	thiz = _progressbar_get(r);
	/* the matrix */
	enesim_renderer_transformation_get(r, &matrix);
	enesim_renderer_transformation_set(thiz->widget.rectangle, &matrix);
	/* the origin */
	enesim_renderer_origin_get(r, &ox, &oy);
	enesim_renderer_origin_set(thiz->widget.rectangle, ox + 1, oy + 1);

	/* if we are at zero progression level just draw the background and not the bar */
	enesim_renderer_compound_layer_clear(thiz->widget.content);
	enesim_renderer_compound_layer_add(thiz->widget.content, thiz->content.background);
	if (thiz->progression > 0.0)
	{
		enesim_renderer_compound_layer_add(thiz->widget.content, thiz->content.bar);
	}
	_progressbar_update_size(r);

	return EINA_TRUE;
}
Esempio n. 2
0
static void _basic_scrollbar_arrow_decrement_set(Eon_Theme_Widget *t, Enesim_Renderer *arrow_decrement)
{
	Eon_Basic_Scrollbar *thiz;

	thiz = _scrollbar_get(t);
	if (thiz->arrow_decrement)	
		enesim_renderer_compound_layer_remove(thiz->compound, thiz->arrow_decrement);
	enesim_renderer_compound_layer_add(thiz->compound, arrow_decrement);
	thiz->arrow_decrement = arrow_decrement;
}
Esempio n. 3
0
static void _basic_scrollbar_thumb_area_set(Eon_Theme_Widget *t, Enesim_Renderer *thumb_area)
{
	Eon_Basic_Scrollbar *thiz;

	thiz = _scrollbar_get(t);
	if (thiz->thumb_area)	
		enesim_renderer_compound_layer_remove(thiz->compound, thiz->thumb_area);
	enesim_renderer_compound_layer_add(thiz->compound, thumb_area);
	thiz->thumb_area = thumb_area;
}
Esempio n. 4
0
static void _eon_theme_mars_radio_content_set(void *data, Enesim_Renderer *r)
{
	Eon_Theme_Mars_Radio *thiz = data;
	Enesim_Renderer_Compound_Layer *l;

	enesim_renderer_compound_layer_clear(thiz->radio);
	/* the radio button */
	l = enesim_renderer_compound_layer_new();
	enesim_renderer_compound_layer_renderer_set(l, enesim_renderer_ref(thiz->border));
	enesim_renderer_compound_layer_rop_set(l, ENESIM_ROP_BLEND);
	enesim_renderer_compound_layer_add(thiz->radio, l);
	/* the content */
	if (r)
	{
		l = enesim_renderer_compound_layer_new();
		enesim_renderer_compound_layer_renderer_set(l, r);
		enesim_renderer_compound_layer_rop_set(l, ENESIM_ROP_BLEND);
		enesim_renderer_compound_layer_add(thiz->radio, l);
	}
}
Esempio n. 5
0
/*============================================================================*
 *                                 Global                                     *
 *============================================================================*/
Egueb_Dom_Node * eon_theme_mars_radio_new(void)
{
	Eon_Theme_Mars_Radio *thiz;
	Egueb_Dom_Node *n;
	Egueb_Dom_String *s;
	Enesim_Renderer_Compound_Layer *l;

	thiz = calloc(1, sizeof(Eon_Theme_Mars_Radio));
	/* the radio button */
	thiz->button = enesim_renderer_circle_new();
	enesim_renderer_circle_radius_set(thiz->button, 3);
	enesim_renderer_shape_draw_mode_set(thiz->button, ENESIM_RENDERER_SHAPE_DRAW_MODE_FILL);

	thiz->border = enesim_renderer_circle_new();
	enesim_renderer_circle_radius_set(thiz->border, 7);
	enesim_renderer_shape_stroke_weight_set(thiz->border, 2);
	enesim_renderer_shape_draw_mode_set(thiz->border, ENESIM_RENDERER_SHAPE_DRAW_MODE_STROKE_FILL);
	enesim_renderer_shape_fill_renderer_set(thiz->border, enesim_renderer_ref(thiz->button));

	/* the button and the content */
	thiz->radio = enesim_renderer_compound_new();
	l = enesim_renderer_compound_layer_new();
	enesim_renderer_compound_layer_renderer_set(l, enesim_renderer_ref(thiz->border));
	enesim_renderer_compound_layer_rop_set(l, ENESIM_ROP_BLEND);
	enesim_renderer_compound_layer_add(thiz->radio, l);

	/* the widget area */
	thiz->area = enesim_renderer_rectangle_new();
	enesim_renderer_shape_draw_mode_set(thiz->area, ENESIM_RENDERER_SHAPE_DRAW_MODE_FILL);
	enesim_renderer_shape_fill_renderer_set(thiz->area, enesim_renderer_ref(thiz->radio));

	/* the blur effect for disabled buttons */
	thiz->blur = enesim_renderer_blur_new();
	enesim_renderer_blur_radius_x_set(thiz->blur, 3);
	enesim_renderer_blur_radius_y_set(thiz->blur, 3);

	thiz->proxy = enesim_renderer_proxy_new();
	enesim_renderer_proxy_proxied_set(thiz->proxy, enesim_renderer_ref(thiz->area));

	n = eon_theme_element_button_new(&_descriptor, thiz);
	/* the attributes */
	s = egueb_dom_string_new_with_static_chars("border-color");
	thiz->border_color = egueb_css_attr_color_new(s, NULL, EINA_TRUE,
			EINA_TRUE, EINA_FALSE);
	s = egueb_dom_string_new_with_static_chars("button-color");
	thiz->button_color = egueb_css_attr_color_new(s, NULL, EINA_TRUE,
			EINA_TRUE, EINA_FALSE);
	egueb_dom_element_attribute_node_set(n, egueb_dom_node_ref(thiz->border_color), NULL);
	egueb_dom_element_attribute_node_set(n, egueb_dom_node_ref(thiz->button_color), NULL);
	thiz->n = n;

	return n;
}
Esempio n. 6
0
/*============================================================================*
 *                                   API                                      *
 *============================================================================*/
EAPI Eon_Theme_Widget * eon_theme_basic_scrollbar_new(void)
{
	Eon_Theme_Widget *t;
	Eon_Basic_Scrollbar *thiz;
	Enesim_Renderer *r;

	thiz = calloc(1, sizeof(Eon_Basic_Scrollbar));
	if (!thiz) return NULL;

	r = enesim_renderer_background_new();
	if (!r) goto background_err;
	enesim_renderer_rop_set(r, ENESIM_BLEND);
	enesim_renderer_background_color_set(r, 0xffff0000);
	thiz->background = r;

	r = enesim_renderer_compound_new();
	if (!r) goto compound_err;
	thiz->compound = r;
	enesim_renderer_compound_layer_add(r, thiz->background);

	r = enesim_renderer_rectangle_new();
	if (!r) goto shape_err;
	thiz->shape = r;
	enesim_renderer_shape_fill_renderer_set(r, thiz->compound);
	enesim_renderer_shape_stroke_weight_set(r, 1.0);
	enesim_renderer_shape_stroke_color_set(r, 0xff000000);
	enesim_renderer_shape_draw_mode_set(r, ENESIM_SHAPE_DRAW_MODE_STROKE_FILL);
	enesim_renderer_rop_set(r, ENESIM_BLEND);

	t = eon_theme_scrollbar_new(&_descriptor, thiz);
	if (!t) goto base_err;

	return t;
base_err:
	enesim_renderer_unref(thiz->shape);
shape_err:
	enesim_renderer_unref(thiz->compound);
compound_err:
	enesim_renderer_unref(thiz->background);
background_err:
	free(thiz);
	return NULL;
}
Esempio n. 7
0
static void ender_clicked(Ender_Element *e, const char *event_name, void *event_data,
		void *data)
{
	Escen_Viewer *thiz = data;
	Escen_Ender *new_escen_ender;
	Escen_Instance *new_instance;
	Ender_Element *new_ender;
	Ender_Element *label;
	Enesim_Renderer *r;
	const char *string = NULL;

	eon_bin_child_get(e, &label);
	if (!label) return;
	eon_label_text_get(label, &string);

	new_escen_ender = escen_ender_get(thiz->escen, string);
	if (!new_escen_ender) return;

	new_instance = escen_instance_new(new_escen_ender, EINA_TRUE);
	new_ender = escen_instance_ender_get(new_instance);
	/* TODO remove the old instance */
	//escen_instance_delete(thiz->current_instance);
	thiz->current_instance = new_instance;
	thiz->current_escen_ender = new_escen_ender;
	thiz->current_ender = new_ender;
	r = ender_element_object_get(thiz->current_ender);
	enesim_renderer_rop_set(r, ENESIM_BLEND);
	enesim_renderer_compound_layer_add(thiz->compound, r);

	/* FIXME we should not set this */
	enesim_renderer_compound_layer_remove(thiz->compound, thiz->current_renderer);
	thiz->current_renderer = r;

	/* just replace what we have as content of the scene area */
	populate_states(thiz, thiz->states_stack, thiz->current_escen_ender);
}
Esempio n. 8
0
EAPI Enesim_Renderer *
echart_line_renderer_get(const Echart_Line *line)
{
    const Echart_Chart *chart;
    const Echart_Data *data;
    const Echart_Data_Item *absciss;
    const Echart_Data_Item *item;
    Enesim_Renderer *c;
    Enesim_Renderer *r;
    Enesim_Renderer *r_first;
    Enesim_Renderer_Compound_Layer *l;
    Enesim_Text_Font *f;
    Enesim_Text_Engine *e;
    Enesim_Rectangle geom;
    Enesim_Path *p;
    Enesim_Color color;
    Eina_Rectangle rect_first;
    Eina_Rectangle rect;
    const char *title;
    double avmin;
    double avmax;
    int grid_x_nbr;
    int grid_y_nbr;
    int sub_grid_x_nbr;
    int sub_grid_y_nbr;
    int x_area;
    int y_area;
    int w_area;
    int h_area;
    int w;
    int h;
    unsigned int i;
    unsigned int j;

    if (!line)
        return NULL;

    chart = line->chart;

    if (line->stacked)
      data = echart_data_stacked_get(echart_chart_data_get(chart));
    else
      data = echart_chart_data_get(chart);
    if (!data)
    {
        ERR("A chart must have at least a data");
        return NULL;
    }

    if (echart_data_items_count(data) < 2)
    {
        ERR("Data must have at least 2 items");
        return NULL;
    }

    echart_chart_size_get(chart, &w, &h);

    c = enesim_renderer_compound_new();

    e = enesim_text_engine_default_get();
    f = enesim_text_font_new_description_from(e, "arial", 16);
    enesim_text_engine_unref(e);

    /* background */
    r = enesim_renderer_rectangle_new();
    enesim_renderer_rectangle_position_set(r, 0, 0);
    enesim_renderer_rectangle_size_set(r, w, h);
    enesim_renderer_shape_fill_color_set(r, echart_chart_background_color_get(chart));
    enesim_renderer_shape_draw_mode_set(r, ENESIM_RENDERER_SHAPE_DRAW_MODE_FILL);

    l = enesim_renderer_compound_layer_new();
    enesim_renderer_compound_layer_renderer_set(l, r);
    enesim_renderer_compound_layer_rop_set(l, ENESIM_ROP_FILL);
    enesim_renderer_compound_layer_add(c, l);

    /* title */
    h_area = 0;
    title = echart_data_title_get(data);
    if (title)
    {
        r = enesim_renderer_text_span_new();
        enesim_renderer_color_set(r, 0xff000000);
        enesim_renderer_text_span_text_set(r, title);
        enesim_renderer_text_span_font_set(r, f);

        enesim_renderer_shape_destination_geometry_get(r, &geom);
        enesim_renderer_origin_set(r, (w - geom.w) / 2, 0);
        enesim_rectangle_normalize(&geom, &rect);
        h_area = rect.h;

        ECHART_RENDERER_LAYER_ADD(c, l, r);
    }

    /* abscisses */

    absciss = echart_data_absciss_get(data);
    echart_data_item_interval_get(absciss, &avmin, &avmax);

    r_first = _echart_line_text_renderer_from_double(f, *(double *)eina_list_nth(echart_data_item_values_get(absciss), 0));

    enesim_renderer_shape_destination_geometry_get(r_first, &geom);
    enesim_renderer_origin_set(r_first, 0, h - geom.h);
    enesim_rectangle_normalize(&geom, &rect_first);
    x_area = rect_first.w / 2 + 1;
    y_area = rect_first.h;

    ECHART_RENDERER_LAYER_ADD(c, l, r_first);

    r = _echart_line_text_renderer_from_double(f, *(double *)eina_list_nth(echart_data_item_values_get(absciss), eina_list_count(echart_data_item_values_get(absciss)) - 1));

    enesim_renderer_shape_destination_geometry_get(r, &geom);
    enesim_renderer_origin_set(r, w - geom.w, h - geom.h);
    enesim_rectangle_normalize(&geom, &rect);
    w_area = w - (rect_first.w + rect.w) / 2;
    if (y_area < rect.h)
        y_area = rect.h;

    ECHART_RENDERER_LAYER_ADD(c, l, r);

    for (i = 1; i < eina_list_count(echart_data_item_values_get(absciss)) - 1; i++)
    {
        double d1;

        r = _echart_line_text_renderer_from_double(f, *(double *)eina_list_nth(echart_data_item_values_get(absciss), i));

        d1 = *(double *)eina_list_nth(echart_data_item_values_get(absciss), i);
        d1 = x_area + w_area * (d1 - avmin) / (avmax - avmin);

        enesim_renderer_shape_destination_geometry_get(r, &geom);
        enesim_renderer_origin_set(r, d1 - geom.w / 2, h - geom.h);
        enesim_rectangle_normalize(&geom, &rect);
        if (y_area < rect.h)
            y_area = rect.h;

        ECHART_RENDERER_LAYER_ADD(c, l, r);
    }
    h_area = h - y_area - h_area;

    /* grid */
    echart_chart_grid_nbr_get(chart, &grid_x_nbr, &grid_y_nbr);
    for (i = 0; i < (unsigned int)grid_x_nbr; i++)
    {
        r = enesim_renderer_line_new();
        enesim_renderer_line_coords_set(r,
                                        x_area + (i * w_area) / (double)(grid_x_nbr - 1), h - y_area,
                                        x_area + (i * w_area) / (double)(grid_x_nbr - 1), h - h_area - y_area);
        enesim_renderer_shape_stroke_weight_set(r, 1);
        if (i == 0)
            enesim_renderer_shape_stroke_color_set(r, 0xff000000);
        else
            enesim_renderer_shape_stroke_color_set(r, echart_chart_grid_color_get(chart));
        enesim_renderer_shape_draw_mode_set(r, ENESIM_RENDERER_SHAPE_DRAW_MODE_STROKE);

        ECHART_RENDERER_LAYER_ADD(c, l, r);
    }

    for (i = 0; i < (unsigned int)grid_y_nbr; i++)
    {
        r = enesim_renderer_line_new();
        enesim_renderer_line_coords_set(r,
                                        x_area + 1, h - y_area - (i * h_area) / (double)(grid_y_nbr - 1),
                                        x_area + w_area, h - y_area - (i * h_area) / (double)(grid_y_nbr - 1));
        enesim_renderer_shape_stroke_weight_set(r, 1);
        if (i == 0)
            enesim_renderer_shape_stroke_color_set(r, 0xff000000);
        else
            enesim_renderer_shape_stroke_color_set(r, echart_chart_grid_color_get(chart));
        enesim_renderer_shape_draw_mode_set(r, ENESIM_RENDERER_SHAPE_DRAW_MODE_STROKE);

        ECHART_RENDERER_LAYER_ADD(c, l, r);
    }

    /* sub grid */
    echart_chart_sub_grid_nbr_get(chart, &sub_grid_x_nbr, &sub_grid_y_nbr);
    for (i = 0; i < (unsigned int)grid_x_nbr; i++)
    {
        for (j = 1; (int)j < (sub_grid_x_nbr - 1); j++)
        {
            p = enesim_path_new();
            enesim_path_move_to(p, x_area + w_area * (j + i * (sub_grid_x_nbr - 1)) / (double)((grid_x_nbr - 1) * (sub_grid_x_nbr - 1)), h - h_area - y_area + 1);
            enesim_path_line_to(p, x_area + w_area * (j + i * (sub_grid_x_nbr - 1)) / (double)((grid_x_nbr - 1) * (sub_grid_x_nbr - 1)), h - y_area);

            r = enesim_renderer_path_new();
            enesim_renderer_path_path_set(r, p);
            enesim_renderer_shape_stroke_weight_set(r, 1);
            enesim_renderer_shape_stroke_dash_add_simple(r, 10, 8);
            enesim_renderer_shape_stroke_color_set(r, echart_chart_sub_grid_color_get(chart));
            enesim_renderer_shape_draw_mode_set(r, ENESIM_RENDERER_SHAPE_DRAW_MODE_STROKE);

            ECHART_RENDERER_LAYER_ADD(c, l, r);
        }
    }

    for (i = 0; i < (unsigned int)grid_y_nbr; i++)
    {
        for (j = 1; (int)j < (sub_grid_y_nbr - 1); j++)
        {
            p = enesim_path_new();
            enesim_path_move_to(p, x_area + 1, h - y_area - h_area * (j + i * (sub_grid_y_nbr - 1)) / (double)((grid_y_nbr - 1) * (sub_grid_y_nbr - 1)));
            enesim_path_line_to(p, x_area + w_area, h - y_area - h_area * (j + i * (sub_grid_y_nbr - 1)) / (double)((grid_y_nbr - 1) * (sub_grid_y_nbr - 1)));

            r = enesim_renderer_path_new();
            enesim_renderer_path_path_set(r, p);
            enesim_renderer_shape_stroke_weight_set(r, 1);
            enesim_renderer_shape_stroke_dash_add_simple(r, 10, 8);
            enesim_renderer_shape_stroke_color_set(r, echart_chart_sub_grid_color_get(chart));
            enesim_renderer_shape_draw_mode_set(r, ENESIM_RENDERER_SHAPE_DRAW_MODE_STROKE);

            ECHART_RENDERER_LAYER_ADD(c, l, r);
        }
    }

    /* area */
    if (line->area)
    {
        for (j = 1; j < echart_data_items_count(data); j++)
        {
            double vmin;
            double vmax;
            double d1;
            double d2;
            uint8_t ca, cr, cg, cb;

            item = echart_data_items_get(data, j);
            echart_data_item_interval_get(item, &vmin, &vmax);

            p = enesim_path_new();
            enesim_path_move_to(p, x_area + 1, h - y_area);
            for (i = 0; i < eina_list_count(echart_data_item_values_get(item)); i++)
            {
                d1 = *(double *)eina_list_nth(echart_data_item_values_get(absciss), i);
                d1 = x_area + 1 + (w_area - 1) * (d1 - avmin) / (avmax - avmin);
                d2 = *(double *)eina_list_nth(echart_data_item_values_get(item), i);
                d2 = (h_area - 1) * (d2 - vmin) / (vmax - vmin);
                enesim_path_line_to(p, d1, h - y_area - d2);
            }
            enesim_path_line_to(p, x_area + w_area, h - y_area);
            enesim_path_close(p);

            r = enesim_renderer_path_new();
            enesim_renderer_path_path_set(r, p);
            enesim_argb_components_to(echart_data_item_color_get(item).area, &ca, &cr, &cg, &cb);
            ca = 220;
            enesim_color_components_from(&color, ca, cr, cg, cb);
            enesim_renderer_shape_fill_color_set(r, color);
            enesim_renderer_shape_draw_mode_set(r, ENESIM_RENDERER_SHAPE_DRAW_MODE_FILL);

            ECHART_RENDERER_LAYER_ADD(c, l, r);
        }
    }

    /* line */
    for (j = 1; j < echart_data_items_count(data); j++)
    {
        double vmin;
        double vmax;
        double d1;
        double d2;

        item = echart_data_items_get(data, j);
        echart_data_item_interval_get(item, &vmin, &vmax);
        printf("\n%d  %f  %f\n\n", j, vmin, vmax);

        p = enesim_path_new();
        for (i = 0; i < eina_list_count(echart_data_item_values_get(item)); i++)
        {
            d1 = *(double *)eina_list_nth(echart_data_item_values_get(absciss), i);
            d1 = x_area + 1 + (w_area - 1) * (d1 - avmin) / (avmax - avmin);
            d2 = *(double *)eina_list_nth(echart_data_item_values_get(item), i);
            d2 = h_area * (d2) / (vmax);
            if (i == 0)
                enesim_path_move_to(p, d1, h - y_area - d2);
            else
                enesim_path_line_to(p, d1, h - y_area - d2);
            printf("%d %d %f\n", j, i, h - y_area - d2);
        }

        r = enesim_renderer_path_new();
        enesim_renderer_path_path_set(r, p);
        enesim_renderer_shape_stroke_weight_set(r, 1);
        enesim_renderer_shape_stroke_color_set(r, echart_data_item_color_get(item).line);
        enesim_renderer_shape_draw_mode_set(r, ENESIM_RENDERER_SHAPE_DRAW_MODE_STROKE);

        ECHART_RENDERER_LAYER_ADD(c, l, r);
    }

    return c;
}
Esempio n. 9
0
static void draw_ui(Escen_Viewer *thiz)
{
	Ender_Element *e;
	Enesim_Surface *s;
	Enesim_Renderer *r;

	/* add a stack with the enders, make it scrollable */
	e = eon_stack_new();
	/* TODO make it scrollable */
	eon_stack_orientation_set(e, EON_ORIENTATION_VERTICAL);
	eon_container_child_add(thiz->container, e);
	thiz->enders_stack = e;

	/* add another stack with the states of each escen */
	/* TODO make it scrollable */
	e = eon_stack_new();
	eon_stack_orientation_set(e, EON_ORIENTATION_VERTICAL);
	eon_container_child_add(thiz->container, e);
	thiz->states_stack = e;

	/* the scene area */
	e = eon_scrollview_new();
	thiz->scene_area_scrollview = e;
	eon_container_child_add(thiz->container, e);
	eon_stack_child_weight_set(thiz->container, e, 1);

	e = eon_surface_new();
	thiz->scene_area = e;

	/* TODO use the backend to create the surface */
	s = enesim_surface_new(ENESIM_FORMAT_ARGB8888, 640, 480);
	thiz->s = s;
	eon_surface_source_set(e, s);
	eon_element_vertical_alignment_set(e, EON_VERTICAL_ALIGNMENT_TOP);
	eon_element_horizontal_alignment_set(e, EON_HORIZONTAL_ALIGNMENT_LEFT);
	eon_container_child_add(thiz->scene_area_scrollview, e);

	r = enesim_renderer_checker_new();
	enesim_renderer_checker_even_color_set(r, 0xffcccccc);
	enesim_renderer_checker_odd_color_set(r, 0xffffffff);
	enesim_renderer_checker_width_set(r, 10);
	enesim_renderer_checker_height_set(r, 10);
	enesim_renderer_rop_set(r, ENESIM_FILL);
	thiz->checker = r;

	r = enesim_renderer_compound_new();
	enesim_renderer_compound_layer_add(r, thiz->checker);
	enesim_renderer_rop_set(r, ENESIM_FILL);
	thiz->compound = r;

	/* set the default state */
	thiz->current_escen_ender = escen_ender_nth_get(thiz->escen, 0);
	thiz->current_instance = escen_instance_new(thiz->current_escen_ender, EINA_TRUE);
	escen_instance_state_set(thiz->current_instance, escen_ender_state_get(thiz->current_escen_ender, "default"));
	thiz->current_ender = escen_instance_ender_get(thiz->current_instance);
	thiz->current_renderer = ender_element_object_get(thiz->current_ender);

	/* FIXME we should not set this */
	enesim_renderer_rop_set(thiz->current_renderer, ENESIM_BLEND);
	enesim_renderer_compound_layer_add(thiz->compound, thiz->current_renderer);

	/* populate the radio buttons */
	populate_enders(thiz, thiz->enders_stack, thiz->escen);
	populate_states(thiz, thiz->states_stack, thiz->current_escen_ender);
}
Esempio n. 10
0
static Eina_Bool _eon_element_splitter_process(Eon_Renderable *r)
{
	Eon_Element_Splitter *thiz;
	Eon_Renderable_Size size;
	Eon_Orientation orientation;
	Eon_Box padding;
	Eon_Vertical_Align valign;
	Eon_Horizontal_Align halign;
	Egueb_Dom_Node *n;
	Egueb_Dom_Node *child;
	Eina_Rectangle geometry;
	Eina_Rectangle free_space;
	int size_hints;

	thiz = EON_ELEMENT_SPLITTER(r);
	n = (EON_ELEMENT(r))->n;

	free_space = r->geometry;
	DBG_ELEMENT(n, "Free space %" EINA_RECTANGLE_FORMAT, EINA_RECTANGLE_ARGS(&free_space));

	/* Regenerate the renderable tree */
	if (thiz->renderable_changed)
	{
		enesim_renderer_compound_layer_clear(thiz->r);
		child = egueb_dom_element_child_first_get(n);
		while (child)
		{
			Egueb_Dom_Node *tmp;

			if (!eon_is_renderable(child))
				goto next1;

			/* Add child renderer */
			if (thiz->renderable_changed)
			{
				Enesim_Renderer_Compound_Layer *l;
				Enesim_Renderer *ren;

				l = enesim_renderer_compound_layer_new();
				ren = eon_renderable_renderer_get(child);
				enesim_renderer_compound_layer_renderer_set(l, ren);
				enesim_renderer_compound_layer_rop_set(l, ENESIM_ROP_BLEND);
				enesim_renderer_compound_layer_add(thiz->r, l);
			}
next1:
			tmp = egueb_dom_element_sibling_next_get(child);
			egueb_dom_node_unref(child);
			child = tmp;
		}
		thiz->renderable_changed = EINA_FALSE;
	}
	/* Set the geometry on each child */
	egueb_dom_attr_final_get(thiz->orientation, &orientation);
	if (orientation == EON_ORIENTATION_HORIZONTAL)
		eon_layout_splitter_horizontal_size_geometry_set(n, &free_space,
				thiz->min_length, thiz->weights);
	else
		eon_layout_splitter_vertical_size_geometry_set(n, &free_space,
				thiz->min_length, thiz->weights);
	return EINA_TRUE;
}
Esempio n. 11
0
Enesim_Renderer * eon_theme_basic_progressbar_new(void)
{
	Progressbar *thiz;
	Enesim_Renderer *r;

	thiz = calloc(1, sizeof(Progressbar));
	if (!thiz) return NULL;

	/* first the bar content */
	r = enesim_renderer_stripes_new();
	if (!r) goto bar_content_pattern_err;
	thiz->bar_content.pattern = r;
	enesim_renderer_stripes_even_color_set(r, 0xffa1ff38);
	enesim_renderer_stripes_odd_color_set(r, 0xffb3ff00);
	enesim_renderer_stripes_even_thickness_set(r, 3);
	enesim_renderer_stripes_odd_thickness_set(r, 5);

	r = enesim_renderer_stripes_new();
	if (!r) goto bar_content_shade_err;
	thiz->bar_content.shade = r;
	enesim_renderer_stripes_even_color_set(r, 0);
	enesim_renderer_stripes_odd_color_set(r, 0x33000000);
	enesim_renderer_stripes_even_thickness_set(r, 1);
	enesim_renderer_stripes_odd_thickness_set(r, 1);

	/* now the bar itself */
	r = enesim_renderer_compound_new();
	if (!r) goto bar_content_err;
	thiz->bar.content = r;
	enesim_renderer_compound_layer_add(r, thiz->bar_content.pattern);
	enesim_renderer_rop_set(thiz->bar_content.pattern, ENESIM_FILL);
	enesim_renderer_compound_layer_add(r, thiz->bar_content.shade);
	enesim_renderer_rop_set(thiz->bar_content.shade, ENESIM_BLEND);

	/* now the content */
	r = enesim_renderer_rectangle_new();
	if (!r) goto content_bar_err;
	thiz->content.bar = r;
	enesim_renderer_rectangle_corners_set(r, EINA_TRUE, EINA_TRUE, EINA_TRUE, EINA_TRUE);
	enesim_renderer_rectangle_corner_radius_set(r, 5);
	enesim_renderer_shape_stroke_weight_set(r, 2);
	enesim_renderer_shape_stroke_color_set(r, 0xffa1ff38);
	enesim_renderer_shape_fill_renderer_set(r, thiz->bar.content);
	enesim_renderer_shape_draw_mode_set(r, ENESIM_SHAPE_DRAW_MODE_STROKE_FILL);

	r = enesim_renderer_background_new();
	if (!r) goto content_background_err;
	thiz->content.background = r;
	enesim_renderer_background_color_set(r, 0xffcccccc);

	/* now the widget */
	r = enesim_renderer_compound_new();
	if (!r) goto widget_content_err;
	thiz->widget.content = r;
	enesim_renderer_compound_layer_add(r, thiz->content.background);
	enesim_renderer_rop_set(thiz->content.background, ENESIM_FILL);
	enesim_renderer_compound_layer_add(r, thiz->content.bar);
	enesim_renderer_rop_set(thiz->content.bar, ENESIM_BLEND);

	r = enesim_renderer_rectangle_new();
	if (!r) goto widget_rectangle_err;
	thiz->widget.rectangle = r;
	enesim_renderer_rectangle_corners_set(r, EINA_TRUE, EINA_TRUE, EINA_TRUE, EINA_TRUE);
	enesim_renderer_rectangle_corner_radius_set(r, 5);
	enesim_renderer_shape_stroke_weight_set(r, 2);
	enesim_renderer_shape_stroke_color_set(r, 0xff555555);
	enesim_renderer_shape_fill_renderer_set(r, thiz->widget.content);
	enesim_renderer_shape_draw_mode_set(r, ENESIM_SHAPE_DRAW_MODE_STROKE_FILL);

	r = eon_theme_progressbar_new(&_descriptor, thiz);
	if (!r) goto renderer_err;

	return r;

renderer_err:
	enesim_renderer_unref(thiz->widget.rectangle);
widget_rectangle_err:
	enesim_renderer_unref(thiz->widget.content);
widget_content_err:
	enesim_renderer_unref(thiz->content.background);
content_background_err:
	enesim_renderer_unref(thiz->content.bar);
content_bar_err:
	enesim_renderer_unref(thiz->bar.content);
bar_content_err:
	enesim_renderer_unref(thiz->bar_content.shade);
bar_content_shade_err:
	enesim_renderer_unref(thiz->bar_content.pattern);
bar_content_pattern_err:
	free(thiz);
	return NULL;
}