当前位置: 首页>>代码示例>>C++>>正文


C++ ContextMenuItem类代码示例

本文整理汇总了C++中ContextMenuItem的典型用法代码示例。如果您正苦于以下问题:C++ ContextMenuItem类的具体用法?C++ ContextMenuItem怎么用?C++ ContextMenuItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ContextMenuItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: appendItem

void ContextMenu::appendItem(ContextMenuItem& item)
{
    if (!m_platformDescription)
        return;
        
    PlatformMenuItemDescription itemDescription = item.releasePlatformDescription();    
    wxItemKind menuKindWx = ( itemDescription.type == CheckableActionType ) ? wxITEM_CHECK : wxITEM_NORMAL;
    wxString titleWx(itemDescription.title);
    int idWx = wxID_ANY;
    wxMenuItem * itemWx;

    ItemActionMap::const_iterator end = s_itemActions.end();
    for (ItemActionMap::const_iterator it = s_itemActions.begin();  it != end; ++it) {
        if (it->second == itemDescription.action)
            idWx = it->first;
    }

    if (itemDescription.subMenu) {
        itemWx = new wxMenuItem(m_platformDescription, idWx, titleWx, wxEmptyString, wxITEM_NORMAL, itemDescription.subMenu);
    } else if (itemDescription.type != SeparatorType) {
        itemWx = new wxMenuItem(m_platformDescription, idWx, titleWx, wxT(""), menuKindWx);
    } else {
        itemWx = new wxMenuItem(m_platformDescription);
    }

    s_itemActions.add(itemWx->GetId(), item.action());
    
    m_platformDescription->Append(itemWx);
    m_platformDescription->Enable(itemWx->GetId(), itemDescription.enabled);
    
    if (menuKindWx == wxITEM_CHECK)
        m_platformDescription->Check(itemWx->GetId(), itemDescription.checked);        
}
开发者ID:0omega,项目名称:platform_external_webkit,代码行数:33,代码来源:ContextMenuWx.cpp

示例2: wstring

bool ContextMenuUtil::InitMenus(void)
{
	_menuList = new vector<ContextMenuItem*>();

	Json::Value jsonRoot;

	jsonRoot[NATIVITY_COMMAND] = NATIVITY_GET_CONTEXT_MENU_LIST;

	for (vector<wstring>::iterator it = _selectedFiles->begin(); it != _selectedFiles->end(); it++)
	{
		jsonRoot[NATIVITY_VALUE].append(StringUtil::toString(*it));
	}

	Json::FastWriter jsonWriter;

	wstring* getMenuMessage = new wstring();

	getMenuMessage->append(StringUtil::toWstring(jsonWriter.write(jsonRoot)));

	wstring* getMenuReceived = new wstring();

	if (_communicationSocket->SendMessageReceiveResponse(getMenuMessage->c_str(), getMenuReceived))
	{
		Json::Reader jsonReader;
		Json::Value jsonResponse;

		if (!jsonReader.parse(StringUtil::toString(*getMenuReceived), jsonResponse))
		{
			delete getMenuReceived;
			delete getMenuMessage;

			return false;
		}

		Json::Value jsonContextMenuItemsList = jsonResponse.get(NATIVITY_VALUE, "");

		for (unsigned int i = 0; i < jsonContextMenuItemsList.size(); i++)
		{
			Json::Value jsonContextMenuItem = jsonContextMenuItemsList[i];

			ContextMenuItem* contextMenuItem = new ContextMenuItem();
			contextMenuItem->SetId(i);

			if (!_ParseContextMenuItem(jsonContextMenuItem, contextMenuItem))
			{
				delete getMenuReceived;
				delete getMenuMessage;

				return false;
			}

			_menuList->push_back(contextMenuItem);
		}
	}

	delete getMenuReceived;
	delete getMenuMessage;

	return true;;
}
开发者ID:Moscarda,项目名称:liferay-nativity,代码行数:60,代码来源:ContextMenuUtil.cpp

示例3: insertItem

void ContextMenu::insertItem(unsigned position, ContextMenuItem& item)
{
	checkOrEnableIfNeeded( item );
	
	if( item.releasePlatformDescription() != NULL )
	    m_platformDescription->AddItem( item.releasePlatformDescription(), position );
}
开发者ID:PyroOS,项目名称:Pyro,代码行数:7,代码来源:ContextMenuSyllable.cpp

示例4: ContextMenuItem

