forked from enlightenment/efl
Support elm_conformant deal with indicator service.
if some app run indicator service using ecore, elm_conformant can deal with these kind of service automatically SVN revision: 79334
This commit is contained in:
parent
add19e4e4f
commit
b22a43701e
|
@ -683,3 +683,8 @@
|
||||||
|
|
||||||
* Add elm_genlist_nth_item_get
|
* Add elm_genlist_nth_item_get
|
||||||
* Add elm_gengrid_nth_item_get
|
* Add elm_gengrid_nth_item_get
|
||||||
|
|
||||||
|
2012-11-15 Jiyoun Park (jypark)
|
||||||
|
|
||||||
|
* Support indicator service in elm_conformant. elm conformant can manage
|
||||||
|
indicator(elm_plug).
|
||||||
|
|
|
@ -31,6 +31,7 @@ Improvements:
|
||||||
* Plug widget handles image object deletion
|
* Plug widget handles image object deletion
|
||||||
* Handle COMPOUND_TEXT cnp
|
* Handle COMPOUND_TEXT cnp
|
||||||
* Conformant widget handles displaymode change related with keypad.
|
* Conformant widget handles displaymode change related with keypad.
|
||||||
|
* Conformant widget handles indicator service.
|
||||||
|
|
||||||
Fixes:
|
Fixes:
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,7 @@ test_clock.c \
|
||||||
test_cnp.c \
|
test_cnp.c \
|
||||||
test_colorselector.c \
|
test_colorselector.c \
|
||||||
test_conform.c \
|
test_conform.c \
|
||||||
|
test_conform_indicator.c \
|
||||||
test_ctxpopup.c \
|
test_ctxpopup.c \
|
||||||
test_cursor.c \
|
test_cursor.c \
|
||||||
test_datetime.c \
|
test_datetime.c \
|
||||||
|
|
|
@ -147,6 +147,8 @@ void test_label(void *data, Evas_Object *obj, void *event_info);
|
||||||
void test_label2(void *data, Evas_Object *obj, void *event_info);
|
void test_label2(void *data, Evas_Object *obj, void *event_info);
|
||||||
void test_conformant(void *data, Evas_Object *obj, void *event_info);
|
void test_conformant(void *data, Evas_Object *obj, void *event_info);
|
||||||
void test_conformant2(void *data, Evas_Object *obj, void *event_info);
|
void test_conformant2(void *data, Evas_Object *obj, void *event_info);
|
||||||
|
void test_conformant_indicator(void *data, Evas_Object *obj, void *event_info);
|
||||||
|
void test_conformant_indicator_service(void *data, Evas_Object *obj, void *event_info);
|
||||||
void test_multi(void *data, Evas_Object *obj, void *event_info);
|
void test_multi(void *data, Evas_Object *obj, void *event_info);
|
||||||
void test_floating(void *data, Evas_Object *obj, void *event_info);
|
void test_floating(void *data, Evas_Object *obj, void *event_info);
|
||||||
void test_launcher(void *data, Evas_Object *obj, void *event_info);
|
void test_launcher(void *data, Evas_Object *obj, void *event_info);
|
||||||
|
@ -701,6 +703,8 @@ add_tests:
|
||||||
//------------------------------//
|
//------------------------------//
|
||||||
ADD_TEST(NULL, "Standardization", "Conformant", test_conformant);
|
ADD_TEST(NULL, "Standardization", "Conformant", test_conformant);
|
||||||
ADD_TEST(NULL, "Standardization", "Conformant 2", test_conformant2);
|
ADD_TEST(NULL, "Standardization", "Conformant 2", test_conformant2);
|
||||||
|
ADD_TEST(NULL, "Standardization", "Conformant indicator", test_conformant_indicator);
|
||||||
|
ADD_TEST(NULL, "Standardization", "Conformant indicator service", test_conformant_indicator_service);
|
||||||
|
|
||||||
//------------------------------//
|
//------------------------------//
|
||||||
ADD_TEST(NULL, "Helpers", "Store", test_store);
|
ADD_TEST(NULL, "Helpers", "Store", test_store);
|
||||||
|
|
|
@ -0,0 +1,395 @@
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "elementary_config.h"
|
||||||
|
#endif
|
||||||
|
#include <Elementary.h>
|
||||||
|
#ifndef ELM_LIB_QUICKLAUNCH
|
||||||
|
|
||||||
|
static int vis = 0;
|
||||||
|
static int rotate_with_resize = 0;
|
||||||
|
|
||||||
|
static void win_del(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
|
||||||
|
{
|
||||||
|
elm_exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_rot_0(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||||
|
{
|
||||||
|
Evas_Object *win = data;
|
||||||
|
if (rotate_with_resize)
|
||||||
|
elm_win_rotation_with_resize_set(win, 0);
|
||||||
|
else
|
||||||
|
elm_win_rotation_set(win, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_rot_90(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||||
|
{
|
||||||
|
Evas_Object *win = data;
|
||||||
|
if (rotate_with_resize)
|
||||||
|
elm_win_rotation_with_resize_set(win, 90);
|
||||||
|
else
|
||||||
|
elm_win_rotation_set(win, 90);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_rot_180(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||||
|
{
|
||||||
|
Evas_Object *win = data;
|
||||||
|
if (rotate_with_resize)
|
||||||
|
elm_win_rotation_with_resize_set(win, 180);
|
||||||
|
else
|
||||||
|
elm_win_rotation_set(win, 180);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_rot_270(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||||
|
{
|
||||||
|
Evas_Object *win = data;
|
||||||
|
if (rotate_with_resize)
|
||||||
|
elm_win_rotation_with_resize_set(win, 270);
|
||||||
|
else
|
||||||
|
elm_win_rotation_set(win, 270);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void _visible_change(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||||
|
{
|
||||||
|
printf("visible change before=%d\n",vis);
|
||||||
|
Evas_Object *win = (Evas_Object *) data;
|
||||||
|
if (vis == 0)
|
||||||
|
{
|
||||||
|
elm_win_indicator_mode_set(win, ELM_WIN_INDICATOR_SHOW);
|
||||||
|
vis = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
elm_win_indicator_mode_set(win, ELM_WIN_INDICATOR_HIDE);
|
||||||
|
vis = 0;
|
||||||
|
}
|
||||||
|
/*Add App code here*/
|
||||||
|
printf("visible change after=%d\n",vis);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
test_conformant_indicator(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
|
||||||
|
{
|
||||||
|
Evas_Object *win, *bg, *conform, *bt, *bx;
|
||||||
|
Evas_Object *plug_port = NULL;
|
||||||
|
Evas_Object *plug_land = NULL;
|
||||||
|
|
||||||
|
win = elm_win_util_standard_add("conformant indicator", "Conformant 3");
|
||||||
|
elm_win_autodel_set(win, EINA_TRUE);
|
||||||
|
elm_win_conformant_set(win, EINA_TRUE);
|
||||||
|
|
||||||
|
//Create bg
|
||||||
|
bg = elm_bg_add(win);
|
||||||
|
elm_win_resize_object_add(win, bg);
|
||||||
|
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
|
elm_bg_color_set(bg, 0, 255, 255);
|
||||||
|
evas_object_show(bg);
|
||||||
|
|
||||||
|
//Create conformant
|
||||||
|
conform = elm_conformant_add(win);
|
||||||
|
elm_win_resize_object_add(win, conform);
|
||||||
|
evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
|
evas_object_show(conform);
|
||||||
|
|
||||||
|
bx = elm_box_add(conform);
|
||||||
|
elm_win_resize_object_add(win, bx);
|
||||||
|
evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
|
evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
|
||||||
|
bt = elm_button_add(win);
|
||||||
|
elm_object_text_set(bt, "Rot 0");
|
||||||
|
evas_object_smart_callback_add(bt, "clicked", _rot_0, win);
|
||||||
|
evas_object_size_hint_fill_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
|
||||||
|
elm_box_pack_end(bx, bt);
|
||||||
|
evas_object_show(bt);
|
||||||
|
|
||||||
|
bt = elm_button_add(win);
|
||||||
|
elm_object_text_set(bt, "Rot 90");
|
||||||
|
evas_object_smart_callback_add(bt, "clicked", _rot_90, win);
|
||||||
|
evas_object_size_hint_fill_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
|
||||||
|
elm_box_pack_end(bx, bt);
|
||||||
|
evas_object_show(bt);
|
||||||
|
|
||||||
|
bt = elm_button_add(win);
|
||||||
|
elm_object_text_set(bt, "Rot 180");
|
||||||
|
evas_object_smart_callback_add(bt, "clicked", _rot_180, win);
|
||||||
|
evas_object_size_hint_fill_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
|
||||||
|
elm_box_pack_end(bx, bt);
|
||||||
|
evas_object_show(bt);
|
||||||
|
|
||||||
|
bt = elm_button_add(win);
|
||||||
|
elm_object_text_set(bt, "Rot 270");
|
||||||
|
evas_object_smart_callback_add(bt, "clicked", _rot_270, win);
|
||||||
|
evas_object_size_hint_fill_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
|
||||||
|
elm_box_pack_end(bx, bt);
|
||||||
|
evas_object_show(bt);
|
||||||
|
|
||||||
|
char *svr_name_port = "elm_indicator_portrait";
|
||||||
|
char *svr_name_land = "elm_indicator_landscape";
|
||||||
|
|
||||||
|
plug_port = elm_plug_add(win);
|
||||||
|
if (!plug_port)
|
||||||
|
{
|
||||||
|
printf("fail to create plug to server[%s]\n", svr_name_port);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!elm_plug_connect(plug_port, svr_name_port, 0, EINA_FALSE))
|
||||||
|
{
|
||||||
|
printf("fail to connect to server[%s]\n", svr_name_port);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
evas_object_size_hint_weight_set(plug_port, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
|
evas_object_size_hint_align_set(plug_port, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
evas_object_show(plug_port);
|
||||||
|
elm_box_pack_end(bx, plug_port);
|
||||||
|
|
||||||
|
plug_land = elm_plug_add(win);
|
||||||
|
if (!plug_land)
|
||||||
|
{
|
||||||
|
printf("fail to create plug to server[%s]\n", svr_name_land);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!elm_plug_connect(plug_land, svr_name_land, 0, EINA_FALSE))
|
||||||
|
{
|
||||||
|
printf("fail to connect to server[%s]\n", svr_name_land);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
evas_object_size_hint_weight_set(plug_land, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
|
evas_object_size_hint_align_set(plug_land, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
evas_object_show(plug_land);
|
||||||
|
elm_box_pack_end(bx, plug_land);
|
||||||
|
|
||||||
|
bt = elm_button_add(win);
|
||||||
|
elm_object_text_set(bt, "Show/Hide");
|
||||||
|
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0);
|
||||||
|
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0);
|
||||||
|
elm_box_pack_end(bx, bt);
|
||||||
|
evas_object_show(bt);
|
||||||
|
evas_object_smart_callback_add(bt, "clicked", _visible_change, win);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
elm_object_content_set(conform, bx);
|
||||||
|
evas_object_show(bx);
|
||||||
|
|
||||||
|
evas_object_resize(win, 400, 600);
|
||||||
|
evas_object_show(win);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Evas_Object *win_port = NULL;
|
||||||
|
static Evas_Object *win_land = NULL;
|
||||||
|
|
||||||
|
static void
|
||||||
|
_mouse_down_cb(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
|
||||||
|
{
|
||||||
|
Evas_Event_Mouse_Down *ev = event_info;
|
||||||
|
Evas_Object *sub_obj = data;
|
||||||
|
|
||||||
|
printf("\nAPP mouse down [%d]x[%d] obj=%p type=%s\n", ev->canvas.x, ev->canvas.y,sub_obj,evas_object_type_get(sub_obj));
|
||||||
|
|
||||||
|
evas_object_move(sub_obj, ev->canvas.x, ev->canvas.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_mouse_move_cb(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
|
||||||
|
{
|
||||||
|
Evas_Event_Mouse_Move *ev = event_info;
|
||||||
|
Evas_Object *sub_obj = data;
|
||||||
|
if (!ev->buttons) return;
|
||||||
|
|
||||||
|
printf("APP mouse move [%d]x[%d] obj=%p type=%s\n", ev->cur.canvas.x, ev->cur.canvas.y,sub_obj,evas_object_type_get(sub_obj));
|
||||||
|
evas_object_move(sub_obj, ev->cur.canvas.x, ev->cur.canvas.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static Evas_Object *
|
||||||
|
_fill_portrait(Evas_Object *win)
|
||||||
|
{
|
||||||
|
Evas_Object *btn;
|
||||||
|
Evas_Object *rect;
|
||||||
|
|
||||||
|
rect = evas_object_rectangle_add(evas_object_evas_get(win));
|
||||||
|
evas_object_resize(rect, 720, 60);
|
||||||
|
evas_object_color_set(rect, 221, 187, 187, 255);
|
||||||
|
evas_object_move(rect, 0, 0);
|
||||||
|
evas_object_show(rect);
|
||||||
|
|
||||||
|
btn = elm_button_add(rect);
|
||||||
|
if (!btn)
|
||||||
|
{
|
||||||
|
printf("fail to elm_button_add() \n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
elm_object_text_set(btn, "portrait");
|
||||||
|
|
||||||
|
evas_object_resize(btn, 200, 50);
|
||||||
|
evas_object_move(btn, 260, 0);
|
||||||
|
evas_object_show(btn);
|
||||||
|
|
||||||
|
// This check: indicator get mouse event well from application
|
||||||
|
evas_object_event_callback_add(rect, EVAS_CALLBACK_MOUSE_DOWN, _mouse_down_cb, btn);
|
||||||
|
evas_object_event_callback_add(rect, EVAS_CALLBACK_MOUSE_MOVE, _mouse_move_cb, btn);
|
||||||
|
|
||||||
|
return rect;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Evas_Object *
|
||||||
|
_fill_landscape(Evas_Object *win)
|
||||||
|
{
|
||||||
|
Evas_Object *btn;
|
||||||
|
Evas_Object *rect;
|
||||||
|
|
||||||
|
rect = evas_object_rectangle_add(evas_object_evas_get(win));
|
||||||
|
evas_object_resize(rect, 1280, 60);
|
||||||
|
evas_object_color_set(rect, 207, 255, 255, 255);
|
||||||
|
evas_object_move(rect, 0, 0);
|
||||||
|
evas_object_show(rect);
|
||||||
|
|
||||||
|
btn = elm_button_add(rect);
|
||||||
|
if (!btn)
|
||||||
|
{
|
||||||
|
printf("fail to elm_button_add() \n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
elm_object_text_set(btn, "landscape");
|
||||||
|
|
||||||
|
evas_object_resize(btn, 200, 50);
|
||||||
|
evas_object_move(btn, 580, 0);
|
||||||
|
evas_object_show(btn);
|
||||||
|
|
||||||
|
// This check: indicator get mouse event well from application
|
||||||
|
evas_object_event_callback_add(rect, EVAS_CALLBACK_MOUSE_DOWN, _mouse_down_cb, btn);
|
||||||
|
evas_object_event_callback_add(rect, EVAS_CALLBACK_MOUSE_MOVE, _mouse_move_cb, btn);
|
||||||
|
|
||||||
|
return rect;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Evas_Object *
|
||||||
|
_create_portrait(void)
|
||||||
|
{
|
||||||
|
const char *port_indi_name;
|
||||||
|
|
||||||
|
win_port = elm_win_add(NULL, "portrait_indicator", ELM_WIN_SOCKET_IMAGE);
|
||||||
|
if (!win_port) {
|
||||||
|
printf("fail to elm_win_add:port\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
port_indi_name = elm_config_indicator_service_get(0);
|
||||||
|
if (!port_indi_name)
|
||||||
|
{
|
||||||
|
printf("indicator cannot portrait service name: use default name\n");
|
||||||
|
port_indi_name = "elm_indicator_portrait";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!elm_win_socket_listen(win_port, port_indi_name, 0, EINA_FALSE))
|
||||||
|
{
|
||||||
|
printf("fail to elm_win_socket_listen():port \n");
|
||||||
|
evas_object_del(win_port);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
elm_win_title_set(win_port, "win sock test:port");
|
||||||
|
elm_win_borderless_set(win_port, EINA_TRUE);
|
||||||
|
|
||||||
|
evas_object_smart_callback_add(win_port, "delete,request", win_del, NULL);
|
||||||
|
evas_object_move(win_port, 0, 0);
|
||||||
|
evas_object_resize(win_port, 720, 60);
|
||||||
|
|
||||||
|
_fill_portrait(win_port);
|
||||||
|
return win_port;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Evas_Object *
|
||||||
|
_create_landscape(void)
|
||||||
|
{
|
||||||
|
const char *land_indi_name;
|
||||||
|
|
||||||
|
win_land = elm_win_add(NULL, "win_socket_test:land", ELM_WIN_SOCKET_IMAGE);
|
||||||
|
if (!win_land)
|
||||||
|
{
|
||||||
|
printf("fail to elm_win_add:land\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
land_indi_name = elm_config_indicator_service_get(90);
|
||||||
|
if (!land_indi_name)
|
||||||
|
{
|
||||||
|
printf("indicator cannot landscape service name: use default name\n");
|
||||||
|
land_indi_name = "elm_indicator_landscape";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!elm_win_socket_listen(win_land, land_indi_name, 0, 0))
|
||||||
|
{
|
||||||
|
printf("fail to elm_win_socket_listen():land\n");
|
||||||
|
evas_object_del(win_land);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
elm_win_title_set(win_land, "win sock test:land");
|
||||||
|
elm_win_borderless_set(win_land, EINA_TRUE);
|
||||||
|
|
||||||
|
evas_object_smart_callback_add(win_land, "delete,request", win_del, NULL);
|
||||||
|
evas_object_move(win_land, 0, 0);
|
||||||
|
evas_object_resize(win_land, 1280, 60);
|
||||||
|
|
||||||
|
_fill_landscape(win_land);
|
||||||
|
return win_land;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
popobj(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
|
||||||
|
{
|
||||||
|
win_port = _create_portrait();
|
||||||
|
if (!win_port)
|
||||||
|
return;
|
||||||
|
|
||||||
|
win_land = _create_landscape();
|
||||||
|
if (!win_land)
|
||||||
|
return;
|
||||||
|
|
||||||
|
evas_object_show(win_port);
|
||||||
|
evas_object_show(win_land);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
test_conformant_indicator_service(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
|
||||||
|
{
|
||||||
|
Evas_Object *win, *btn, *bx;
|
||||||
|
|
||||||
|
win = elm_win_util_standard_add("conformant indicator service", "Conformant 4");
|
||||||
|
elm_win_autodel_set(win, EINA_TRUE);
|
||||||
|
|
||||||
|
bx = elm_box_add(win);
|
||||||
|
evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
|
evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
elm_win_resize_object_add(win, bx);
|
||||||
|
evas_object_show(bx);
|
||||||
|
|
||||||
|
btn = elm_button_add(win);
|
||||||
|
elm_object_focus_allow_set(btn, EINA_FALSE);
|
||||||
|
elm_object_text_set(btn, "start indicator service");
|
||||||
|
evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, 0.0);
|
||||||
|
evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
elm_box_pack_end(bx, btn);
|
||||||
|
evas_object_show(btn);
|
||||||
|
|
||||||
|
evas_object_smart_callback_add(btn, "clicked", popobj, win);
|
||||||
|
|
||||||
|
evas_object_resize(win, 240, 480);
|
||||||
|
evas_object_show(win);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -2277,27 +2277,21 @@ elm_config_preferred_engine_set(const char *engine)
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI const char *
|
EAPI const char *
|
||||||
elm_config_indicator_service_0_get(void)
|
elm_config_indicator_service_get(int rotation)
|
||||||
{
|
{
|
||||||
return _elm_config->indicator_service_0;
|
switch (rotation)
|
||||||
}
|
{
|
||||||
|
case 0:
|
||||||
EAPI const char *
|
return _elm_config->indicator_service_0;
|
||||||
elm_config_indicator_service_90_get(void)
|
case 90:
|
||||||
{
|
return _elm_config->indicator_service_90;
|
||||||
return _elm_config->indicator_service_90;
|
case 180:
|
||||||
}
|
return _elm_config->indicator_service_180;
|
||||||
|
case 270:
|
||||||
EAPI const char *
|
return _elm_config->indicator_service_270;
|
||||||
elm_config_indicator_service_180_get(void)
|
default:
|
||||||
{
|
return NULL;
|
||||||
return _elm_config->indicator_service_180;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
EAPI const char *
|
|
||||||
elm_config_indicator_service_270_get(void)
|
|
||||||
{
|
|
||||||
return _elm_config->indicator_service_270;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -1014,6 +1014,15 @@ EAPI Eina_Bool elm_config_mirrored_get(void);
|
||||||
*/
|
*/
|
||||||
EAPI void elm_config_mirrored_set(Eina_Bool mirrored);
|
EAPI void elm_config_mirrored_set(Eina_Bool mirrored);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the indicator service name according to the rotation degree.
|
||||||
|
*
|
||||||
|
* @param rotation The rotation which related with the indicator service name, in degrees (0-360),
|
||||||
|
*
|
||||||
|
* @return The indicator service name according to the rotation degree.
|
||||||
|
*/
|
||||||
|
EAPI const char *elm_config_indicator_service_get(int rotation);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -145,7 +145,10 @@ _conformant_part_sizing_eval(Evas_Object *obj,
|
||||||
;
|
;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
_conformant_part_size_hints_set(obj, sd->indicator, sx, sy, sw, sh);
|
if (((sd->rot == 90) || (sd->rot == 270)) && sd->landscape_indicator)
|
||||||
|
_conformant_part_size_hints_set(obj, sd->landscape_indicator, sx, sy, sw, sh);
|
||||||
|
else if (((sd->rot == 0) || (sd->rot == 180)) && sd->portrait_indicator)
|
||||||
|
_conformant_part_size_hints_set(obj, sd->portrait_indicator, sx, sy, sw, sh);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (part_type & ELM_CONFORMANT_VIRTUAL_KEYPAD_PART)
|
if (part_type & ELM_CONFORMANT_VIRTUAL_KEYPAD_PART)
|
||||||
|
@ -212,17 +215,7 @@ _conformant_parts_swallow(Evas_Object *obj)
|
||||||
sd->scroller = NULL;
|
sd->scroller = NULL;
|
||||||
|
|
||||||
//Indicator
|
//Indicator
|
||||||
if (!sd->indicator)
|
//Indicator swallow can occur Only indicator show or rotation change
|
||||||
{
|
|
||||||
sd->indicator = evas_object_rectangle_add(e);
|
|
||||||
evas_object_size_hint_min_set(sd->indicator, -1, 0);
|
|
||||||
evas_object_size_hint_max_set(sd->indicator, -1, 0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
_conformant_part_sizing_eval(obj, ELM_CONFORMANT_INDICATOR_PART);
|
|
||||||
|
|
||||||
evas_object_color_set(sd->indicator, 0, 0, 0, 0);
|
|
||||||
elm_layout_content_set(obj, "elm.swallow.indicator", sd->indicator);
|
|
||||||
|
|
||||||
//Virtual Keyboard
|
//Virtual Keyboard
|
||||||
if (!sd->virtualkeypad)
|
if (!sd->virtualkeypad)
|
||||||
|
@ -264,6 +257,260 @@ _conformant_parts_swallow(Evas_Object *obj)
|
||||||
elm_layout_content_set(obj, "elm.swallow.softkey", sd->softkey);
|
elm_layout_content_set(obj, "elm.swallow.softkey", sd->softkey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
_indicator_connect_cb(void *data)
|
||||||
|
{
|
||||||
|
const char *indicator_serv_name;
|
||||||
|
int rot = 0;
|
||||||
|
Elm_Conformant_Smart_Data *sd = data;
|
||||||
|
|
||||||
|
if (!sd) return ECORE_CALLBACK_CANCEL;
|
||||||
|
if (sd->indmode != ELM_WIN_INDICATOR_SHOW) return ECORE_CALLBACK_CANCEL;
|
||||||
|
|
||||||
|
rot = sd->rot;
|
||||||
|
|
||||||
|
indicator_serv_name = elm_config_indicator_service_get(rot);
|
||||||
|
if (!indicator_serv_name)
|
||||||
|
{
|
||||||
|
DBG("Conformant cannot find indicator service name: Rotation=%d\n",rot);
|
||||||
|
return ECORE_CALLBACK_CANCEL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((rot == 90) || (rot == 270))
|
||||||
|
{
|
||||||
|
if (elm_plug_connect(sd->landscape_indicator, indicator_serv_name, 0, EINA_FALSE))
|
||||||
|
{
|
||||||
|
DBG("Conformant connect to server[%s]\n", indicator_serv_name);
|
||||||
|
return ECORE_CALLBACK_CANCEL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (elm_plug_connect(sd->portrait_indicator, indicator_serv_name, 0, EINA_FALSE))
|
||||||
|
{
|
||||||
|
DBG("Conformant connect to server[%s]\n", indicator_serv_name);
|
||||||
|
return ECORE_CALLBACK_CANCEL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ecore_timer_interval_set(sd->indi_timer, 1);
|
||||||
|
return ECORE_CALLBACK_RENEW;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_indicator_disconnected(void *data,
|
||||||
|
Evas_Object *obj __UNUSED__,
|
||||||
|
void *event_info __UNUSED__)
|
||||||
|
{
|
||||||
|
Evas_Object *conform = data;
|
||||||
|
|
||||||
|
ELM_CONFORMANT_DATA_GET(conform, sd);
|
||||||
|
|
||||||
|
sd->indi_timer = ecore_timer_add(1, _indicator_connect_cb, sd);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static Evas_Object *
|
||||||
|
_create_portrait_indicator(Evas_Object *obj)
|
||||||
|
{
|
||||||
|
Evas_Object *port_indicator = NULL;
|
||||||
|
const char *port_indicator_serv_name;
|
||||||
|
|
||||||
|
ELM_CONFORMANT_DATA_GET(obj, sd);
|
||||||
|
|
||||||
|
port_indicator_serv_name = elm_config_indicator_service_get(sd->rot);
|
||||||
|
if (!port_indicator_serv_name)
|
||||||
|
{
|
||||||
|
DBG("Conformant cannot get portrait indicator service name\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
port_indicator = elm_plug_add(obj);
|
||||||
|
if (!port_indicator)
|
||||||
|
{
|
||||||
|
DBG("Conformant cannot create plug to server[%s]\n", port_indicator_serv_name);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!elm_plug_connect(port_indicator, port_indicator_serv_name, 0, EINA_FALSE))
|
||||||
|
{
|
||||||
|
DBG("Conformant cannot connect to server[%s]\n", port_indicator_serv_name);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
elm_widget_sub_object_add(obj, port_indicator);
|
||||||
|
evas_object_smart_callback_add(port_indicator, "image.deleted", _indicator_disconnected, obj);
|
||||||
|
|
||||||
|
evas_object_size_hint_min_set(port_indicator, -1, 0);
|
||||||
|
evas_object_size_hint_max_set(port_indicator, -1, 0);
|
||||||
|
|
||||||
|
return port_indicator;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Evas_Object *
|
||||||
|
_create_landscape_indicator(Evas_Object *obj)
|
||||||
|
{
|
||||||
|
Evas_Object *land_indicator = NULL;
|
||||||
|
const char *land_indicator_serv_name;
|
||||||
|
|
||||||
|
ELM_CONFORMANT_DATA_GET(obj, sd);
|
||||||
|
|
||||||
|
land_indicator_serv_name = elm_config_indicator_service_get(sd->rot);
|
||||||
|
if (!land_indicator_serv_name)
|
||||||
|
{
|
||||||
|
DBG("Conformant cannot get portrait indicator service name\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
land_indicator = elm_plug_add(obj);
|
||||||
|
if (!land_indicator)
|
||||||
|
{
|
||||||
|
DBG("Conformant cannot create plug to server[%s]\n", land_indicator_serv_name);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!elm_plug_connect(land_indicator, land_indicator_serv_name, 0, EINA_FALSE))
|
||||||
|
{
|
||||||
|
DBG("Conformant cannot connect to server[%s]\n", land_indicator_serv_name);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
elm_widget_sub_object_add(obj, land_indicator);
|
||||||
|
evas_object_smart_callback_add(land_indicator, "image.deleted",_indicator_disconnected, obj);
|
||||||
|
|
||||||
|
evas_object_size_hint_min_set(land_indicator, -1, 0);
|
||||||
|
evas_object_size_hint_max_set(land_indicator, -1, 0);
|
||||||
|
return land_indicator;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_indicator_mode_set(Evas_Object *conformant, Elm_Win_Indicator_Mode indmode)
|
||||||
|
{
|
||||||
|
Evas_Object *old_indi = NULL;
|
||||||
|
ELM_CONFORMANT_DATA_GET(conformant, sd);
|
||||||
|
sd->indmode = indmode;
|
||||||
|
|
||||||
|
if (indmode == ELM_WIN_INDICATOR_SHOW)
|
||||||
|
{
|
||||||
|
old_indi = elm_layout_content_get(conformant, "elm.swallow.indicator");
|
||||||
|
|
||||||
|
//create new indicator
|
||||||
|
if (!old_indi)
|
||||||
|
{
|
||||||
|
if ((sd->rot == 90)||(sd->rot == 270))
|
||||||
|
{
|
||||||
|
if (!sd->landscape_indicator)
|
||||||
|
sd->landscape_indicator = _create_landscape_indicator(conformant);
|
||||||
|
|
||||||
|
if (!sd->landscape_indicator) return;
|
||||||
|
|
||||||
|
evas_object_show(sd->landscape_indicator);
|
||||||
|
elm_layout_content_set(conformant, "elm.swallow.indicator", sd->landscape_indicator);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!sd->portrait_indicator)
|
||||||
|
sd->portrait_indicator = _create_portrait_indicator(conformant);
|
||||||
|
|
||||||
|
if (!sd->portrait_indicator) return;
|
||||||
|
|
||||||
|
evas_object_show(sd->portrait_indicator);
|
||||||
|
elm_layout_content_set(conformant, "elm.swallow.indicator", sd->portrait_indicator);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
elm_object_signal_emit(conformant, "elm,state,indicator,show", "elm");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
old_indi = elm_layout_content_get(conformant, "elm.swallow.indicator");
|
||||||
|
if (old_indi)
|
||||||
|
{
|
||||||
|
evas_object_hide(old_indi);
|
||||||
|
}
|
||||||
|
elm_object_signal_emit(conformant, "elm,state,indicator,hide", "elm");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_indicator_opacity_set(Evas_Object *conformant, Elm_Win_Indicator_Opacity_Mode ind_o_mode)
|
||||||
|
{
|
||||||
|
ELM_CONFORMANT_DATA_GET(conformant, sd);
|
||||||
|
sd->ind_o_mode = ind_o_mode;
|
||||||
|
//TODO: opacity change
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_on_indicator_mode_changed(void *data,
|
||||||
|
Evas_Object *obj,
|
||||||
|
void *event_info __UNUSED__)
|
||||||
|
{
|
||||||
|
Evas_Object *conformant = data;
|
||||||
|
Evas_Object *win = obj;
|
||||||
|
|
||||||
|
Elm_Win_Indicator_Mode indmode;
|
||||||
|
Elm_Win_Indicator_Opacity_Mode ind_o_mode;
|
||||||
|
|
||||||
|
ELM_CONFORMANT_DATA_GET(conformant, sd);
|
||||||
|
|
||||||
|
indmode = elm_win_indicator_mode_get(win);
|
||||||
|
ind_o_mode = elm_win_indicator_opacity_get(win);
|
||||||
|
if (indmode == sd->indmode)
|
||||||
|
{
|
||||||
|
if (ind_o_mode == sd->ind_o_mode) return;
|
||||||
|
else _indicator_opacity_set(conformant, ind_o_mode);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
_indicator_mode_set(conformant, indmode);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_on_rotation_changed(void *data,
|
||||||
|
Evas_Object *obj,
|
||||||
|
void *event_info __UNUSED__)
|
||||||
|
{
|
||||||
|
int rot = 0;
|
||||||
|
Evas_Object *win = obj;
|
||||||
|
Evas_Object *conformant = data;
|
||||||
|
Evas_Object *old_indi = NULL;
|
||||||
|
|
||||||
|
ELM_CONFORMANT_DATA_GET(data, sd);
|
||||||
|
|
||||||
|
rot = elm_win_rotation_get(win);
|
||||||
|
|
||||||
|
if (rot == sd->rot) return;
|
||||||
|
|
||||||
|
sd->rot = rot;
|
||||||
|
old_indi = elm_layout_content_get(conformant, "elm.swallow.indicator");
|
||||||
|
/* this means ELM_WIN_INDICATOR_SHOW never be set.we don't need to change indicator type*/
|
||||||
|
if (!old_indi) return;
|
||||||
|
|
||||||
|
if (old_indi)
|
||||||
|
evas_object_hide(elm_layout_content_unset(old_indi, "elm.swallow.indicator"));
|
||||||
|
|
||||||
|
if ((rot == 90) || (rot == 270) || (rot == -90) || (rot == -270))
|
||||||
|
{
|
||||||
|
if (!sd->landscape_indicator)
|
||||||
|
sd->landscape_indicator = _create_landscape_indicator(conformant);
|
||||||
|
|
||||||
|
if (!sd->landscape_indicator) return;
|
||||||
|
|
||||||
|
evas_object_show(sd->landscape_indicator);
|
||||||
|
elm_layout_content_set(conformant, "elm.swallow.indicator", sd->landscape_indicator);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!sd->portrait_indicator)
|
||||||
|
sd->portrait_indicator = _create_portrait_indicator(conformant);
|
||||||
|
|
||||||
|
if (!sd->portrait_indicator) return;
|
||||||
|
|
||||||
|
evas_object_show(sd->portrait_indicator);
|
||||||
|
elm_layout_content_set(conformant, "elm.swallow.indicator", sd->portrait_indicator);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_elm_conformant_smart_theme(Evas_Object *obj)
|
_elm_conformant_smart_theme(Evas_Object *obj)
|
||||||
{
|
{
|
||||||
|
@ -531,6 +778,9 @@ _elm_conformant_smart_add(Evas_Object *obj)
|
||||||
|
|
||||||
_conformant_parts_swallow(obj);
|
_conformant_parts_swallow(obj);
|
||||||
|
|
||||||
|
priv->landscape_indicator = NULL;
|
||||||
|
priv->portrait_indicator = NULL;
|
||||||
|
|
||||||
evas_object_event_callback_add
|
evas_object_event_callback_add
|
||||||
(obj, EVAS_CALLBACK_RESIZE, _move_resize_cb, obj);
|
(obj, EVAS_CALLBACK_RESIZE, _move_resize_cb, obj);
|
||||||
evas_object_event_callback_add
|
evas_object_event_callback_add
|
||||||
|
@ -549,6 +799,22 @@ _elm_conformant_smart_del(Evas_Object *obj)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (sd->show_region_job) ecore_job_del(sd->show_region_job);
|
if (sd->show_region_job) ecore_job_del(sd->show_region_job);
|
||||||
|
if (sd->indi_timer)
|
||||||
|
{
|
||||||
|
ecore_timer_del(sd->indi_timer);
|
||||||
|
sd->indi_timer = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sd->portrait_indicator)
|
||||||
|
{
|
||||||
|
evas_object_del(sd->portrait_indicator);
|
||||||
|
sd->portrait_indicator = NULL;
|
||||||
|
}
|
||||||
|
if (sd->landscape_indicator)
|
||||||
|
{
|
||||||
|
evas_object_del(sd->landscape_indicator);
|
||||||
|
sd->landscape_indicator = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
ELM_WIDGET_CLASS(_elm_conformant_parent_sc)->base.del(obj);
|
ELM_WIDGET_CLASS(_elm_conformant_parent_sc)->base.del(obj);
|
||||||
}
|
}
|
||||||
|
@ -608,6 +874,7 @@ EAPI Evas_Object *
|
||||||
elm_conformant_add(Evas_Object *parent)
|
elm_conformant_add(Evas_Object *parent)
|
||||||
{
|
{
|
||||||
Evas_Object *obj;
|
Evas_Object *obj;
|
||||||
|
Evas_Object *top;
|
||||||
|
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
|
||||||
|
|
||||||
|
@ -617,5 +884,20 @@ elm_conformant_add(Evas_Object *parent)
|
||||||
if (!elm_widget_sub_object_add(parent, obj))
|
if (!elm_widget_sub_object_add(parent, obj))
|
||||||
ERR("could not add %p as sub object of %p", obj, parent);
|
ERR("could not add %p as sub object of %p", obj, parent);
|
||||||
|
|
||||||
|
ELM_CONFORMANT_DATA_GET(obj, sd);
|
||||||
|
|
||||||
|
top = elm_widget_top_get(obj);
|
||||||
|
_on_indicator_mode_changed(obj, top, NULL);
|
||||||
|
_on_rotation_changed(obj, top, NULL);
|
||||||
|
|
||||||
|
sd->indmode = elm_win_indicator_mode_get(top);
|
||||||
|
sd->ind_o_mode = elm_win_indicator_opacity_get(top);
|
||||||
|
sd->rot = elm_win_rotation_get(top);
|
||||||
|
|
||||||
|
evas_object_smart_callback_add
|
||||||
|
(top, "indicator,prop,changed", _on_indicator_mode_changed, obj);
|
||||||
|
evas_object_smart_callback_add
|
||||||
|
(top, "rotation,changed", _on_rotation_changed, obj);
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,8 +122,8 @@ typedef struct _Elm_Conformant_Smart_Data Elm_Conformant_Smart_Data;
|
||||||
struct _Elm_Conformant_Smart_Data
|
struct _Elm_Conformant_Smart_Data
|
||||||
{
|
{
|
||||||
Elm_Layout_Smart_Data base;
|
Elm_Layout_Smart_Data base;
|
||||||
|
Evas_Object *portrait_indicator;
|
||||||
Evas_Object *indicator;
|
Evas_Object *landscape_indicator;
|
||||||
Evas_Object *softkey;
|
Evas_Object *softkey;
|
||||||
Evas_Object *virtualkeypad;
|
Evas_Object *virtualkeypad;
|
||||||
Evas_Object *clipboard;
|
Evas_Object *clipboard;
|
||||||
|
@ -141,6 +141,11 @@ struct _Elm_Conformant_Smart_Data
|
||||||
Evas_Coord x, y; // current delta
|
Evas_Coord x, y; // current delta
|
||||||
} delta;
|
} delta;
|
||||||
Ecore_Job *show_region_job;
|
Ecore_Job *show_region_job;
|
||||||
|
Elm_Win_Indicator_Mode indmode;
|
||||||
|
Elm_Win_Indicator_Opacity_Mode ind_o_mode;
|
||||||
|
Ecore_Timer *indi_timer;
|
||||||
|
|
||||||
|
int rot;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Enum to identify conformant swallow parts */
|
/* Enum to identify conformant swallow parts */
|
||||||
|
|
Loading…
Reference in New Issue