[목차로 이동] Enlightenment Foundation Language


focus 테스트를 위해 [EFL] 3. Simple Application using Evas. 를 가지고 간단한 이벤트 테스트를 해보기로 했습니다

컴파일은 아래와 같이 하면 됩니다.
gcc -c simple simple.c `pkg-config --cflags --libs evas ecore-evas`


결론:

  - evas_object에서는 focus를 수동으로 옮겨주어야 한다.

    (elementary는 아님)


source code

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

static void on_mouse_down(void* data, Evas* e, Evas_Object* o, void* event_info)
{
    printf("%s : %p\n", __func__, o);
}

static void on_focus_in(void* data, Evas* e, Evas_Object* o, void* event_info)
{
    printf("%s : %p\n", __func__, o);
}

static void on_focus_out(void* data, Evas* e, Evas_Object* o, void* event_info)
{
    printf("%s : %p\n", __func__, o);
}

int main()
{
    Evas* evas;
    Ecore_Evas* window;
    Evas_Object* rect2;
    Evas_Object* rect3;

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

    window = ecore_evas_new(NULL, 0, 0, 800, 600, NULL);
    evas = ecore_evas_get(window);
    ecore_evas_show(window);

    rect2 = evas_object_rectangle_add(evas);
    evas_object_color_set(rect2, 255, 0, 0,255);
    evas_object_move(rect2, 100, 100);
    evas_object_resize(rect2, 200, 200);
    evas_object_show(rect2);

    evas_object_event_callback_add(rect2, EVAS_CALLBACK_MOUSE_DOWN, on_mouse_down, NULL);
    evas_object_event_callback_add(rect2, EVAS_CALLBACK_FOCUS_IN, on_focus_in, NULL);
    evas_object_event_callback_add(rect2, EVAS_CALLBACK_FOCUS_OUT, on_focus_out, NULL);
    printf("rect2 is added : %p\n", rect2);

    rect3 = evas_object_rectangle_add(evas);
    evas_object_color_set(rect3, 0, 255, 0,255);
    evas_object_move(rect3, 400, 100);
    evas_object_resize(rect3, 200, 200);
    evas_object_show(rect3);

    evas_object_event_callback_add(rect3, EVAS_CALLBACK_MOUSE_DOWN, on_mouse_down, NULL);
    evas_object_event_callback_add(rect3, EVAS_CALLBACK_FOCUS_IN, on_focus_in, NULL);
    evas_object_event_callback_add(rect3, EVAS_CALLBACK_FOCUS_OUT, on_focus_out, NULL);
    printf("rect3 is added : %p\n", rect3);

    ecore_main_loop_begin();

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

    return 0;
}

신고

'Open Source > EFL' 카테고리의 다른 글

[TIZEN] Tizen App store 등록하기  (0) 2013.08.01
[EFL] EFL build on ubuntu (13.04)  (1) 2013.07.24
Simple event test(mouse down/focus) using Evas  (0) 2012.09.03
[ecore] screen size 얻기  (0) 2012.08.15
[Elementary] 기본 코드  (0) 2012.08.04
[EFL] How to build EFL on Ubuntu.  (0) 2012.02.21
Posted by 소혼
TAG ,

티스토리 툴바