[Elementary] Add menu buttons as submenus in Elm_Toolbar "More" button.
Previously, if there were buttons with menus in the toolbar, they would be added but not its menu items. Even though this is working fine, this is a hack, since Elm_Menu should really offer reparenting or something like that -- and this will destroy and recreate the whole menu structure on every toolbar resize. SVN revision: 53695
This commit is contained in:
parent
5174660ea7
commit
a8b171115c
|
@ -522,6 +522,36 @@ elm_menu_object_get(const Elm_Menu_Item *it)
|
|||
return it->base.view;
|
||||
}
|
||||
|
||||
static void
|
||||
_item_clone(Evas_Object *obj, Elm_Menu_Item *parent, Elm_Menu_Item *item)
|
||||
{
|
||||
Elm_Menu_Item *new_item, *subitem;
|
||||
Eina_List *iter;
|
||||
|
||||
if (item->separator)
|
||||
new_item = elm_menu_item_separator_add(obj, parent);
|
||||
else
|
||||
new_item = elm_menu_item_add(obj, parent, item->icon_str, item->label, item->func, item->base.data);
|
||||
elm_menu_item_disabled_set(new_item, item->disabled);
|
||||
|
||||
EINA_LIST_FOREACH(item->submenu.items, iter, subitem)
|
||||
_item_clone(obj, new_item, subitem);
|
||||
}
|
||||
|
||||
void
|
||||
elm_menu_clone(Evas_Object *from_menu, Evas_Object *to_menu, Elm_Menu_Item *parent)
|
||||
{
|
||||
ELM_CHECK_WIDTYPE(from_menu, widtype);
|
||||
ELM_CHECK_WIDTYPE(to_menu, widtype);
|
||||
Widget_Data *from_wd = elm_widget_data_get(from_menu);
|
||||
Eina_List *iter;
|
||||
Elm_Menu_Item *item;
|
||||
|
||||
if (!from_wd) return;
|
||||
EINA_LIST_FOREACH(from_wd->items, iter, item)
|
||||
_item_clone(to_menu, parent, item);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an item at the end
|
||||
*
|
||||
|
|
|
@ -146,6 +146,8 @@ void elm_object_sub_tooltip_content_cb_set(Evas_Object *eventare
|
|||
void elm_cursor_theme(Elm_Cursor *cur);
|
||||
void elm_object_sub_cursor_set(Evas_Object *eventarea, Evas_Object *owner, const char *cursor);
|
||||
|
||||
void elm_menu_clone(Evas_Object *from_menu, Evas_Object *to_menu, Elm_Menu_Item *parent);
|
||||
|
||||
Eina_Bool _elm_dangerous_call_check(const char *call);
|
||||
|
||||
Evas_Object *_elm_scroller_edje_object_get(Evas_Object *obj);
|
||||
|
|
|
@ -361,6 +361,7 @@ _resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event
|
|||
item = elm_menu_item_add(menu, NULL, it->icon_str, it->label,
|
||||
it->func, it->base.data);
|
||||
elm_menu_item_disabled_set(item, it->disabled);
|
||||
if (it->o_menu) elm_menu_clone(it->o_menu, menu, item);
|
||||
}
|
||||
evas_object_hide(it->base.view);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue