forked from enlightenment/efl
tests for hoversel (and photo) and toolbar and more complete toolbar.
SVN revision: 38222
This commit is contained in:
parent
902f48fa2d
commit
ba18110513
|
@ -1247,10 +1247,49 @@ my_bt_17(void *data, Evas_Object *obj, void *event_info)
|
||||||
evas_object_show(win);
|
evas_object_show(win);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
tb_1(void *data, Evas_Object *obj, void *event_info)
|
||||||
|
{
|
||||||
|
char buf[PATH_MAX];
|
||||||
|
snprintf(buf, sizeof(buf), "%s/images/panel_01.jpg", PACKAGE_DATA_DIR);
|
||||||
|
elm_photo_file_set(data, buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
tb_2(void *data, Evas_Object *obj, void *event_info)
|
||||||
|
{
|
||||||
|
char buf[PATH_MAX];
|
||||||
|
snprintf(buf, sizeof(buf), "%s/images/rock_01.jpg", PACKAGE_DATA_DIR);
|
||||||
|
elm_photo_file_set(data, buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
tb_3(void *data, Evas_Object *obj, void *event_info)
|
||||||
|
{
|
||||||
|
char buf[PATH_MAX];
|
||||||
|
snprintf(buf, sizeof(buf), "%s/images/wood_01.jpg", PACKAGE_DATA_DIR);
|
||||||
|
elm_photo_file_set(data, buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
tb_4(void *data, Evas_Object *obj, void *event_info)
|
||||||
|
{
|
||||||
|
char buf[PATH_MAX];
|
||||||
|
snprintf(buf, sizeof(buf), "%s/images/sky_03.jpg", PACKAGE_DATA_DIR);
|
||||||
|
elm_photo_file_set(data, buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
tb_5(void *data, Evas_Object *obj, void *event_info)
|
||||||
|
{
|
||||||
|
elm_photo_file_set(data, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
my_bt_18(void *data, Evas_Object *obj, void *event_info)
|
my_bt_18(void *data, Evas_Object *obj, void *event_info)
|
||||||
{
|
{
|
||||||
Evas_Object *win, *bg, *bx, *tb, *ic;
|
Evas_Object *win, *bg, *bx, *tb, *ic, *ph;
|
||||||
|
Evas_Object *ph1, *ph2, *ph3, *ph4;
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
|
|
||||||
win = elm_win_add(NULL, "toolbar", ELM_WIN_BASIC);
|
win = elm_win_add(NULL, "toolbar", ELM_WIN_BASIC);
|
||||||
|
@ -1271,34 +1310,174 @@ my_bt_18(void *data, Evas_Object *obj, void *event_info)
|
||||||
evas_object_size_hint_weight_set(tb, 0.0, 0.0);
|
evas_object_size_hint_weight_set(tb, 0.0, 0.0);
|
||||||
evas_object_size_hint_align_set(tb, -1.0, 0.0);
|
evas_object_size_hint_align_set(tb, -1.0, 0.0);
|
||||||
|
|
||||||
ic = elm_icon_add(win);
|
ph1 = elm_photo_add(win);
|
||||||
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
|
ph2 = elm_photo_add(win);
|
||||||
elm_icon_file_set(ic, buf, NULL);
|
ph3 = elm_photo_add(win);
|
||||||
elm_toolbar_item_add(tb, ic, "Hello", NULL, NULL);
|
ph4 = elm_photo_add(win);
|
||||||
|
|
||||||
ic = elm_icon_add(win);
|
ic = elm_icon_add(win);
|
||||||
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
|
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
|
||||||
elm_icon_file_set(ic, buf, NULL);
|
elm_icon_file_set(ic, buf, NULL);
|
||||||
elm_toolbar_item_add(tb, ic, "World", NULL, NULL);
|
elm_toolbar_item_add(tb, ic, "Hello", tb_1, ph1);
|
||||||
|
|
||||||
ic = elm_icon_add(win);
|
ic = elm_icon_add(win);
|
||||||
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
|
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
|
||||||
elm_icon_file_set(ic, buf, NULL);
|
elm_icon_file_set(ic, buf, NULL);
|
||||||
elm_toolbar_item_add(tb, ic, "Here", NULL, NULL);
|
elm_toolbar_item_add(tb, ic, "World", tb_2, ph1);
|
||||||
|
|
||||||
ic = elm_icon_add(win);
|
ic = elm_icon_add(win);
|
||||||
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
|
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
|
||||||
elm_icon_file_set(ic, buf, NULL);
|
elm_icon_file_set(ic, buf, NULL);
|
||||||
elm_toolbar_item_add(tb, ic, "Comes", NULL, NULL);
|
elm_toolbar_item_add(tb, ic, "Here", tb_3, ph4);
|
||||||
|
|
||||||
ic = elm_icon_add(win);
|
ic = elm_icon_add(win);
|
||||||
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
|
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
|
||||||
elm_icon_file_set(ic, buf, NULL);
|
elm_icon_file_set(ic, buf, NULL);
|
||||||
elm_toolbar_item_add(tb, ic, "Elementary", NULL, NULL);
|
elm_toolbar_item_add(tb, ic, "Comes", tb_4, ph4);
|
||||||
|
|
||||||
|
ic = elm_icon_add(win);
|
||||||
|
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
|
||||||
|
elm_icon_file_set(ic, buf, NULL);
|
||||||
|
elm_toolbar_item_add(tb, ic, "Elementary", tb_5, ph4);
|
||||||
|
|
||||||
elm_box_pack_end(bx, tb);
|
elm_box_pack_end(bx, tb);
|
||||||
evas_object_show(tb);
|
evas_object_show(tb);
|
||||||
|
|
||||||
|
tb = elm_table_add(win);
|
||||||
|
// elm_table_homogenous_set(tb, 1);
|
||||||
|
evas_object_size_hint_weight_set(tb, 0.0, 1.0);
|
||||||
|
evas_object_size_hint_align_set(tb, -1.0, -1.0);
|
||||||
|
|
||||||
|
ph = ph1;
|
||||||
|
elm_photo_size_set(ph, 40);
|
||||||
|
snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", PACKAGE_DATA_DIR);
|
||||||
|
elm_photo_file_set(ph, buf);
|
||||||
|
evas_object_size_hint_weight_set(ph, 1.0, 1.0);
|
||||||
|
evas_object_size_hint_align_set(ph, 0.5, 0.5);
|
||||||
|
elm_table_pack(tb, ph, 0, 0, 1, 1);
|
||||||
|
evas_object_show(ph);
|
||||||
|
|
||||||
|
ph = ph2;
|
||||||
|
elm_photo_size_set(ph, 80);
|
||||||
|
evas_object_size_hint_weight_set(ph, 1.0, 1.0);
|
||||||
|
evas_object_size_hint_align_set(ph, 0.5, 0.5);
|
||||||
|
elm_table_pack(tb, ph, 1, 0, 1, 1);
|
||||||
|
evas_object_show(ph);
|
||||||
|
|
||||||
|
ph = ph3;
|
||||||
|
elm_photo_size_set(ph, 20);
|
||||||
|
snprintf(buf, sizeof(buf), "%s/images/sky_01.jpg", PACKAGE_DATA_DIR);
|
||||||
|
elm_photo_file_set(ph, buf);
|
||||||
|
evas_object_size_hint_weight_set(ph, 1.0, 1.0);
|
||||||
|
evas_object_size_hint_align_set(ph, 0.5, 0.5);
|
||||||
|
elm_table_pack(tb, ph, 0, 1, 1, 1);
|
||||||
|
evas_object_show(ph);
|
||||||
|
|
||||||
|
ph = ph4;
|
||||||
|
elm_photo_size_set(ph, 60);
|
||||||
|
snprintf(buf, sizeof(buf), "%s/images/sky_02.jpg", PACKAGE_DATA_DIR);
|
||||||
|
elm_photo_file_set(ph, buf);
|
||||||
|
evas_object_size_hint_weight_set(ph, 1.0, 1.0);
|
||||||
|
evas_object_size_hint_align_set(ph, 0.5, 0.5);
|
||||||
|
elm_table_pack(tb, ph, 1, 1, 1, 1);
|
||||||
|
evas_object_show(ph);
|
||||||
|
|
||||||
|
elm_box_pack_end(bx, tb);
|
||||||
|
evas_object_show(tb);
|
||||||
|
|
||||||
|
evas_object_resize(win, 320, 300);
|
||||||
|
|
||||||
|
evas_object_show(win);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
my_bt_19(void *data, Evas_Object *obj, void *event_info)
|
||||||
|
{
|
||||||
|
Evas_Object *win, *bg, *bx, *bt, *ic;
|
||||||
|
char buf[PATH_MAX];
|
||||||
|
|
||||||
|
win = elm_win_add(NULL, "hoversel", ELM_WIN_BASIC);
|
||||||
|
elm_win_title_set(win, "Hoversel");
|
||||||
|
elm_win_autodel_set(win, 1);
|
||||||
|
|
||||||
|
bg = elm_bg_add(win);
|
||||||
|
elm_win_resize_object_add(win, bg);
|
||||||
|
evas_object_size_hint_weight_set(bg, 1.0, 1.0);
|
||||||
|
evas_object_show(bg);
|
||||||
|
|
||||||
|
bx = elm_box_add(win);
|
||||||
|
elm_win_resize_object_add(win, bx);
|
||||||
|
evas_object_size_hint_weight_set(bx, 1.0, 1.0);
|
||||||
|
evas_object_show(bx);
|
||||||
|
|
||||||
|
bt = elm_hoversel_add(win);
|
||||||
|
elm_hoversel_hover_parent_set(bt, win);
|
||||||
|
elm_hoversel_label_set(bt, "Labels");
|
||||||
|
elm_hoversel_item_add(bt, "Item 1", NULL, ELM_ICON_NONE, NULL, NULL);
|
||||||
|
elm_hoversel_item_add(bt, "Item 2", NULL, ELM_ICON_NONE, NULL, NULL);
|
||||||
|
elm_hoversel_item_add(bt, "Item 3", NULL, ELM_ICON_NONE, NULL, NULL);
|
||||||
|
elm_hoversel_item_add(bt, "Item 4", NULL, ELM_ICON_NONE, NULL, NULL);
|
||||||
|
evas_object_size_hint_weight_set(bt, 0.0, 0.0);
|
||||||
|
evas_object_size_hint_align_set(bt, 0.5, 0.5);
|
||||||
|
elm_box_pack_end(bx, bt);
|
||||||
|
evas_object_show(bt);
|
||||||
|
|
||||||
|
bt = elm_hoversel_add(win);
|
||||||
|
elm_hoversel_hover_parent_set(bt, win);
|
||||||
|
elm_hoversel_label_set(bt, "Some Icons");
|
||||||
|
elm_hoversel_item_add(bt, "Item 1", NULL, ELM_ICON_NONE, NULL, NULL);
|
||||||
|
elm_hoversel_item_add(bt, "Item 2", NULL, ELM_ICON_NONE, NULL, NULL);
|
||||||
|
elm_hoversel_item_add(bt, "Item 3", "home", ELM_ICON_STANDARD, NULL, NULL);
|
||||||
|
elm_hoversel_item_add(bt, "Item 4", "close", ELM_ICON_STANDARD, NULL, NULL);
|
||||||
|
evas_object_size_hint_weight_set(bt, 0.0, 0.0);
|
||||||
|
evas_object_size_hint_align_set(bt, 0.5, 0.5);
|
||||||
|
elm_box_pack_end(bx, bt);
|
||||||
|
evas_object_show(bt);
|
||||||
|
|
||||||
|
bt = elm_hoversel_add(win);
|
||||||
|
elm_hoversel_hover_parent_set(bt, win);
|
||||||
|
elm_hoversel_label_set(bt, "All Icons");
|
||||||
|
elm_hoversel_item_add(bt, "Item 1", "apps", ELM_ICON_STANDARD, NULL, NULL);
|
||||||
|
elm_hoversel_item_add(bt, "Item 2", "arrow_down", ELM_ICON_STANDARD, NULL, NULL);
|
||||||
|
elm_hoversel_item_add(bt, "Item 3", "home", ELM_ICON_STANDARD, NULL, NULL);
|
||||||
|
elm_hoversel_item_add(bt, "Item 4", "close", ELM_ICON_STANDARD, NULL, NULL);
|
||||||
|
evas_object_size_hint_weight_set(bt, 0.0, 0.0);
|
||||||
|
evas_object_size_hint_align_set(bt, 0.5, 0.5);
|
||||||
|
elm_box_pack_end(bx, bt);
|
||||||
|
evas_object_show(bt);
|
||||||
|
|
||||||
|
bt = elm_hoversel_add(win);
|
||||||
|
elm_hoversel_hover_parent_set(bt, win);
|
||||||
|
elm_hoversel_label_set(bt, "All Icons");
|
||||||
|
elm_hoversel_item_add(bt, "Item 1", "apps", ELM_ICON_STANDARD, NULL, NULL);
|
||||||
|
snprintf(buf, sizeof(buf), "%s/images/sky_02.jpg", PACKAGE_DATA_DIR);
|
||||||
|
elm_hoversel_item_add(bt, "Item 2", buf, ELM_ICON_FILE, NULL, NULL);
|
||||||
|
elm_hoversel_item_add(bt, "Item 3", "home", ELM_ICON_STANDARD, NULL, NULL);
|
||||||
|
elm_hoversel_item_add(bt, "Item 4", "close", ELM_ICON_STANDARD, NULL, NULL);
|
||||||
|
evas_object_size_hint_weight_set(bt, 0.0, 0.0);
|
||||||
|
evas_object_size_hint_align_set(bt, 0.5, 0.5);
|
||||||
|
elm_box_pack_end(bx, bt);
|
||||||
|
evas_object_show(bt);
|
||||||
|
|
||||||
|
bt = elm_hoversel_add(win);
|
||||||
|
elm_hoversel_hover_parent_set(bt, win);
|
||||||
|
elm_hoversel_label_set(bt, "Icon + Label");
|
||||||
|
|
||||||
|
ic = elm_icon_add(win);
|
||||||
|
snprintf(buf, sizeof(buf), "%s/images/sky_03.jpg", PACKAGE_DATA_DIR);
|
||||||
|
elm_icon_file_set(ic, buf, NULL);
|
||||||
|
elm_hoversel_icon_set(bt, ic);
|
||||||
|
evas_object_show(ic);
|
||||||
|
|
||||||
|
elm_hoversel_item_add(bt, "Item 1", "apps", ELM_ICON_STANDARD, NULL, NULL);
|
||||||
|
elm_hoversel_item_add(bt, "Item 2", "arrow_down", ELM_ICON_STANDARD, NULL, NULL);
|
||||||
|
elm_hoversel_item_add(bt, "Item 3", "home", ELM_ICON_STANDARD, NULL, NULL);
|
||||||
|
elm_hoversel_item_add(bt, "Item 4", "close", ELM_ICON_STANDARD, NULL, NULL);
|
||||||
|
evas_object_size_hint_weight_set(bt, 0.0, 0.0);
|
||||||
|
evas_object_size_hint_align_set(bt, 0.5, 0.5);
|
||||||
|
elm_box_pack_end(bx, bt);
|
||||||
|
evas_object_show(bt);
|
||||||
|
|
||||||
evas_object_resize(win, 320, 300);
|
evas_object_resize(win, 320, 300);
|
||||||
|
|
||||||
evas_object_show(win);
|
evas_object_show(win);
|
||||||
|
@ -1523,6 +1702,13 @@ my_win_main(void)
|
||||||
elm_box_pack_end(bx, bt);
|
elm_box_pack_end(bx, bt);
|
||||||
evas_object_show(bt);
|
evas_object_show(bt);
|
||||||
|
|
||||||
|
bt = elm_button_add(win);
|
||||||
|
elm_button_label_set(bt, "Hoversel");
|
||||||
|
evas_object_smart_callback_add(bt, "clicked", my_bt_19, NULL);
|
||||||
|
evas_object_size_hint_align_set(bt, -1.0, 0.0);
|
||||||
|
elm_box_pack_end(bx, bt);
|
||||||
|
evas_object_show(bt);
|
||||||
|
|
||||||
/* set an initial window size */
|
/* set an initial window size */
|
||||||
evas_object_resize(win, 320, 520);
|
evas_object_resize(win, 320, 520);
|
||||||
/* show the window */
|
/* show the window */
|
||||||
|
|
|
@ -380,6 +380,9 @@ extern "C" {
|
||||||
EAPI Elm_Hoversel_Item *elm_hoversel_item_add(Evas_Object *obj, const char *label, const char *icon_file, Elm_Icon_Type icon_type, void (*func) (void *data, Evas_Object *obj, void *event_info), const void *data);
|
EAPI Elm_Hoversel_Item *elm_hoversel_item_add(Evas_Object *obj, const char *label, const char *icon_file, Elm_Icon_Type icon_type, void (*func) (void *data, Evas_Object *obj, void *event_info), const void *data);
|
||||||
EAPI void elm_hoversel_item_del(Elm_Hoversel_Item *item);
|
EAPI void elm_hoversel_item_del(Elm_Hoversel_Item *item);
|
||||||
/* smart callbacks called:
|
/* smart callbacks called:
|
||||||
|
* "clicked" - the user clicked the hoversel button and popped up the sel
|
||||||
|
* "selected" - an item in the hoversel list is selected
|
||||||
|
* "dismissed" - the hover is dismissed
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct _Elm_Toolbar_Item Elm_Toolbar_Item;
|
typedef struct _Elm_Toolbar_Item Elm_Toolbar_Item;
|
||||||
|
@ -389,6 +392,7 @@ extern "C" {
|
||||||
EAPI void elm_toolbar_item_select(Elm_Toolbar_Item *item);
|
EAPI void elm_toolbar_item_select(Elm_Toolbar_Item *item);
|
||||||
EAPI void elm_toolbar_scrollable_set(Evas_Object *obj, Evas_Bool scrollable);
|
EAPI void elm_toolbar_scrollable_set(Evas_Object *obj, Evas_Bool scrollable);
|
||||||
/* smart callbacks called:
|
/* smart callbacks called:
|
||||||
|
* "clicked" - when the user clicks on a toolbar item and becomes selected
|
||||||
*/
|
*/
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -400,12 +404,11 @@ extern "C" {
|
||||||
// * left/right arrow broken with password mode for entry + utf8 chars...
|
// * left/right arrow broken with password mode for entry + utf8 chars...
|
||||||
// * entry signal "changed" not called when deleting
|
// * entry signal "changed" not called when deleting
|
||||||
// * bubble doesnt handle child size changes right
|
// * bubble doesnt handle child size changes right
|
||||||
|
// * table doesnt do homogenous properly
|
||||||
//
|
//
|
||||||
//// (incomplete - medium priority)
|
//// (incomplete - medium priority)
|
||||||
// * entry selection conflicts with finger scroll (make selection start/stop work on signals?)
|
// * entry selection conflicts with finger scroll (make selection start/stop work on signals?)
|
||||||
//
|
|
||||||
// * add test for photo widget
|
|
||||||
// * add test for hoversel
|
|
||||||
// * disabled not supported
|
// * disabled not supported
|
||||||
// * tab widget focusing (not useful for touchscreen tho...)
|
// * tab widget focusing (not useful for touchscreen tho...)
|
||||||
// * on the fly theme changes - test (should work)
|
// * on the fly theme changes - test (should work)
|
||||||
|
@ -436,6 +439,10 @@ extern "C" {
|
||||||
// * dialpad widget - need one with a phone dialpad
|
// * dialpad widget - need one with a phone dialpad
|
||||||
//
|
//
|
||||||
//// (improvements - low priority)
|
//// (improvements - low priority)
|
||||||
|
// * use evas's new box instead of a box smart
|
||||||
|
// * use evas's table instead of a table smart
|
||||||
|
// * use ecore_evas_object_associate for win widget
|
||||||
|
// * use stack for win widget
|
||||||
// * somehow a pdf(ps) viewer widget that doesnt make it gpl (lgpl)
|
// * somehow a pdf(ps) viewer widget that doesnt make it gpl (lgpl)
|
||||||
// * emotion widget?
|
// * emotion widget?
|
||||||
// * ewebkit widget
|
// * ewebkit widget
|
||||||
|
|
|
@ -72,6 +72,7 @@ _item_clicked(void *data, Evas_Object *obj, void *event_info)
|
||||||
Item *it = data;
|
Item *it = data;
|
||||||
Evas_Object *obj2 = it->obj;
|
Evas_Object *obj2 = it->obj;
|
||||||
if (it->func) it->func(it->data, obj2, NULL);
|
if (it->func) it->func(it->data, obj2, NULL);
|
||||||
|
evas_object_smart_callback_call(obj2, "selected", NULL);
|
||||||
elm_hoversel_hover_end(obj2);
|
elm_hoversel_hover_end(obj2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,6 +122,7 @@ _button_clicked(void *data, Evas_Object *obj, void *event_info)
|
||||||
evas_object_show(bx);
|
evas_object_show(bx);
|
||||||
|
|
||||||
evas_object_show(wd->hover);
|
evas_object_show(wd->hover);
|
||||||
|
evas_object_smart_callback_call(data, "clicked", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -185,6 +187,7 @@ elm_hoversel_hover_end(Evas_Object *obj)
|
||||||
Widget_Data *wd = elm_widget_data_get(obj);
|
Widget_Data *wd = elm_widget_data_get(obj);
|
||||||
if (wd->hover) evas_object_del(wd->hover);
|
if (wd->hover) evas_object_del(wd->hover);
|
||||||
wd->hover = NULL;
|
wd->hover = NULL;
|
||||||
|
evas_object_smart_callback_call(obj, "dismissed", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Elm_Hoversel_Item *
|
EAPI Elm_Hoversel_Item *
|
||||||
|
|
|
@ -26,7 +26,6 @@ struct _Item
|
||||||
static void _del_hook(Evas_Object *obj);
|
static void _del_hook(Evas_Object *obj);
|
||||||
static void _theme_hook(Evas_Object *obj);
|
static void _theme_hook(Evas_Object *obj);
|
||||||
static void _sizing_eval(Evas_Object *obj);
|
static void _sizing_eval(Evas_Object *obj);
|
||||||
static void _mouse_up(void *data, Evas_Object *obj, void *event_info);
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_item_show(Item *it)
|
_item_show(Item *it)
|
||||||
|
@ -39,6 +38,32 @@ _item_show(Item *it)
|
||||||
elm_smart_scroller_child_region_show(wd->scr, x - bx, y - by, w, h);
|
elm_smart_scroller_child_region_show(wd->scr, x - bx, y - by, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_item_select(Item *it)
|
||||||
|
{
|
||||||
|
Item *it2;
|
||||||
|
Widget_Data *wd = elm_widget_data_get(it->obj);
|
||||||
|
Evas_Object *obj2;
|
||||||
|
Eina_List *l;
|
||||||
|
if (it->selected) return;
|
||||||
|
for (l = wd->items; l; l = l->next)
|
||||||
|
{
|
||||||
|
it2 = l->data;
|
||||||
|
if (it2->selected)
|
||||||
|
{
|
||||||
|
it2->selected = 0;
|
||||||
|
edje_object_signal_emit(it2->base, "elm,state,unselected", "elm");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
it->selected = 1;
|
||||||
|
edje_object_signal_emit(it->base, "elm,state,selected", "elm");
|
||||||
|
_item_show(it);
|
||||||
|
obj2 = it->obj;
|
||||||
|
if (it->func) it->func(it->data, it->obj, NULL);
|
||||||
|
evas_object_smart_callback_call(obj2, "clicked", NULL);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_del_hook(Evas_Object *obj)
|
_del_hook(Evas_Object *obj)
|
||||||
{
|
{
|
||||||
|
@ -49,7 +74,28 @@ _del_hook(Evas_Object *obj)
|
||||||
static void
|
static void
|
||||||
_theme_hook(Evas_Object *obj)
|
_theme_hook(Evas_Object *obj)
|
||||||
{
|
{
|
||||||
// FIXME: re-eval icon and all min sizes
|
Widget_Data *wd = elm_widget_data_get(obj);
|
||||||
|
Eina_List *l;
|
||||||
|
Item *it;
|
||||||
|
Evas_Coord mw, mh;
|
||||||
|
for (l = wd->items; l; l = l->next)
|
||||||
|
{
|
||||||
|
it = l->data;
|
||||||
|
if (it->selected)
|
||||||
|
edje_object_signal_emit(it->base, "elm,state,selected", "elm");
|
||||||
|
_elm_theme_set(it->base, "toolbar", "item", "default");
|
||||||
|
if (it->icon)
|
||||||
|
{
|
||||||
|
edje_extern_object_min_size_set(it->icon,
|
||||||
|
(double)wd->icon_size * _elm_config->scale,
|
||||||
|
(double)wd->icon_size * _elm_config->scale);
|
||||||
|
edje_object_part_swallow(it->base, "elm.swallow.icon", it->icon);
|
||||||
|
}
|
||||||
|
edje_object_part_text_set(it->base, "elm.text", it->label);
|
||||||
|
edje_object_size_min_calc(it->base, &mw, &mh);
|
||||||
|
evas_object_size_hint_min_set(it->base, mw, mh);
|
||||||
|
evas_object_size_hint_max_set(it->base, 9999, mh);
|
||||||
|
}
|
||||||
_sizing_eval(obj);
|
_sizing_eval(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,12 +125,6 @@ _sizing_eval(Evas_Object *obj)
|
||||||
evas_object_size_hint_max_set(obj, maxw, maxh);
|
evas_object_size_hint_max_set(obj, maxw, maxh);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
_mouse_up(void *data, Evas_Object *obj, void *event_info)
|
|
||||||
{
|
|
||||||
evas_object_smart_callback_call(data, "clicked", NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_resize(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
_resize(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||||
{
|
{
|
||||||
|
@ -115,24 +155,7 @@ _resize(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||||
static void
|
static void
|
||||||
_select(void *data, Evas_Object *obj, const char *emission, const char *source)
|
_select(void *data, Evas_Object *obj, const char *emission, const char *source)
|
||||||
{
|
{
|
||||||
Item *it = data, *it2;
|
_item_select(data);
|
||||||
Widget_Data *wd = elm_widget_data_get(it->obj);
|
|
||||||
Eina_List *l;
|
|
||||||
if (it->selected) return;
|
|
||||||
for (l = wd->items; l; l = l->next)
|
|
||||||
{
|
|
||||||
it2 = l->data;
|
|
||||||
if (it2->selected)
|
|
||||||
{
|
|
||||||
it2->selected = 0;
|
|
||||||
edje_object_signal_emit(it2->base, "elm,state,unselected", "elm");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
it->selected = 1;
|
|
||||||
edje_object_signal_emit(it->base, "elm,state,selected", "elm");
|
|
||||||
_item_show(it);
|
|
||||||
if (it->func) it->func(it->data, it->obj, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Evas_Object *
|
EAPI Evas_Object *
|
||||||
|
@ -191,16 +214,16 @@ elm_toolbar_item_add(Evas_Object *obj, Evas_Object *icon, const char *label, voi
|
||||||
_elm_theme_set(it->base, "toolbar", "item", "default");
|
_elm_theme_set(it->base, "toolbar", "item", "default");
|
||||||
edje_object_signal_callback_add(it->base, "elm,action,click", "elm",
|
edje_object_signal_callback_add(it->base, "elm,action,click", "elm",
|
||||||
_select, it);
|
_select, it);
|
||||||
if (icon)
|
if (it->icon)
|
||||||
{
|
{
|
||||||
edje_extern_object_min_size_set(icon,
|
edje_extern_object_min_size_set(it->icon,
|
||||||
(double)wd->icon_size * _elm_config->scale,
|
(double)wd->icon_size * _elm_config->scale,
|
||||||
(double)wd->icon_size * _elm_config->scale);
|
(double)wd->icon_size * _elm_config->scale);
|
||||||
edje_object_part_swallow(it->base, "elm.swallow.icon", icon);
|
edje_object_part_swallow(it->base, "elm.swallow.icon", it->icon);
|
||||||
evas_object_show(icon);
|
evas_object_show(it->icon);
|
||||||
elm_widget_sub_object_add(obj, it->icon);
|
elm_widget_sub_object_add(obj, it->icon);
|
||||||
}
|
}
|
||||||
edje_object_part_text_set(it->base, "elm.text", label);
|
edje_object_part_text_set(it->base, "elm.text", it->label);
|
||||||
edje_object_size_min_calc(it->base, &mw, &mh);
|
edje_object_size_min_calc(it->base, &mw, &mh);
|
||||||
evas_object_size_hint_weight_set(it->base, 0.0, 0.0);
|
evas_object_size_hint_weight_set(it->base, 0.0, 0.0);
|
||||||
evas_object_size_hint_align_set(it->base, -1.0, -1.0);
|
evas_object_size_hint_align_set(it->base, -1.0, -1.0);
|
||||||
|
@ -216,14 +239,21 @@ elm_toolbar_item_add(Evas_Object *obj, Evas_Object *icon, const char *label, voi
|
||||||
EAPI void
|
EAPI void
|
||||||
elm_toolbar_item_del(Elm_Toolbar_Item *item)
|
elm_toolbar_item_del(Elm_Toolbar_Item *item)
|
||||||
{
|
{
|
||||||
// FIXME: remove item
|
Item *it = (Item *)item;
|
||||||
|
Widget_Data *wd = elm_widget_data_get(it->obj);
|
||||||
|
Evas_Object *obj2 = it->obj;
|
||||||
|
wd->items = eina_list_remove(wd->items, it);
|
||||||
|
eina_stringshare_del(it->label);
|
||||||
|
if (it->icon) evas_object_del(it->icon);
|
||||||
|
evas_object_del(it->base);
|
||||||
|
free(it);
|
||||||
|
_theme_hook(obj2);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
elm_toolbar_item_select(Elm_Toolbar_Item *item)
|
elm_toolbar_item_select(Elm_Toolbar_Item *item)
|
||||||
{
|
{
|
||||||
// FIXME select item
|
_item_select(item);
|
||||||
// Widget_Data *wd = elm_widget_data_get(obj);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
|
|
Loading…
Reference in New Issue