//! Insert a menu item at specified position.
ContextMenuItem* ContextMenu::insertItem(unsigned int idx, const std::string& text, int commandId, bool enabled,
    bool hasSubMenu, bool checked, bool autoChecking)
{
  ContextMenuItem* newItem = new ContextMenuItem( this, text );
  newItem->setEnabled( enabled );
  newItem->setSubElement( true );
  newItem->setChecked( checked );
  newItem->setAutoChecking( autoChecking );
  newItem->setText( text );
  newItem->setFlag( ContextMenuItem::drawSubmenuSprite );
  newItem->setIsSeparator( text.empty() );
  newItem->setCommandId( commandId );
  sendChildToBack( newItem );

  if (hasSubMenu)
  {
    ContextMenu* subMenu = newItem->addSubMenu( commandId );
    subMenu->setVisible( false );
  }

  if ( idx < _d->items.size() )
  {
    _d->items.insert( _d->items.begin() + idx, newItem );
  }
  else
  {
    _d->items.push_back( newItem );
  }

  return newItem;
}
开发者ID:andrelago13,项目名称:caesaria-game,代码行数:32,代码来源:contextmenu.cpp

示例5: PerformAction

bool ContextMenuUtil::PerformAction(int command)
{
	ContextMenuItem*  item;
	
	if(!GetContextMenuItem(command, &item))
	{
		return false;
	}

	wstring* list = new wstring();

	if(!ParserUtil::SerializeList(_selectedFiles, list, true))
	{
		return false;
	}
	
	wchar_t* buffer = new wchar_t(10);

	_itow_s(item->GetId(), buffer, 10, 10);

	wstring* idString = new wstring(buffer);

	map<wstring*, wstring*>* message = new map<wstring*, wstring*>();
	wstring* id = new wstring(ID);
	wstring* files = new wstring(FILES);

	message->insert(make_pair(id, idString));
	message->insert(make_pair(files, list));

	wstring* messageString = new wstring();

	if(!ParserUtil::SerializeMessage(message, messageString, true))
	{
		return false;
	}

	NativityMessage* nativityMessage = new NativityMessage();
	
	wstring* title = new wstring(PERFORM_ACTION);
	nativityMessage->SetCommand(title);
	nativityMessage->SetValue(messageString);

	wstring* nativityMessageString = new wstring();

	if(!ParserUtil::SerializeMessage(nativityMessage, nativityMessageString))
	{
		return false;
	}

	wstring* response = new wstring();

	if(!_communicationSocket->SendMessageReceiveResponse(nativityMessageString->c_str(), response))
	{
		return false;
	}

	return true;
}
开发者ID:dantia,项目名称:liferay-nativity,代码行数:58,代码来源:ContextMenuUtil.cpp

示例6: populateCustomMenuItems

void ContextMenuClientImpl::populateCustomMenuItems(WebCore::ContextMenu* defaultMenu, WebContextMenuData* data)
{
    Vector<WebMenuItemInfo> customItems;
    for (size_t i = 0; i < defaultMenu->itemCount(); ++i) {
        ContextMenuItem* inputItem = defaultMenu->itemAtIndex(i, defaultMenu->platformDescription());
        if (inputItem->action() < ContextMenuItemBaseCustomTag || inputItem->action() >  ContextMenuItemLastCustomTag)
            continue;

        WebMenuItemInfo outputItem;
        outputItem.label = inputItem->title();
        outputItem.enabled = inputItem->enabled();
        outputItem.checked = inputItem->checked();
        outputItem.action = static_cast<unsigned>(inputItem->action() - ContextMenuItemBaseCustomTag);
        switch (inputItem->type()) {
        case ActionType:
            outputItem.type = WebMenuItemInfo::Option;
            break;
        case CheckableActionType:
            outputItem.type = WebMenuItemInfo::CheckableOption;
            break;
        case SeparatorType:
            outputItem.type = WebMenuItemInfo::Separator;
            break;
        case SubmenuType:
            outputItem.type = WebMenuItemInfo::Group;
            break;
        }
        customItems.append(outputItem);
    }

    WebVector<WebMenuItemInfo> outputItems(customItems.size());
    for (size_t i = 0; i < customItems.size(); ++i)
        outputItems[i] = customItems[i];
    data->customItems.swap(outputItems);
}
开发者ID:,项目名称:,代码行数:35,代码来源:

示例7: String

void CustomContextMenuProvider::appendSeparator(ContextMenu& contextMenu)
{
    // Avoid separators at the start of any menu and submenu.
    if (!contextMenu.items().size())
        return;

    // Collapse all sequences of two or more adjacent separators in the menu or
    // any submenus to a single separator.
    ContextMenuItem lastItem = contextMenu.items().last();
    if (lastItem.type() == SeparatorType)
        return;

    contextMenu.appendItem(ContextMenuItem(SeparatorType, ContextMenuItemCustomTagNoAction, String(), String()));
}
开发者ID:alexanderbill,项目名称:blink-crosswalk,代码行数:14,代码来源:CustomContextMenuProvider.cpp

