Exemple #1
0
/**
 * @internal
 *
 * Appends the WebCore's item to the context menu object.
 *
 * @param menu the context menu object
 * @param core the WebCore's context menu item that will be added to the context menu
 * @note emits a signal "contextmenu,item,appended"
 *
 * @see ewk_context_menu_item_new
 */
void ewk_context_menu_item_append(Ewk_Context_Menu* menu, WebCore::ContextMenuItem& core)
{
    Ewk_Context_Menu_Item_Type type = static_cast<Ewk_Context_Menu_Item_Type>(core.type());
    Ewk_Context_Menu_Action action = static_cast<Ewk_Context_Menu_Action>(core.action());

    Ewk_Context_Menu_Item* menu_item = ewk_context_menu_item_new
                                           (type, action, 0, core.title().utf8().data(), core.checked(),
                                           core.enabled());
    EINA_SAFETY_ON_NULL_RETURN(menu_item);

    menu->items = eina_list_append(menu->items, menu_item);
    evas_object_smart_callback_call(menu->view, "contextmenu,item,appended", menu);
}
WebContextMenuItemData::WebContextMenuItemData(const WebCore::ContextMenuItem& item, WebCore::ContextMenu* menu)
    : m_type(item.type())
    , m_action(item.action())
    , m_title(item.title())
{
    if (m_type == WebCore::SubmenuType) {
#if USE(CROSS_PLATFORM_CONTEXT_MENUS)
        const Vector<WebCore::ContextMenuItem>& coreSubmenu = item.subMenuItems();
#else
        Vector<WebCore::ContextMenuItem> coreSubmenu = WebCore::contextMenuItemVector(item.platformSubMenu());
#endif
        m_submenu = kitItems(coreSubmenu, menu);
    }
    
    m_enabled = item.enabled();
    m_checked = item.checked();
}