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


C++ IconButton类代码示例

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


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

示例1: IconButton

// MakeIcon
IconButton*
EditOnStageTool::MakeIcon()
{
	IconButton* icon = new IconButton("edit icon", 0, NULL, NULL);
	icon->SetIcon(kEditIcon, kIconWidth, kIconHeight, kIconFormat);
	return icon;
}
开发者ID:stippi,项目名称:Clockwerk,代码行数:8,代码来源:EditOnStageTool.cpp

示例2: IconButton

// MakeIcon
IconButton*
NoneTool::MakeIcon()
{
	IconButton* icon = new IconButton("no tool icon", 0, NULL, NULL);
	icon->SetIcon(kWatchIcon, kIconWidth, kIconHeight, kIconFormat);
	return icon;
}
开发者ID:stippi,项目名称:Clockwerk,代码行数:8,代码来源:NoneTool.cpp

示例3: initStyleOption

void ExLineEdit::updateGeometries()
{
    QStyleOptionFrameV2 panel;
    initStyleOption(&panel);
    QRect rect = style()->subElementRect(QStyle::SE_LineEditContents, &panel, this);

    int padding = 3;

    int width = rect.width();

    int clearButton_W = this->height();

    int icons_W = 0;
    int icon_H = this->height() -2;
    int icon_W = icon_H - 4;
    for (int i = 0; i < m_left_icons.count(); i++)
    {
        IconButton *bt = m_left_icons.at(i);
        bt->setGeometry(rect.x() + 2 + icons_W,1, icon_W, icon_H);
        icons_W += icon_W ;
    }
    
    m_lineEdit->setGeometry(rect.x() + 2 + icons_W, padding,
                            width - clearButton_W - icons_W, this->height() - padding*2);

    m_clearButton->setGeometry(this->width() - clearButton_W, 0,
                               clearButton_W, this->height());
}
开发者ID:RavetcoFX,项目名称:Yarock,代码行数:28,代码来源:exlineedit.cpp

示例4: MenuSetting

MenuSettingRGBA::MenuSettingRGBA(GMenu2X *gmenu2x, const string &name, const string &description, RGBAColor *value)
	: MenuSetting(gmenu2x,name,description) {
	IconButton *btn;

	selPart = 0;
	_value = value;
	originalValue = *value;
	this->setR(this->value().r);
	this->setG(this->value().g);
	this->setB(this->value().b);
	this->setA(this->value().a);

	btn = new IconButton(gmenu2x, "skin:imgs/buttons/x.png", gmenu2x->tr["Decrease"]);
	btn->setAction(MakeDelegate(this, &MenuSettingRGBA::dec));
	buttonBox.add(btn);

	btn = new IconButton(gmenu2x, "skin:imgs/buttons/y.png", gmenu2x->tr["Increase"]);
	btn->setAction(MakeDelegate(this, &MenuSettingRGBA::inc));
	buttonBox.add(btn);

	btn = new IconButton(gmenu2x, "skin:imgs/buttons/left.png");
	btn->setAction(MakeDelegate(this, &MenuSettingRGBA::leftComponent));
	buttonBox.add(btn);

	btn = new IconButton(gmenu2x, "skin:imgs/buttons/right.png", gmenu2x->tr["Change color component"]);
	btn->setAction(MakeDelegate(this, &MenuSettingRGBA::rightComponent));
	buttonBox.add(btn);
}
开发者ID:NeoTheFox,项目名称:gmenu2x,代码行数:28,代码来源:menusettingrgba.cpp

示例5: IconButton

void MenuSettingBool::initButton()
{
	IconButton *btn = new IconButton(gmenu2x, "skin:imgs/buttons/b.png",
									 gmenu2x->tr["Switch"]);
	btn->setAction(MakeDelegate(this, &MenuSettingBool::toggle));
	buttonBox.add(btn);
}
开发者ID:NeoTheFox,项目名称:gmenu2x,代码行数:7,代码来源:menusettingbool.cpp

示例6: IconButton

// MakeIcon
IconButton*
PickTool::MakeIcon()
{
	IconButton* icon = new IconButton("pick icon", 0, NULL, NULL);
	icon->SetIcon(kPickIcon, kIconWidth, kIconHeight, kIconFormat);
	return icon;
}
开发者ID:stippi,项目名称:Clockwerk,代码行数:8,代码来源:PickTool.cpp

示例7: onClickedOneSever

void FrontCoverLayer::onClickedOneSever(CCObject* pSender)
{
	CCMenuItem* menuItem = dynamic_cast<CCMenuItem*>(pSender);
	if(menuItem)
	{
		CCNode* node = menuItem->getParent();
		CCMenu* menu = dynamic_cast<CCMenu*>(node);
		if(menu)
		{
			CCNode* parent = menu->getParent();
			IconButton* button = dynamic_cast<IconButton*>(parent);
			if(button)
			{
				int buttonIndex = button->GetButtonIndex();
				// to do
				SeverInfo* info = m_severList[buttonIndex];
				if(info)
				{
					USERINFO data = UserData::GetUserInfo();
					sprintf(data.ip,"%s",info->severIp);
					sprintf(data.lastServerName,"%s",info->name);
					data.port = info->port;
					UserData::SetUserInfo(data);
					//onCLickedSeverCloseBt(pSender);
					XLogicManager::sharedManager()->logIn();
				}
			}
		}
	}
}
开发者ID:niuzb,项目名称:hellopetclient,代码行数:30,代码来源:FrontCoverLayer.cpp

