If you use edje_object_size_min_calc() to calculate the minimum size of an edje group, the text that was former truncated, i.e. "Bla..." instead of "Blah Foo", becomes then simply cut of at the end of the edje object ("Blah ").

Attached you'll find a small example code and a little edc file for the label group. To see the effect, press with the mouse. on the label Notice if you remove the edje_object_size_min_calc()-line it works fine.

Regards, Peter
collections
{       
        group
        {
                name: "label";
                parts
                {
                        part
                        {
                                name: "textpart";
                                type: TEXT;

                                description
                                {
                                        state: "default" 0.0;
                                        align: 0.5 0.5;

                                        rel1
                                        {
                                                relative: 0.0 0.0;
                                                offset: 0 0;
                                        }
                                        rel2
                                        {
                                                relative: 1.0 1.0;
                                                offset: -1 -1;
                                        }
                                        text
                                        {
                                                text: "text";
                                                font: "DejaVu Sans";
                                                size: 12;
                                                min: 0 1;
                                                align: 0.5 0.5;
                                        }
                                        color: 0 0 0 255;
                                }

                        }
                }
        }
}

#include <Evas.h>
#include <Ecore.h>
#include <Ecore_Evas.h>
#include <Edje.h>
#include <stdio.h>

struct app {
        Evas *evas;
        Ecore_Evas *ee;
        Evas_Object *edje;
        Evas_Object *bg;
};
void
click(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
	Evas_Object *edje = data;
	Evas_Coord w, h;

	edje_object_part_text_set(edje, "textpart", "second string that is long");
	edje_object_size_min_calc(edje, &w, &h);
	printf("%d %d\n", w, h);
}

static void
destroy_main_window(Ecore_Evas *ee)
{
        ecore_main_loop_quit();
}

static void
resize_window(Ecore_Evas *ee)
{
        struct app *app;
        Evas_Coord w, h;

        ecore_evas_geometry_get(ee, NULL, NULL, &w, &h);

        app = ecore_evas_data_get(ee, "app");
        evas_object_resize(app->edje, w, h);
        evas_object_resize(app->bg, w, h);
}

int
main(int argc, char **argv)
{
        struct app app;
	Evas_Object *o;

        /*
         * initialize
         */
        evas_init();
        ecore_init();
        edje_init();
        ecore_evas_init();

        /*
         * setup ecore evas
         */
        app.ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 0, 0);
        ecore_evas_callback_delete_request_set(app.ee, destroy_main_window);
        ecore_evas_callback_resize_set(app.ee, resize_window);
        ecore_evas_show(app.ee);

        /*
         * get evas and setup the edje
         */
        app.evas = ecore_evas_get(app.ee);
        app.edje = edje_object_add(app.evas);

        /* background */
        app.bg = evas_object_rectangle_add(app.evas);
        evas_object_color_set(app.bg, 123, 123, 123, 255);
        evas_object_move(app.bg, 0, 0);
        evas_object_show(app.bg);

        if (!edje_object_file_set(app.edje, "label.edj", "label"))
        {
                fprintf(stderr, "Error while opening group\n");
                return 1;
        }

	edje_object_part_text_set(app.edje, "textpart", "First String Bla");

        ecore_evas_resize(app.ee, 30, 20);
        evas_object_resize(app.bg, 30, 20);

        evas_object_move(app.edje, 0, 0);
        evas_object_resize(app.edje, 30, 20);
        evas_object_layer_set(app.edje, 100);
        evas_object_show(app.edje);

	/* create an event area */
	o = evas_object_rectangle_add(app.evas);
	evas_object_color_set(o, 0, 0, 0, 0);
	evas_object_resize(o, 30, 20);
	evas_object_layer_set(o, 200);
	evas_object_show(o);

	evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP,
			click, app.edje);

        /* make it accessible for callbacks and others. */
        ecore_evas_data_set(app.ee, "app", &app);

        ecore_main_loop_begin();

        ecore_evas_shutdown();
        edje_shutdown();
        ecore_shutdown();
        evas_shutdown();

        return 0;
}

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to