forked from enlightenment/efl
[hoversel] - Added evas smart signal "expanded" in hoversel. This patch depends on D373.
Test Plan: elementary_test -to Hoversel, Click on "Custom Item Style". Reviewers: seoz, raster, cedric Reviewed By: raster Differential Revision: https://phab.enlightenment.org/D381
This commit is contained in:
parent
0be8dbcaae
commit
02edf1abdb
|
@ -115,10 +115,24 @@ _hoversel_dismissed_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||||
printf("'dismissed' callback is called.\n");
|
printf("'dismissed' callback is called.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_hoversel_expanded_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||||
|
void *event_info EINA_UNUSED)
|
||||||
|
{
|
||||||
|
Elm_Object_Item *it = data;
|
||||||
|
|
||||||
|
printf("'expanded' callback is called.\n");
|
||||||
|
printf("old style: %s\n", elm_object_item_style_get(it));
|
||||||
|
//item type is button. set the style of button
|
||||||
|
elm_object_item_style_set(it, "anchor");
|
||||||
|
printf("new style: %s\n", elm_object_item_style_get(it));
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
test_hoversel(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
test_hoversel(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Evas_Object *win, *bx, *bt, *ic, *bxx, *hoversel;
|
Evas_Object *win, *bx, *bt, *ic, *bxx, *hoversel;
|
||||||
|
Elm_Object_Item *it;
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
api_data *api = calloc(1, sizeof(api_data));
|
api_data *api = calloc(1, sizeof(api_data));
|
||||||
|
|
||||||
|
@ -236,6 +250,26 @@ test_hoversel(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_
|
||||||
elm_box_pack_end(bx, hoversel);
|
elm_box_pack_end(bx, hoversel);
|
||||||
evas_object_show(hoversel);
|
evas_object_show(hoversel);
|
||||||
|
|
||||||
|
hoversel = elm_hoversel_add(win);
|
||||||
|
elm_hoversel_hover_parent_set(hoversel, win);
|
||||||
|
elm_object_text_set(hoversel, "Custom Item Style");
|
||||||
|
elm_hoversel_item_add(hoversel, "Item 1", NULL, ELM_ICON_NONE, NULL, NULL);
|
||||||
|
elm_hoversel_item_add(hoversel, "Item 2", NULL, ELM_ICON_NONE, NULL, NULL);
|
||||||
|
elm_hoversel_item_add(hoversel, "Item 3", NULL, ELM_ICON_NONE, NULL, NULL);
|
||||||
|
elm_hoversel_item_add(hoversel, "Item 4", NULL, ELM_ICON_NONE, NULL, NULL);
|
||||||
|
it = elm_hoversel_item_add(hoversel, "Manage items", NULL, ELM_ICON_NONE, NULL, NULL);
|
||||||
|
evas_object_smart_callback_add(hoversel, "clicked",
|
||||||
|
_hoversel_clicked_cb, NULL);
|
||||||
|
evas_object_smart_callback_add(hoversel, "selected",
|
||||||
|
_hoversel_selected_cb, NULL);
|
||||||
|
evas_object_smart_callback_add(hoversel, "dismissed",
|
||||||
|
_hoversel_dismissed_cb, NULL);
|
||||||
|
//pass the last item as data and use elm_object_item_style_set() to change the item style.
|
||||||
|
evas_object_smart_callback_add(hoversel, "expanded",
|
||||||
|
_hoversel_expanded_cb, it);
|
||||||
|
elm_box_pack_end(bx, hoversel);
|
||||||
|
evas_object_show(hoversel);
|
||||||
|
|
||||||
evas_object_resize(win, 320, 500);
|
evas_object_resize(win, 320, 500);
|
||||||
|
|
||||||
evas_object_show(win);
|
evas_object_show(win);
|
||||||
|
|
|
@ -15,9 +15,11 @@ EAPI Eo_Op ELM_OBJ_HOVERSEL_BASE_ID = EO_NOOP;
|
||||||
|
|
||||||
static const char SIG_SELECTED[] = "selected";
|
static const char SIG_SELECTED[] = "selected";
|
||||||
static const char SIG_DISMISSED[] = "dismissed";
|
static const char SIG_DISMISSED[] = "dismissed";
|
||||||
|
static const char SIG_EXPANDED[] = "expanded";
|
||||||
static const Evas_Smart_Cb_Description _smart_callbacks[] = {
|
static const Evas_Smart_Cb_Description _smart_callbacks[] = {
|
||||||
{SIG_SELECTED, ""},
|
{SIG_SELECTED, ""},
|
||||||
{SIG_DISMISSED, ""},
|
{SIG_DISMISSED, ""},
|
||||||
|
{SIG_EXPANDED, ""},
|
||||||
{"clicked", ""}, /**< handled by parent button class */
|
{"clicked", ""}, /**< handled by parent button class */
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
@ -177,6 +179,7 @@ _activate(Evas_Object *obj)
|
||||||
elm_object_part_content_set(sd->hover, elm_hover_best_content_location_get
|
elm_object_part_content_set(sd->hover, elm_hover_best_content_location_get
|
||||||
(sd->hover, ELM_HOVER_AXIS_VERTICAL), bx);
|
(sd->hover, ELM_HOVER_AXIS_VERTICAL), bx);
|
||||||
|
|
||||||
|
evas_object_smart_callback_call(obj, SIG_EXPANDED, NULL);
|
||||||
evas_object_show(sd->hover);
|
evas_object_show(sd->hover);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
* - @c "selected" - an item in the hoversel list is selected. event_info
|
* - @c "selected" - an item in the hoversel list is selected. event_info
|
||||||
* is the selected item
|
* is the selected item
|
||||||
* - @c "dismissed" - the hover is dismissed
|
* - @c "dismissed" - the hover is dismissed
|
||||||
|
* - @c "expanded" - This is called on clicking hoversel and elm_hoversel_hover_begin().
|
||||||
*
|
*
|
||||||
* Default content parts of the hoversel widget that you can use for are:
|
* Default content parts of the hoversel widget that you can use for are:
|
||||||
* @li "icon" - An icon of the hoversel
|
* @li "icon" - An icon of the hoversel
|
||||||
|
|
Loading…
Reference in New Issue