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


C++ MenuItem类代码示例

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


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

示例1: isVegetarian

	private: bool isVegetarian(std::string name, Iterator<MenuItem>* iterator) {
		while (iterator->hasNext()) {
			MenuItem* menuItem = iterator->next();
			if (menuItem->getName().compare(name) == 0) {
				if (menuItem->isVegetarian()) {
					return true;
				}
			}
		}
		return false;
	}
开发者ID:formfoxk,项目名称:DesignPattern,代码行数:11,代码来源:Waitress.hpp

示例2: OnHoverItem

void Menu::OnHoverItem( Gwen::Controls::Base* pControl )
{
	if ( !ShouldHoverOpenMenu() ) return;

	MenuItem* pItem = gwen_cast<MenuItem>(pControl);
	if (!pItem) return;
	if ( pItem->IsMenuOpen() ) return;

	CloseAll();
	pItem->OpenMenu();
}
开发者ID:icebreaker,项目名称:Gwen,代码行数:11,代码来源:Menu.cpp

示例3: sourceModel

bool MenuProxyModel::filterAcceptsRow( int source_row, const QModelIndex &source_parent ) const
{
    QModelIndex index = sourceModel()->index( source_row, 0, source_parent );
    MenuItem * mItem = index.data( Qt::UserRole ).value<MenuItem*>();
    // accept only systemsettings categories that have children
    if ( mItem->children().isEmpty() && mItem->service()->serviceTypes().contains( "SystemSettingsCategory" ) ) {
        return false;
    } else {
        return true; // Items matching the regexp are disabled, not hidden
    }
}
开发者ID:KDE,项目名称:kde-workspace,代码行数:11,代码来源:MenuProxyModel.cpp

示例4: CloseSubMenus

void Menu::CloseSubMenus()
{
    for (auto i = _inner_panel->GetChildren().begin(); i != _inner_panel->GetChildren().end(); ++i)
    {
        MenuItem* item = dynamic_cast<MenuItem*>(*i);
        if (item != nullptr)
        {
            item->Close();
        }
    }
}
开发者ID:authenticate,项目名称:GWEN,代码行数:11,代码来源:Menu.cpp

示例5: addChild

bool TMenu::init()
{
	Layer::init();

	Menu * menu = Menu::create();
	addChild(menu);
	
	for (int i = 0; i < sizeof(title) / sizeof(*title); ++i)
	{
		MenuItemFont * item = MenuItemFont::create(title[i], [](Ref * sender){
			MenuItem * item = (MenuItem *)sender;
			int i = item->getTag() - 1000;
			Layer * l = NULL;
			if (title[i] == "T01CPP11") l = T01CPP11::create();
			else if (title[i] == "T02Vector") l = T02Vector::create();
			else if (title[i] == "T03Map") l = T03Map::create();
			else if (title[i] == "T04Label") l = T04Label::create();
			else if (title[i] == "T05Touch") l = T05Touch::create();
			else if (title[i] == "T06Box2D") l = T06Box2D::create();
			else if (title[i] == "T07PhysicsWorld") l = T07PhysicsWorld::create();
			else if (title[i] == "T08RayCast") l = T08RayCast::create();
			else if (title[i] == "T09Joint") l = T09Joint::create();
			else if (title[i] == "T10MultiShapes") l = T10MultiShapes::create();
			else if (title[i] == "T11FlyppyBird") l = T11FlyppyBird::create();
			if (l != NULL)
			{
				TBack * b = TBack::create();
				//Scene * s = Scene::create();
				Scene * s = Scene::createWithPhysics(); // 3.x ÎïÀíÊÀ½ç
				PhysicsWorld * world = s->getPhysicsWorld();
				world->setDebugDrawMask(PhysicsWorld::DEBUGDRAW_ALL);
				s->addChild(b);
				s->addChild(l);
				Director::getInstance()->pushScene(s);

			}
		});
		menu->addChild(item);
		item->setTag(1000 + i);
	}

	menu->alignItemsVertically();

	// ´¥Ãþ
	auto ev = EventListenerTouchOneByOne::create();
	//ev->onTouchBegan = std::bind(&TMenu::touchBegan, this, std::placeholders::_1, std::placeholders::_2);
	ev->onTouchBegan = CC_CALLBACK_2(TMenu::touchBegan, this);
	ev->onTouchMoved = [&](Touch * touch, Event *){
		setPositionY(getPositionY() + touch->getDelta().y);
	};
	_eventDispatcher->addEventListenerWithSceneGraphPriority(ev, this);

	return true;
}
开发者ID:hcy12321,项目名称:cocos2dx3xTest,代码行数:54,代码来源:TMenu.cpp

示例6: CloseAll

void Menu::CloseAll()
{
	for ( Base::List::iterator it = m_InnerPanel->Children.begin(); it != m_InnerPanel->Children.end(); ++it )
	{
		Base* pChild = *it;
		MenuItem* pItem = gwen_cast<MenuItem>(pChild);
		if ( !pItem ) continue;

		pItem->CloseMenu();
	}
}
开发者ID:icebreaker,项目名称:Gwen,代码行数:11,代码来源:Menu.cpp

