Hi
I want to add the expand mode in toolbar.
It'll expand the size of toolbar items according the size of the toolbar.
So the items are packed in toolbar fully.
I need this function to change our custom widget by using toolbar.
Maybe It never break the toolbar. I tested it and there's no suspectible
part.
But please review it at once.
If there's no opinion, I'll upload this patch.
Thanks
--
Jaehwan Kim.
Index: src/lib/elm_toolbar.c
===================================================================
--- src/lib/elm_toolbar.c (리비전 68610)
+++ src/lib/elm_toolbar.c (작업 사본)
@@ -423,7 +423,6 @@ _sizing_eval(Evas_Object *obj)
evas_object_size_hint_min_get(wd->bx, &minw_bx, &minh_bx);
// if (wd->vertical && (h > minh)) minh = h;
// if ((!wd->vertical) && (w > minw)) minw = w;
- evas_object_resize(wd->bx, minw_bx, minh_bx);
elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
if (wd->shrink_mode == ELM_TOOLBAR_SHRINK_NONE)
{
@@ -438,6 +437,13 @@ _sizing_eval(Evas_Object *obj)
minh = minh_bx + (h - vh);
}
}
+ else if (wd->shrink_mode == ELM_TOOLBAR_SHRINK_EXPAND)
+ {
+ minw = minw_bx + (w - vw);
+ minh = minh_bx + (h - vh);
+ if (minw_bx < vw) minw_bx = vw;
+ if (minh_bx < vh) minh_bx = vh;
+ }
else
{
if (wd->vertical)
@@ -454,6 +460,7 @@ _sizing_eval(Evas_Object *obj)
// else minw = w - vw;
// minh = minh + (h - vh);
}
+ evas_object_resize(wd->bx, minw_bx, minh_bx);
evas_object_size_hint_min_set(obj, minw, minh);
evas_object_size_hint_max_set(obj, -1, -1);
}
@@ -657,6 +664,15 @@ _resize_job(void *data)
}
}
}
+ else if (wd->shrink_mode == ELM_TOOLBAR_SHRINK_EXPAND)
+ {
+ if ((vw >= mw) && (vh >= mh))
+ evas_object_resize(wd->bx, vw, vh);
+ else if (vw < mw)
+ evas_object_resize(wd->bx, mw, vh);
+ else if (vh < mh)
+ evas_object_resize(wd->bx, vw, mh);
+ }
else
{
if (wd->vertical)
@@ -912,15 +928,23 @@ _item_new(Evas_Object *obj, const char *icon, cons
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
edje_object_size_min_restricted_calc(VIEW(it), &mw, &mh, mw, mh);
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
- if (wd->vertical)
+ if (wd->shrink_mode != ELM_TOOLBAR_SHRINK_EXPAND)
{
- evas_object_size_hint_weight_set(VIEW(it), EVAS_HINT_EXPAND, -1.0);
- evas_object_size_hint_align_set(VIEW(it), EVAS_HINT_FILL, 0.5);
+ if (wd->vertical)
+ {
+ evas_object_size_hint_weight_set(VIEW(it), EVAS_HINT_EXPAND, -1.0);
+ evas_object_size_hint_align_set(VIEW(it), EVAS_HINT_FILL, 0.5);
+ }
+ else
+ {
+ evas_object_size_hint_weight_set(VIEW(it), -1.0, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(VIEW(it), 0.5, EVAS_HINT_FILL);
+ }
}
else
{
- evas_object_size_hint_weight_set(VIEW(it), -1.0, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(VIEW(it), 0.5, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(VIEW(it), EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(VIEW(it), EVAS_HINT_FILL, EVAS_HINT_FILL);
}
evas_object_size_hint_min_set(VIEW(it), mw, mh);
evas_object_size_hint_max_set(VIEW(it), -1, -1);
Index: src/lib/elm_toolbar.h
===================================================================
--- src/lib/elm_toolbar.h (리비전 68610)
+++ src/lib/elm_toolbar.h (작업 사본)
@@ -67,6 +67,7 @@ typedef enum
ELM_TOOLBAR_SHRINK_HIDE, /**< Hide exceeding items. */
ELM_TOOLBAR_SHRINK_SCROLL, /**< Allow accessing exceeding items through a scroller. */
ELM_TOOLBAR_SHRINK_MENU, /**< Inserts a button to pop up a menu with exceeding items. */
+ ELM_TOOLBAR_SHRINK_EXPAND, /**< Expand all items according the size of the toolbar. */
ELM_TOOLBAR_SHRINK_LAST /**< Indicates error if returned by elm_toolbar_shrink_mode_get() */
} Elm_Toolbar_Shrink_Mode;
Index: src/bin/test_toolbar.c
===================================================================
--- src/bin/test_toolbar.c (리비전 68610)
+++ src/bin/test_toolbar.c (작업 사본)
@@ -836,4 +836,113 @@ test_toolbar7(void *data __UNUSED__, Evas_Object *
evas_object_resize(win, 320, 300);
evas_object_show(win);
}
+
+void
+test_toolbar8(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ Evas_Object *win, *bg, *bx, *tb, *ph, *menu;
+ Evas_Object *ph1, *ph2, *ph3, *ph4;
+ Elm_Object_Item *item;
+ Elm_Object_Item *menu_it;
+ char buf[PATH_MAX];
+
+ win = elm_win_add(NULL, "toolbar8", ELM_WIN_BASIC);
+ elm_win_title_set(win, "Toolbar 8");
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ 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);
+ evas_object_show(bg);
+
+ bx = elm_box_add(win);
+ elm_win_resize_object_add(win, bx);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_show(bx);
+
+ tb = elm_toolbar_add(win);
+ elm_toolbar_homogeneous_set(tb, EINA_TRUE);
+ elm_toolbar_shrink_mode_set(tb, ELM_TOOLBAR_SHRINK_EXPAND);
+ evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ ph1 = elm_photo_add(win);
+ ph2 = elm_photo_add(win);
+ ph3 = elm_photo_add(win);
+ ph4 = elm_photo_add(win);
+
+ item = elm_toolbar_item_append(tb, "document-print", "Hello", tb_1, ph1);
+ elm_object_item_disabled_set(item, EINA_TRUE);
+ elm_toolbar_item_priority_set(item, -100);
+
+ item = elm_toolbar_item_append(tb, "folder-new", "World", tb_2, ph1);
+ elm_toolbar_item_priority_set(item, 100);
+
+ item = elm_toolbar_item_append(tb, "object-rotate-right", "H", tb_3, ph4);
+ elm_toolbar_item_priority_set(item, -150);
+
+ item = elm_toolbar_item_append(tb, "mail-send", "Comes", tb_4, ph4);
+ elm_toolbar_item_priority_set(item, -200);
+
+ item = elm_toolbar_item_append(tb, "clock", "Elementary", tb_5, ph4);
+ elm_toolbar_item_priority_set(item, 0);
+
+ item = elm_toolbar_item_append(tb, "refresh", "Menu", NULL, NULL);
+ elm_toolbar_item_menu_set(item, EINA_TRUE);
+ elm_toolbar_item_priority_set(item, -999999);
+ elm_toolbar_menu_parent_set(tb, win);
+ menu = elm_toolbar_item_menu_get(item);
+
+ elm_menu_item_add(menu, NULL, "edit-cut", "Shrink", tb_3, ph4);
+ menu_it = elm_menu_item_add(menu, NULL, "edit-copy", "Mode", tb_4, ph4);
+ elm_menu_item_add(menu, menu_it, "edit-paste", "is set to", tb_4, ph4);
+ elm_menu_item_add(menu, NULL, "edit-delete", "Scroll", tb_5, ph4);
+
+ elm_box_pack_end(bx, tb);
+ evas_object_show(tb);
+
+ tb = elm_table_add(win);
+ evas_object_size_hint_weight_set(tb, 0.0, EVAS_HINT_EXPAND);
+ evas_object_size_hint_fill_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ ph = ph1;
+ elm_photo_size_set(ph, 40);
+ snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get());
+ elm_photo_file_set(ph, buf);
+ evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ 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, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ 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", elm_app_data_dir_get());
+ elm_photo_file_set(ph, buf);
+ evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ 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", elm_app_data_dir_get());
+ elm_photo_file_set(ph, buf);
+ evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ 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, 420, 250);
+ evas_object_show(win);
+}
#endif
Index: src/bin/test.c
===================================================================
--- src/bin/test.c (리비전 68610)
+++ src/bin/test.c (작업 사본)
@@ -57,6 +57,7 @@ void test_toolbar4(void *data, Evas_Object *obj, v
void test_toolbar5(void *data, Evas_Object *obj, void *event_info);
void test_toolbar6(void *data, Evas_Object *obj, void *event_info);
void test_toolbar7(void *data, Evas_Object *obj, void *event_info);
+void test_toolbar8(void *data, Evas_Object *obj, void *event_info);
void test_hoversel(void *data, Evas_Object *obj, void *event_info);
void test_list(void *data, Evas_Object *obj, void *event_info);
void test_list_horizontal(void *data, Evas_Object *obj, void *event_info);
@@ -401,6 +402,7 @@ add_tests:
ADD_TEST(NULL, "Toolbars", "Toolbar 5", test_toolbar5);
ADD_TEST(NULL, "Toolbars", "Toolbar 6", test_toolbar6);
ADD_TEST(NULL, "Toolbars", "Toolbar 7", test_toolbar7);
+ ADD_TEST(NULL, "Toolbars", "Toolbar 8", test_toolbar8);
//------------------------------//
ADD_TEST(NULL, "Lists", "List", test_list);
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel