Esempio n. 1
0
EwkContextMenuItem::EwkContextMenuItem(const WebContextMenuItemData& item)
    : m_type(static_cast<Ewk_Context_Menu_Item_Type>(item.type()))
    , m_action(static_cast<Ewk_Context_Menu_Item_Action>(item.action()))
    , m_title(item.title().utf8().data())
    , m_isChecked(item.checked())
    , m_isEnabled(item.enabled())
    , m_parentMenu(0)
    , m_subMenu(0)
{
}
Esempio n. 2
0
WebKitContextMenuItem* webkitContextMenuItemCreate(WebContextMenuItem* webItem)
{
    WebKitContextMenuItem* item = WEBKIT_CONTEXT_MENU_ITEM(g_object_new(WEBKIT_TYPE_CONTEXT_MENU_ITEM, NULL));
    WebContextMenuItemData* itemData = webItem->data();
    item->priv->menuItem = WTF::adoptPtr(new ContextMenuItem(itemData->type(), itemData->action(), itemData->title(), itemData->enabled(), itemData->checked()));
    const Vector<WebContextMenuItemData>& subMenu = itemData->submenu();
    if (!subMenu.size())
        return item;

    RefPtr<MutableArray> subMenuItems = MutableArray::create();
    subMenuItems->reserveCapacity(subMenu.size());
    for (size_t i = 0; i < subMenu.size(); ++i)
        subMenuItems->append(WebContextMenuItem::create(subMenu[i]).get());
    webkitContextMenuItemSetSubMenu(item, adoptGRef(webkitContextMenuCreate(subMenuItems.get())));

    return item;
}