On Wed, Oct 22, 2008 at 11:03 PM, Gustavo Sverzut Barbieri
<[EMAIL PROTECTED]> wrote:
> On Wed, Oct 22, 2008 at 11:00 PM, Enlightenment SVN
> <[EMAIL PROTECTED]> wrote:
>> Log:
>>  add helper ecore_evas_object_associate.
>>
>>  We usually want to create an Ecore_Evas and attach an object to it, be
>>  it the background, your smart object that will manage the scene (ie:
>>  edje) and this is replicated everywhere. Not anymore!
>>
>>  ecore_evas_new() and ecore_evas_object_associate() will behave much
>>  like regular toolkits "window-new()" and "window-main-child-add()",
>>  actually it was based on elm_win.c and hopefully we can remove that,
>>  or most of that code and replace with this helper.
>>
>>  I'll add an Evas smart object to handle stacks of objects, that is, it
>>  will be a clipped smart object that on resize it will resize every
>>  child to the same size. This means we can associate this stack object
>>  and add a background and then your stuff on top of it.
>
> test case attached (not sure where to add this)

and the always forgotten attachment... :-)

-- 
Gustavo Sverzut Barbieri
http://profusion.mobi embedded systems
--------------------------------------
MSN: [EMAIL PROTECTED]
Skype: gsbarbieri
Mobile: +55 (19) 9225-2202
#include <Ecore.h>
#include <Evas.h>
#include <Ecore_Evas.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

static void on_keydown(void *data, Evas *e, Evas_Object *obj, void *einfo)
{
    Ecore_Evas *ee = data;
    Evas_Event_Key_Down *ev = einfo;
    Evas_Coord ox, oy, ow, oh, wx, wy, ww, wh;

    ecore_evas_geometry_get(ee, &wx, &wy, &ww, &wh);
    evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);

    if (strcmp(ev->keyname, "j") == 0)
      ecore_evas_resize(ee, ww, wh + 5);
    else if (strcmp(ev->keyname, "k") == 0)
      ecore_evas_resize(ee, ww, wh - 5);
    else if (strcmp(ev->keyname, "Down") == 0)
      evas_object_resize(obj, ow, oh + 5);
    else if (strcmp(ev->keyname, "Up") == 0)
      evas_object_resize(obj, ow, oh - 5);
    else if (strcmp(ev->keyname, "Escape") == 0)
      ecore_main_loop_quit();
    else
      printf("unhandled key: %s\n", ev->keyname);
}

static void on_free(void *data, Evas *e, Evas_Object *obj, void *einfo)
{
    ecore_main_loop_quit();
}

int main(int argc, char *argv[])
{
    Ecore_Evas *ee;
    Evas_Object *o;

    ecore_init();
    evas_init();
    ecore_evas_init();

    ee = ecore_evas_new(NULL, 0, 0, 1, 1, NULL);
    o = evas_object_rectangle_add(ecore_evas_get(ee));
    ecore_evas_object_associate(ee, o, 0);

    evas_object_resize(o, 320, 240);
    evas_object_color_set(o, 255, 128, 128, 255);
    evas_object_show(o);
    evas_object_focus_set(o, 1);

    evas_object_event_callback_add(o, EVAS_CALLBACK_KEY_DOWN, on_keydown, ee);
    evas_object_event_callback_add(o, EVAS_CALLBACK_FREE, on_free, NULL);

    ecore_main_loop_begin();

    ecore_evas_shutdown();
    evas_shutdown();
    ecore_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