示例7: MenuItem

MenuItem* Menu::AddItem(const std::string& name, const std::string& icon_name, const std::string& accelerator)
{
    MenuItem* item = new MenuItem(this);
    item->SetPadding(Padding(2, 4, 4, 4));
    item->SetText(name);
    item->SetImage(icon_name);
    item->SetAccelerator(accelerator);

    _OnAddItem(item);

    return item;
}
开发者ID:authenticate,项目名称:GWEN,代码行数:12,代码来源:Menu.cpp

示例8: el

 int MenuBar::calculateWidth(SizeConstraint inSizeConstraint) const
 {
     int result = 0;
     std::vector<Element *> items;
     el()->getElementsByTagName(XMLMenuItem::TagName(), items);
     for (size_t idx = 0; idx != items.size(); ++idx)
     {
         MenuItem * item = items[idx]->component()->downcast<MenuItem>();
         result += item->calculateWidth(inSizeConstraint) + Defaults::menuBarSpacing();
     }
     return result;
 }
开发者ID:nContreras40,项目名称:xulwin,代码行数:12,代码来源:Menu.cpp

示例9: menubar

Menu* App::menubar(CmdInfo* info, WidgetKit& kit, const LayoutKit& layout) {
    Menu* m = kit.menubar();
    for (CmdInfo* i = info; i->str != nil; i++) {
	MenuItem* mi = kit.menubar_item(kit.fancy_label(i->str));
	mi->menu(pulldown(i->submenu, i->options, kit, layout));
	m->append_item(mi);
    }
    m->item(0)->menu()->item(1)->state()->set(
	TelltaleState::is_enabled, false
    );
    return m;
}
开发者ID:LambdaCalculus379,项目名称:SLS-1.02,代码行数:12,代码来源:main.c

示例10: MenuItem

/**
*  @brief
*    Adds a standard item with a text
*/
MenuItem *Menu::AddItem(const String &sText)
{
	// Create item
	MenuItem *pItem = new MenuItem(*m_pGui);
	pItem->SetText(sText);

	// Add item
	AddItem(pItem);

	// Return item
	return pItem;
}
开发者ID:ByeDream,项目名称:pixellight,代码行数:16,代码来源:Menu.cpp

示例11: new

status_t
Menu::AddSeparatorItem()
{
    MenuItem *item = new(nothrow) MenuItem();
    if (item == NULL)
        return B_NO_MEMORY;

    item->SetType(MENU_ITEM_SEPARATOR);

    AddItem(item);
    return B_OK;
}
开发者ID:mmanley,项目名称:Antares,代码行数:12,代码来源:menu.cpp

示例12: printVegetarianMenu

 void printVegetarianMenu( Iterator<MenuItem>* iterator ) const
 {
   assert( iterator );
   HUM_TRACE(ACE_TEXT("Waitress::printVegetarianMenu"));
   while( iterator->hasNext() ) {
     MenuItem* menuItem = dynamic_cast< MenuItem* >(iterator->next() );
     if( menuItem->isVegetarian() ) {
       std::cout << menuItem->getName() << ", ";
       std::cout << menuItem->getPrice() << " -- ";
       std::cout << menuItem->getDescription() << std::endl;
     }
   }
 }
开发者ID:Jeonghum,项目名称:hfdpcpp_s,代码行数:13,代码来源:Waitress.hpp

示例13: getMenuItems

MenuItem* MenuItemList::getNextMenuItem(void) {
	int size = getMenuItems().size();
	if (size == 0) {
		return 0;
	} else {
		int newIndex = (getActiveItemIndex() + 1) % size;
		MenuItem* nextItem = getMenuItem(newIndex);
		getMenuItem(getActiveItemIndex())->setActive(false);
		nextItem->setActive(true);
		setActiveItemIndex(newIndex);
		return nextItem;
	}
}
开发者ID:Gnash,项目名称:allegris,代码行数:13,代码来源:MenuItemList.cpp

示例14: GetOpen

bool Menu::GetOpen() const
{
    for (auto i = _inner_panel->GetChildren().begin(); i != _inner_panel->GetChildren().end(); ++i)
    {
        MenuItem* item = dynamic_cast<MenuItem*>(*i);
        if (item != nullptr && item->GetOpen())
        {
            return true;
        }
    }

    return false;
}
开发者ID:authenticate,项目名称:GWEN,代码行数:13,代码来源:Menu.cpp

示例15: AddItem

MenuItem* ComboBox::AddItem( const UnicodeString& strLabel, const String& strName, Gwen::Event::Handler* pHandler, Gwen::Event::Handler::Function fn )
{
	MenuItem* pItem = m_Menu->AddItem( strLabel, L"", pHandler, fn );
	pItem->SetName( strName );

	pItem->onMenuItemSelected.Add( this, &ComboBox::OnItemSelected );

	//Default
	if ( m_SelectedItem == NULL )
		OnItemSelected( pItem );

	return pItem;
}
开发者ID:icebreaker,项目名称:Gwen,代码行数:13,代码来源:ComboBox.cpp


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