void test_toolbar3(void *data, Evas_Object *obj, void *event_info);
void test_toolbar4(void *data, Evas_Object *obj, void *event_info);
void test_toolbar5(void *data, Evas_Object *obj, void *event_info);
+void test_toolbar6(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);
ADD_TEST("Toolbar 3", test_toolbar3);
ADD_TEST("Toolbar 4", test_toolbar4);
ADD_TEST("Toolbar 5", test_toolbar5);
+ ADD_TEST("Toolbar 6", test_toolbar6);
ADD_TEST("Hoversel", test_hoversel);
ADD_TEST("List", test_list);
ADD_TEST("List - Horizontal", test_list_horizontal);
evas_object_resize(win, 320, 300);
evas_object_show(win);
}
+
+void
+test_toolbar6(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_Toolbar_Item *item;
+ Elm_Menu_Item *menu_item;
+ char buf[PATH_MAX];
+
+ win = elm_win_add(NULL, "toolbar", ELM_WIN_BASIC);
+ elm_win_title_set(win, "Toolbar");
+ 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);
+ elm_box_horizontal_set(bx, EINA_TRUE);
+ 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);
+ evas_object_show(bx);
+
+ tb = elm_toolbar_add(win);
+ elm_toolbar_orientation_set(tb, EINA_TRUE);
+ elm_toolbar_mode_shrink_set(tb, ELM_TOOLBAR_SHRINK_MENU);
+ 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_toolbar_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, 0);
+
+ item = elm_toolbar_item_append(tb, "clock", "Elementary", tb_5, ph4);
+ elm_toolbar_item_priority_set(item, -200);
+
+ item = elm_toolbar_item_append(tb, "refresh", "Menu", NULL, NULL);
+ elm_toolbar_item_menu_set(item, 1);
+ 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_item = elm_menu_item_add(menu, NULL, "edit-copy", "Mode", tb_4, ph4);
+ elm_menu_item_add(menu, menu_item, "edit-paste", "is set to", tb_4, ph4);
+ elm_menu_item_add(menu, NULL, "edit-delete", "Menu", tb_5, ph4);
+
+ elm_box_pack_end(bx, tb);
+ evas_object_show(tb);
+
+ tb = elm_table_add(win);
+ //elm_table_homogeneous_set(tb, 1);
+ evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, 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", PACKAGE_DATA_DIR);
+ 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", PACKAGE_DATA_DIR);
+ 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", PACKAGE_DATA_DIR);
+ 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, 320, 300);
+ evas_object_show(win);
+}
#endif
EAPI Eina_Bool elm_toolbar_item_cursor_engine_only_get(const Elm_Toolbar_Item *item) EINA_ARG_NONNULL(1);
/**
+ * Change a toolbar's orientation
+ * @param obj The toolbar object
+ * @param vertical If @c EINA_TRUE, the toolbar is vertical
+ * By default, a toolbar will be horizontal. Use this function to create a vertical toolbar.
+ * @ingroup Toolbar
+ */
+ EAPI void elm_toolbar_orientation_set(Evas_Object *obj, Eina_Bool vertical) EINA_ARG_NONNULL(1);
+
+ /**
+ * Get a toolbar's orientation
+ * @param obj The toolbar object
+ * @return If @c EINA_TRUE, the toolbar is vertical
+ * By default, a toolbar will be horizontal. Use this function to determine whether a toolbar is vertical.
+ * @ingroup Toolbar
+ */
+ EAPI Eina_Bool elm_toolbar_orientation_get(Evas_Object *obj) EINA_ARG_NONNULL(1);
+
+ /**
* @}
*/
double align;
Eina_Bool homogeneous : 1;
Eina_Bool no_select : 1;
+ Eina_Bool vertical : 1;
Ecore_Job *resize_job;
};
_sizing_eval(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
- Evas_Coord minw = -1, minh = -1, minw_bx;
+ Evas_Coord minw = -1, minh = -1, minw_bx, minh_bx;
Evas_Coord vw = 0, vh = 0;
Evas_Coord w, h;
edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr),
&minw, &minh);
evas_object_geometry_get(obj, NULL, NULL, &w, &h);
+fprintf(stderr, "%i: w=%i, h=%i\n", __LINE__, w, h);
if (w < minw) w = minw;
if (h < minh) h = minh;
-
+fprintf(stderr, "%i: w=%i, h=%i\n", __LINE__, w, h);
evas_object_resize(wd->scr, w, h);
evas_object_size_hint_min_get(wd->bx, &minw, &minh);
minw_bx = minw;
- if (w > minw) minw = w;
+ minh_bx = minh;
+fprintf(stderr, "%i: minw=%i, minh=%i\n", __LINE__, minw, minh);
+ if (wd->vertical && (h > minh)) minh = h;
+ if ((!wd->vertical) && (w > minw)) minw = w;
+fprintf(stderr, "%i: minw=%i, minh=%i\n", __LINE__, minw, minh);
evas_object_resize(wd->bx, minw, minh);
elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
switch (wd->shrink_mode)
{
case ELM_TOOLBAR_SHRINK_MENU: /* fallthrough */
case ELM_TOOLBAR_SHRINK_HIDE: /* fallthrough */
- case ELM_TOOLBAR_SHRINK_SCROLL: minw = w - vw; break;
- case ELM_TOOLBAR_SHRINK_NONE: minw = minw_bx + (w - vw); break;
+ case ELM_TOOLBAR_SHRINK_SCROLL:
+ if (wd->vertical) minh = h - vh;
+ else minw = w - vw;
+ break;
+ case ELM_TOOLBAR_SHRINK_NONE:
+ if (wd->vertical) minh = minh_bx + (h - vh);
+ else minw = minw_bx + (w - vw);
+ break;
}
+fprintf(stderr, "%i: minw=%i, minh=%i\n", __LINE__, minw, minh);
minh = minh + (h - vh);
+fprintf(stderr, "%i: minw=%i, minh=%i\n", __LINE__, minw, minh);
evas_object_size_hint_min_set(obj, minw, minh);
evas_object_size_hint_max_set(obj, -1, -1);
}
Evas_Object *obj = (Evas_Object *) data;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
- _els_box_layout(o, priv, 1, wd->homogeneous, elm_widget_mirrored_get(obj));
+ _els_box_layout(o, priv, !wd->vertical, wd->homogeneous, elm_widget_mirrored_get(obj));
}
static Elm_Toolbar_Item *
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
edje_object_size_min_restricted_calc(it->base.view, &mw, &mh, mw, mh);
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
- evas_object_size_hint_weight_set(it->base.view, -1.0, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(it->base.view, 0.5, EVAS_HINT_FILL);
+ if (wd->vertical)
+ {
+ evas_object_size_hint_weight_set(it->base.view, EVAS_HINT_EXPAND, -1.0);
+ evas_object_size_hint_align_set(it->base.view, EVAS_HINT_FILL, 0.5);
+ }
+ else
+ {
+ evas_object_size_hint_weight_set(it->base.view, -1.0, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(it->base.view, 0.5, EVAS_HINT_FILL);
+ }
evas_object_size_hint_min_set(it->base.view, mw, mh);
evas_object_event_callback_add(it->base.view, EVAS_CALLBACK_RESIZE,
_resize_item, obj);
_elm_toolbar_item_label_update(Elm_Toolbar_Item *item)
{
Evas_Coord mw = -1, mh = -1;
+ Widget_Data *wd = elm_widget_data_get(item->base.widget);
edje_object_part_text_set(item->base.view, "elm.text", item->label);
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
edje_object_size_min_restricted_calc(item->base.view, &mw, &mh, mw, mh);
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
- evas_object_size_hint_weight_set(item->base.view, -1.0, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(item->base.view, 0.5, EVAS_HINT_FILL);
+ if (wd->vertical)
+ {
+ evas_object_size_hint_weight_set(item->base.view, EVAS_HINT_EXPAND, -1.0);
+ evas_object_size_hint_align_set(item->base.view, EVAS_HINT_FILL, 0.5);
+ }
+ else
+ {
+ evas_object_size_hint_weight_set(item->base.view, -1.0, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(item->base.view, 0.5, EVAS_HINT_FILL);
+ }
evas_object_size_hint_min_set(item->base.view, mw, mh);
}
Elm_Toolbar_Item_State *it_state;
Eina_List *l;
Evas_Coord mw = -1, mh = -1;
+ Widget_Data *wd = elm_widget_data_get(item->base.widget);
Evas_Object *old_icon = edje_object_part_swallow_get(item->base.view,
"elm.swallow.icon");
elm_widget_sub_object_del(item->base.view, old_icon);
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
edje_object_size_min_restricted_calc(item->base.view, &mw, &mh, mw, mh);
elm_coords_finger_size_adjust(1, &mw, 1, &mh);
- evas_object_size_hint_weight_set(item->base.view, -1.0, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(item->base.view, 0.5, EVAS_HINT_FILL);
+ if (wd->vertical)
+ {
+ evas_object_size_hint_weight_set(item->base.view, EVAS_HINT_EXPAND, -1.0);
+ evas_object_size_hint_align_set(item->base.view, EVAS_HINT_FILL, 0.5);
+ }
+ else
+ {
+ evas_object_size_hint_weight_set(item->base.view, -1.0, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(item->base.view, 0.5, EVAS_HINT_FILL);
+ }
evas_object_size_hint_min_set(item->base.view, mw, mh);
EINA_LIST_FOREACH(item->states, l, it_state)
if (!wd) return ELM_ICON_LOOKUP_THEME_FDO;
return wd->lookup_order;
}
+
+EAPI void
+elm_toolbar_orientation_set(Evas_Object *obj, Eina_Bool vertical)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ wd->vertical = vertical;
+ _sizing_eval(obj);
+}
+
+EAPI Eina_Bool
+elm_toolbar_orientation_get(Evas_Object *obj)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return EINA_FALSE;
+ return wd->vertical;
+}