示例8: addItem

ContextMenuItem* MainMenu::addItem(const std::string& text, int commandId, bool enabled, bool hasSubMenu, bool checked, bool autoChecking)
{
    ContextMenuItem* ret = ContextMenu::addItem( text, commandId, enabled, hasSubMenu, checked, autoChecking );
    if( ret && ret->getSubMenu() )
    {
      //ret->getSubMenu()->setStyle( getStyle().getSubStyle( NES_SUBMENU ).getName() );
		  ret->setFlag( ContextMenuItem::drawSubmenuSprite, false );
      ret->setBackgroundMode( Label::bgNone ); 
    }
    //refItem.alignEnabled = true;
    //refItem.horizontal = EGUIA_CENTER;
    //refItem.vertical = EGUIA_CENTER;

    return ret;
}
开发者ID:BlackFoks,项目名称:opencaesar3,代码行数:15,代码来源:mainmenu.cpp

示例9: createAndAppendSpellingAndGrammarSubMenu

static void createAndAppendSpellingAndGrammarSubMenu(const HitTestResult& result, ContextMenuItem& spellingAndGrammarMenuItem)
{
    ContextMenu spellingAndGrammarMenu(result);

    ContextMenuItem showSpellingPanel(ActionType, ContextMenuItemTagShowSpellingPanel, 
        contextMenuItemTagShowSpellingPanel(true));
    ContextMenuItem checkSpelling(ActionType, ContextMenuItemTagCheckSpelling, 
        contextMenuItemTagCheckSpelling());
    ContextMenuItem checkAsYouType(CheckableActionType, ContextMenuItemTagCheckSpellingWhileTyping, 
        contextMenuItemTagCheckSpellingWhileTyping());
    ContextMenuItem grammarWithSpelling(CheckableActionType, ContextMenuItemTagCheckGrammarWithSpelling, 
        contextMenuItemTagCheckGrammarWithSpelling());
#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
    ContextMenuItem correctSpelling(CheckableActionType, ContextMenuItemTagCorrectSpellingAutomatically, 
        contextMenuItemTagCorrectSpellingAutomatically());
#endif

    spellingAndGrammarMenu.appendItem(showSpellingPanel);
    spellingAndGrammarMenu.appendItem(checkSpelling);
#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
    spellingAndGrammarMenu.appendItem(*separatorItem());
#endif
    spellingAndGrammarMenu.appendItem(checkAsYouType);
    spellingAndGrammarMenu.appendItem(grammarWithSpelling);
#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
    spellingAndGrammarMenu.appendItem(correctSpelling);
#endif

    spellingAndGrammarMenuItem.setSubMenu(&spellingAndGrammarMenu);
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:30,代码来源:BCContextMenuWK.cpp

示例10: createAndAppendFontSubMenu

static void createAndAppendFontSubMenu(const HitTestResult& result, ContextMenuItem& fontMenuItem)
{
    ContextMenu fontMenu(result);

#if PLATFORM(MAC)
    ContextMenuItem showFonts(ActionType, ContextMenuItemTagShowFonts, contextMenuItemTagShowFonts());
#endif
    ContextMenuItem bold(CheckableActionType, ContextMenuItemTagBold, contextMenuItemTagBold());
    ContextMenuItem italic(CheckableActionType, ContextMenuItemTagItalic, contextMenuItemTagItalic());
    ContextMenuItem underline(CheckableActionType, ContextMenuItemTagUnderline, contextMenuItemTagUnderline());
    ContextMenuItem outline(ActionType, ContextMenuItemTagOutline, contextMenuItemTagOutline());
#if PLATFORM(MAC)
    ContextMenuItem styles(ActionType, ContextMenuItemTagStyles, contextMenuItemTagStyles());
    ContextMenuItem showColors(ActionType, ContextMenuItemTagShowColors, contextMenuItemTagShowColors());
#endif

#if PLATFORM(MAC)
    fontMenu.appendItem(showFonts);
#endif
    fontMenu.appendItem(bold);
    fontMenu.appendItem(italic);
    fontMenu.appendItem(underline);
    fontMenu.appendItem(outline);
#if PLATFORM(MAC)
    fontMenu.appendItem(styles);
    fontMenu.appendItem(*separatorItem());
    fontMenu.appendItem(showColors);
#endif

    fontMenuItem.setSubMenu(&fontMenu);
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:31,代码来源:BCContextMenuWK.cpp

示例11: toWebCoreStringWithNullCheck

v8::Handle<v8::Value> V8InspectorFrontendHost::showContextMenuCallback(const v8::Arguments& args)
{
    if (args.Length() < 2)
        return v8::Undefined();

    v8::Local<v8::Object> eventWrapper = v8::Local<v8::Object>::Cast(args[0]);
    if (!V8MouseEvent::info.equals(V8DOMWrapper::domWrapperType(eventWrapper)))
        return v8::Undefined();

    Event* event = V8Event::toNative(eventWrapper);
    if (!args[1]->IsArray())
        return v8::Undefined();

    v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(args[1]);
    Vector<ContextMenuItem*> items;

    for (size_t i = 0; i < array->Length(); ++i) {
        v8::Local<v8::Object> item = v8::Local<v8::Object>::Cast(array->Get(v8::Integer::New(i)));
        v8::Local<v8::Value> type = item->Get(v8::String::New("type"));
        v8::Local<v8::Value> id = item->Get(v8::String::New("id"));
        v8::Local<v8::Value> label = item->Get(v8::String::New("label"));
        v8::Local<v8::Value> enabled = item->Get(v8::String::New("enabled"));
        v8::Local<v8::Value> checked = item->Get(v8::String::New("checked"));
        if (!type->IsString())
            continue;
        String typeString = toWebCoreStringWithNullCheck(type);
        if (typeString == "separator") {
            items.append(new ContextMenuItem(SeparatorType,
                                             ContextMenuItemCustomTagNoAction,
                                             String()));
        } else {
            ContextMenuAction typedId = static_cast<ContextMenuAction>(ContextMenuItemBaseCustomTag + id->ToInt32()->Value());
            ContextMenuItem* menuItem = new ContextMenuItem((typeString == "checkbox" ? CheckableActionType : ActionType), typedId, toWebCoreStringWithNullCheck(label));
            if (checked->IsBoolean())
                menuItem->setChecked(checked->ToBoolean()->Value());
            if (enabled->IsBoolean())
                menuItem->setEnabled(enabled->ToBoolean()->Value());
            items.append(menuItem);
        }
    }

    InspectorFrontendHost* frontendHost = V8InspectorFrontendHost::toNative(args.Holder());
    frontendHost->showContextMenu(event, items);

    return v8::Undefined();
}
开发者ID:achellies,项目名称:WinCEWebKit,代码行数:46,代码来源:V8InspectorFrontendHostCustom.cpp

示例12: appendItem

void ContextMenu::appendItem(ContextMenuItem& item)
{
    checkOrEnableIfNeeded(item);

    BMenuItem* menuItem = item.releasePlatformDescription();
    if (menuItem)
        m_platformDescription->AddItem(menuItem);
}
开发者ID:achellies,项目名称:WinCEWebKit,代码行数:8,代码来源:ContextMenuHaiku.cpp

示例13: GetContextMenuAction

bool ContextMenuUtil::GetContextMenuAction(int action, ContextMenuAction** item)
{
	ContextMenuItem* contextMenuItem;

	if (GetContextMenuItem(action, &contextMenuItem))
	{
		ContextMenuAction* action = new ContextMenuAction();
		action->SetUuid(contextMenuItem->GetUuid());
		action->SetFiles(_selectedFiles);

		item = &action;

		return true;
	}

	return false;
}
开发者ID:Moscarda,项目名称:liferay-nativity,代码行数:17,代码来源:ContextMenuUtil.cpp

示例14: insertItem

void ContextMenu::insertItem(unsigned int position, ContextMenuItem& item)
{
    if (!m_platformDescription)
        return;

    checkOrEnableIfNeeded(item);
    ::InsertMenuItem(m_platformDescription, position, TRUE, item.releasePlatformDescription());
}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:8,代码来源:ContextMenuWin.cpp

示例15: appendItem

void ContextMenu::appendItem(ContextMenuItem& item)
{
    ASSERT(m_platformDescription);

    GtkMenuItem* platformItem = item.releasePlatformDescription();
    ASSERT(platformItem);
    gtk_menu_shell_append(GTK_MENU_SHELL(m_platformDescription), GTK_WIDGET(platformItem));
    gtk_widget_show(GTK_WIDGET(platformItem));
}
开发者ID:CannedFish,项目名称:deepin-webkit,代码行数:9,代码来源:ContextMenuGtk.cpp


注:本文中的ContextMenuItem类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。