[elementary] How to get evas object out of elementary.Window

Laszlo KREKACS laszlo.krekacs.list at gmail.com
Mon Aug 24 13:25:34 CEST 2009


On Mon, Aug 24, 2009 at 10:52 AM, Laszlo
KREKACS<laszlo.krekacs.list at gmail.com> wrote:
> Unfortunately my C knowledge are almost nonexistant, so
> maybe it will take some weeks to get there, writing a simple
> demonstration application in C.

As others pointed out, the preferred way of doing C development is
installing elementary on
the desktop machine and develop on it (and crosscompile for the neo).

So I installed elementary, and ran the test application from here:
http://trac.enlightenment.org/e/wiki/Elementary

Now, I modified the source, to get the evas canvas (evass), and print
some info about
it, and add other evas object to it, so not some elementary widget,
but pure evas object.

In C, everything works as expected, evas_object_evas_get does return
with a valid
evas canvas object. And I can directly add other objects to it.
In python this does not work.

For convenience, I post[1] my demonstration code (many thanks to
devilhorns from #e).

What you are supposed to see, is a blue line(evas.Line) added over the
Hello world!
elementary label widget.

The next exercise would be to fix the python bindings. But I see these
pyx, pxi, pxd files
the first time in my life....
http://trac.enlightenment.org/e/browser/trunk/BINDINGS/python/python-elementary/include/elementary

Best regards,
 Laszlo

[1]:
#include <Elementary.h>
#include <Evas.h>

static void
win_del(void *data, Evas_Object *obj, void *event_info)
{
   elm_exit();
}

EAPI int
elm_main(int argc, char **argv)
{
   Evas_Object *win, *bg, *lb, *lin;
   Evas *evass;
   int w = 0, h = 0;
   char buf[4096];

   win = elm_win_add(NULL, "hello", ELM_WIN_BASIC);
   elm_win_title_set(win, "Hello");
   evas_object_smart_callback_add(win, "delete-request", win_del, NULL);

   evass = evas_object_evas_get(win);

   evas_output_size_get(evass, &w, &h);
   printf("Width: %d\tHeight: %d\n", w, h);
   //snprintf(buf, sizeof(buf), "lol: %d", evas_output_size_get(evass->changed);
   bg = elm_bg_add(win);
   evas_object_size_hint_weight_set(bg, 1.0, 1.0);
   elm_win_resize_object_add(win, bg);
   evas_object_show(bg);

   lb = elm_label_add(win);
   elm_label_label_set(lb, "Hello World!");
   evas_object_size_hint_weight_set(lb, 1.0, 1.0);
   elm_win_resize_object_add(win, lb);

   lin = evas_object_line_add(evass);
   evas_object_line_xy_set(lin,10, 10 , 20, 30);
   evas_object_layer_set(lin, 55);
   // evas_object_clip_set(ob, panel_clip);
   evas_object_color_set(lin, 0, 0, 255, 200);
   evas_object_show(lin);




   evas_object_show(lb);

   evas_object_show(win);

   evas_output_size_get(evass, &w, &h);
   printf("Width2: %d\tHeight2: %d\n", w, h);
   elm_run();
   evas_output_size_get(evass, &w, &h);
   printf("Width3: %d\tHeight3: %d\n", w, h);
   elm_shutdown();
   return 0;
}
ELM_MAIN()



More information about the community mailing list