add start of userlist code

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2015-01-30 13:03:35 -05:00
parent d7d3aaaa8d
commit 34d50e5ecb
1 changed files with 93 additions and 0 deletions

View File

@ -18,6 +18,14 @@ struct _Channel
Evas_Object *o_img;
Evas_Object *o_entry;
struct
{
Evas_Object *o_frame;
Evas_Object *o_spacer;
Evas_Object *o_list;
Eina_Bool visible : 1;
} userlist;
int step_x, step_y;
int min_w, min_h;
int req_w, req_h;
@ -121,6 +129,24 @@ _cb_count_next(void *data, Evas_Object *obj EINA_UNUSED, const char *sig EINA_UN
_cb_next(data, NULL, NULL);
}
static void
_cb_userlist_go(void *data, Evas_Object *obj EINA_UNUSED, const char *sig EINA_UNUSED, const char *source EINA_UNUSED)
{
Channel *chl;
chl = data;
if (!chl->userlist.visible)
{
edje_object_signal_emit(chl->o_base, "userlist,show", PACKAGE_NAME);
chl->userlist.visible = EINA_TRUE;
}
else
{
edje_object_signal_emit(chl->o_base, "userlist,hide", PACKAGE_NAME);
chl->userlist.visible = EINA_FALSE;
}
}
static void
_cb_options_done(void *data)
{
@ -166,6 +192,54 @@ _cb_entry_go(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
}
}
static void
_channel_userlist_create(Channel *chl)
{
if (!chl->userlist.o_frame)
{
Evas_Object *o;
o = elm_frame_add(chl->o_bg);
WEIGHT_SET(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
ALIGN_SET(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_text_set(o, "Users");
chl->userlist.o_frame = o;
edje_object_part_swallow(chl->o_base, "userlist.content", o);
}
if (!chl->userlist.o_list)
{
Evas_Object *o;
o = elm_list_add(chl->o_bg);
WEIGHT_SET(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
ALIGN_SET(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
chl->userlist.o_list = o;
/* Test Code */
elm_list_item_append(o, "Test User", NULL, NULL, NULL, NULL);
elm_list_go(o);
elm_object_content_set(chl->userlist.o_frame, o);
}
if (!chl->userlist.o_spacer)
{
Evas_Object *o;
Evas_Coord w = 0, h = 0;
o = elm_icon_add(chl->o_bg);
elm_icon_standard_set(o, "user-idle");
elm_coords_finger_size_adjust(1, &w, 1, &h);
evas_object_size_hint_min_set(o, w, h);
chl->userlist.o_spacer = o;
edje_object_part_swallow(chl->o_bg, "userlist.control", o);
}
}
/* external functions */
Channel *
_channel_create(Evas *evas, const char *name, const char *server)
@ -208,6 +282,9 @@ _channel_create(Evas *evas, const char *name, const char *server)
WEIGHT_SET(chl->o_grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
FILL_SET(chl->o_grid, EVAS_HINT_FILL, EVAS_HINT_FILL);
/* add userlist */
_channel_userlist_create(chl);
evas_object_event_callback_add(chl->o_grid,
EVAS_CALLBACK_CHANGED_SIZE_HINTS,
_cb_size_hint, chl);
@ -228,6 +305,10 @@ _channel_create(Evas *evas, const char *name, const char *server)
edje_object_signal_callback_add(chl->o_bg, "chlcount,next", PACKAGE_NAME,
_cb_count_next, chl);
/* add handlers for userlist signals */
edje_object_signal_callback_add(chl->o_bg, "userlist,go", PACKAGE_NAME,
_cb_userlist_go, chl);
return chl;
}
@ -463,6 +544,18 @@ _channel_count_set(Channel *chl, int count, int total)
edje_object_signal_emit(chl->o_bg, "chlcount,off", PACKAGE_NAME);
}
void
_channel_userlist_show(Channel *chl)
{
edje_object_signal_emit(chl->o_bg, "userlist,on", PACKAGE_NAME);
}
void
_channel_userlist_hide(Channel *chl)
{
edje_object_signal_emit(chl->o_bg, "userlist,off", PACKAGE_NAME);
}
Eina_Bool
_channel_unswallowed_get(Channel *chl)
{