示例8: LevelLauncher

 LevelLauncher(int l, Canvas* c)
 {
     Box *vbox1 = new VBox();
     vbox1->add( new Spacer(),  100, 1 );
     Box *hbox = new HBox();
     hbox->add( new Spacer(),  10, 2 );
     IconButton *icon = new IconButton("level", "", Event::NOP);
     icon->canvas(c, false);
     hbox->add( icon, 300, 0 );
     hbox->add( new Spacer(),  10, 1 );
     Box *vbox = new VBox();
     vbox->add( new Spacer(),  10, 1 );
     vbox->add( new IconButton("Review","",
                               Event(Event::REPLAY,l)),
                BUTTON_HEIGHT, 1 );
     vbox->add( new Spacer(),  10, 0 );
     vbox->add( new IconButton("Play","",
                               Event(Event::PLAY,l)),
                BUTTON_HEIGHT, 1 );
     vbox->add( new Spacer(),  10, 1 );
     hbox->add( vbox, BUTTON_WIDTH, 0 );
     hbox->add( new Spacer(),  10, 2 );
     vbox1->add(hbox, 200, 0);
     vbox1->add( new Spacer(),  100, 1 );
     content()->add(vbox1);
     sizeTo(Vec2(SCREEN_WIDTH,SCREEN_HEIGHT));
     moveTo(Vec2(0,0));
     m_targetPos = Vec2( 0,0 );
 }
开发者ID:smr99,项目名称:numptyphysics,代码行数:29,代码来源:Dialogs.cpp

示例9: dispatchTutorialMsg

	bool UIScrollPage::dispatchTutorialMsg(CCObject* pObject,unsigned int type)
	{
		UIMenu* menu = NULL;
		CCMenuItem* menuItem = dynamic_cast<CCMenuItem*>(pObject);
		if(menuItem)
		{
			CCNode* node = menuItem->getParent();
			menu = dynamic_cast<UIMenu*>(node);			
		}
		else
		{
			menu = dynamic_cast<UIMenu*>(pObject);
		}

		if(menu)
		{
			CCNode* parent = menu->getParent();
			IconButton* button = dynamic_cast<IconButton*>(parent);
			char name[50];
			sprintf(name,"%s_%d",this->m_strName.c_str(),button->GetButtonIndex());
			return TutorialsManager::Get()->HandleOneEvent(name,type);
		}

		return true;
	}
开发者ID:niuzb,项目名称:hellopet,代码行数:25,代码来源:UIScrollPage.cpp

示例10: MenuSetting

MenuSettingInt::MenuSettingInt(
		GMenu2X *gmenu2x, Touchscreen &ts,
		const string &name, const string &description,
		int *value, int min, int max, int increment)
	: MenuSetting(gmenu2x,name,description)
{
	IconButton *btn;

	_value = value;
	originalValue = *value;
	this->min = min;
	this->max = max;
	this->increment = increment;
	setValue(this->value());

	//Delegates
	ButtonAction actionInc = MakeDelegate(this, &MenuSettingInt::inc);
	ButtonAction actionDec = MakeDelegate(this, &MenuSettingInt::dec);

	btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/l.png");
	btn->setAction(actionDec);
	buttonBox.add(btn);

	btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/left.png", gmenu2x->tr["Decrease"]);
	btn->setAction(actionDec);
	buttonBox.add(btn);

	btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/r.png");
	btn->setAction(actionInc);
	buttonBox.add(btn);

	btn = new IconButton(gmenu2x, ts, "skin:imgs/buttons/right.png", gmenu2x->tr["Increase"]);
	btn->setAction(actionInc);
	buttonBox.add(btn);
}
开发者ID:anarsoul,项目名称:gmenu2x-zipit,代码行数:35,代码来源:menusettingint.cpp

示例11: onPressCityBtn

void CityListLayer::onPressCityBtn(CCObject* sender)
{
	if (playerMoving)
	{
		return;
	}

	CCMenuItem* menuItem = dynamic_cast<CCMenuItem*>(sender);
	if(menuItem)
	{
		CCNode* node = menuItem->getParent();
		CCMenu* menu = dynamic_cast<CCMenu*>(node);
		if(menu)
		{
			CCNode* parent = menu->getParent();
			IconButton* button = dynamic_cast<IconButton*>(parent);
			if(button)
			{
				playerMoving = true;
				int index = button->GetButtonIndex();	

				targetCityId = cityInfoList[index - 1].cityId;
				moveToCity(targetCityId, 0);
							
			}
		}
	}
}
开发者ID:niuzb,项目名称:hellopetclient,代码行数:28,代码来源:CityListLayer.cpp

示例12: makeButton

 Widget* makeButton( MenuItem* item, const Event& ev )
 {
     std::string file = item->text.substr(item->text.find(':')+1);
     std::string label = item->text.substr(0,item->text.find(':'));
     IconButton *w = new IconButton(label,file,ev);
     w->align(1);
     m_opts.push_back(w);
     return w;
 }
开发者ID:smr99,项目名称:numptyphysics,代码行数:9,代码来源:Dialogs.cpp

示例13: MenuSettingStringBase

MenuSettingFile::MenuSettingFile(GMenu2X *gmenu2x, const string &name, const string &description, string *value, const string &filter_, const string &startPath_)
	: MenuSettingStringBase(gmenu2x, name, description, value)
	, filter(filter_), startPath(startPath_)
{
	IconButton *btn;

	btn = new IconButton(gmenu2x, "uda://gmenu2x/skins/Default/imgs/buttons/x.png", gmenu2x->tr["Clear"]);
	btn->setAction(MakeDelegate(this, &MenuSettingFile::clear));
	buttonBox.add(btn);

	btn = new IconButton(gmenu2x, "uda://gmenu2x/skins/Default/imgs/buttons/b.png", gmenu2x->tr["Select a file"]);
	btn->setAction(MakeDelegate(this, &MenuSettingFile::edit));
	buttonBox.add(btn);
}
开发者ID:randprint,项目名称:gmenu-xenon,代码行数:14,代码来源:menusettingfile.cpp

示例14: MenuSettingStringBase

MenuSettingDir::MenuSettingDir(GMenu2X *gmenu2x, const string &name, const string &description, string *value, const std::string &startPath_)
	: MenuSettingStringBase(gmenu2x, name, description, value)
	, startPath(startPath_)
{
	IconButton *btn;

	btn = new IconButton(gmenu2x, "skin:imgs/buttons/x.png", gmenu2x->tr["Clear"]);
	btn->setAction(MakeDelegate(this, &MenuSettingDir::clear));
	buttonBox.add(btn);

	btn = new IconButton(gmenu2x, "skin:imgs/buttons/b.png", gmenu2x->tr["Select a directory"]);
	btn->setAction(MakeDelegate(this, &MenuSettingDir::edit));
	buttonBox.add(btn);
}
开发者ID:NeoTheFox,项目名称:gmenu2x,代码行数:14,代码来源:menusettingdir.cpp

示例15: ccpAdd

void CityListLayer::addCityBtn(int index)
{	
	//获得城市按钮位置
	stringstream nameStream;
	nameStream << "cityBtn" << index;
	string cityBtnName = nameStream.str();

	UIButton *btn = cityListLayout->FindChildObjectByName<UIButton>(cityBtnName);
	CCPoint cityPoint = btn->getPosition();

	//初始化各种位置信息
	CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
	cityInfoList[index - 1].cityPos = ccpAdd(ccp(visibleSize.width / 2, visibleSize.height / 2), cityPoint);
	cityInfoList[index - 1].playerPos = ccpAdd(cityInfoList[index - 1].cityPos, ccp(0, -25));
	cityInfoList[index - 1].namePos = ccpAdd(cityInfoList[index - 1].cityPos, ccp(0, -30));

	//获得城市图标资源
	CCPoint pt;
    ASprite * as = AspriteManager::getInstance()->getAsprite(KICON_BIN);

	stringstream resourceNameStream;
	resourceNameStream << "map_ui_system_icon_FRAME_ICON_CITY" << index;
	string cityResourceName = resourceNameStream.str();

	int cityResourceId = getResourceIDByName(cityResourceName.c_str());
    CCSprite* cityIcon = as->getSpriteFromFrame_Middle(cityResourceId, 0, pt);
	CCSprite* citySelectIcon = as->getSpriteFromFrame_Middle(cityResourceId, 0, pt);
	citySelectIcon->setScale(1.2f);

	//创建城市图标
	IconButton * cityBtn = new IconButton(cityIcon, NULL, citySelectIcon, this, 
					menu_selector(CityListLayer::onPressCityBtn));	
	
	cityBtn->setPosition(cityInfoList[index - 1].cityPos);
	cityBtn->SetButtonIndex(index);
	cityBtn->setAnchorPoint(ccp(0.5, 0.5));
	this->addChild(cityBtn);

	//创建城市名称label
	float fontSize = GameFontManager::smallFontSize();
	CCSize nameLabelSize = CCSizeMake(200 / CC_CONTENT_SCALE_FACTOR(), fontSize);
	
	string cityName = MainLandManager::Get()->getCityName(cityInfoList[index - 1].cityId);
	UILabelTTF * cityNameLabel = UILabelTTF::create(cityName.c_str(), KJLinXin, fontSize,
				nameLabelSize, kCCTextAlignmentCenter,kCCVerticalTextAlignmentBottom);
    
	cityNameLabel->setPosition(cityInfoList[index - 1].namePos);
	this->addChild(cityNameLabel);
}
开发者ID:niuzb,项目名称:hellopetclient,代码行数:49,代码来源:CityListLayer.cpp


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