• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ mygui::Button类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: WindowModal

    BirthDialog::BirthDialog()
      : WindowModal("openmw_chargen_birth.layout")
    {
        // Centre dialog
        center();

        getWidget(mSpellArea, "SpellArea");

        getWidget(mBirthImage, "BirthsignImage");

        getWidget(mBirthList, "BirthsignList");
        mBirthList->setScrollVisible(true);
        mBirthList->eventListSelectAccept += MyGUI::newDelegate(this, &BirthDialog::onAccept);
        mBirthList->eventListChangePosition += MyGUI::newDelegate(this, &BirthDialog::onSelectBirth);

        MyGUI::Button* backButton;
        getWidget(backButton, "BackButton");
        backButton->eventMouseButtonClick += MyGUI::newDelegate(this, &BirthDialog::onBackClicked);

        MyGUI::Button* okButton;
        getWidget(okButton, "OKButton");
        okButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOK", ""));
        okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &BirthDialog::onOkClicked);

        updateBirths();
        updateSpells();
    }
开发者ID:Bodillium,项目名称:openmw,代码行数:27,代码来源:birth.cpp


示例2: notifyStateChanged

void SceneObjectPanel::notifyStateChanged(MyGUI::Widget* _sender)
{
	if(mPickableObj == nullptr) return;


	MyGUI::Button *btn = static_cast<MyGUI::Button*>(_sender);

	std::string btnName = btn->getName();
	btnName = btnName.substr(mPrefix.length(),btnName.length() - mPrefix.length());

	if(btnName == "RB_FIX_XAXIS")
	{
		*mIsXFixed = !(*mIsXFixed);
		btn->setStateSelected((*mIsXFixed));
	}
	else if(btnName == "RB_FIX_YAXIS")
	{
		*mIsYFixed = !(*mIsYFixed);
		btn->setStateSelected((*mIsYFixed));
	}
	else
	{
		*mIsZFixed = !(*mIsZFixed);
		btn->setStateSelected((*mIsZFixed));
 	}
}
开发者ID:dtbinh,项目名称:AncelApp,代码行数:26,代码来源:SceneObjectPanel.cpp


示例3: notifyRotationChange

void SceneObjectPanel::notifyRotationChange(MyGUI::Widget* _sender)
{
	if(mPickableObj == nullptr) return;

	MyGUI::Button* btn = static_cast<MyGUI::Button*>(_sender);
 
	//TODO: change compare to AnyData injected in the widget later
	std::string btnName = btn->getName();
	btnName = btnName.substr(mPrefix.length(),btnName.length() - mPrefix.length());

	if(btnName == "BT_ROTATE_Y_LEFT")
	{
 		*mRotateAngleY -= 1;
		std::string str = Ogre::StringConverter::toString(*mRotateAngleY);
		mEditBoxRotateY->setCaption(str);
 	}
 	else if(btnName == "BT_ROTATE_Y_RIGHT")
	{
 		*mRotateAngleY += 1;
		std::string str = Ogre::StringConverter::toString(*mRotateAngleY);
		mEditBoxRotateY->setCaption(str);
 	}
	
 	mPickableObj->applyOperation(1);

}
开发者ID:dtbinh,项目名称:AncelApp,代码行数:26,代码来源:SceneObjectPanel.cpp


示例4: addButtons

void GUIManager::addButtons(TiXmlNode* buttons_node, float* values, MyGUI::Window* w)
{
   for(TiXmlNode* button_node = buttons_node->FirstChild("button"); button_node; button_node = button_node->NextSibling())
   {  
      std::string name_text = GameManager::textFromChildNode(button_node, "name");
      std::string caption_text = GameManager::textFromChildNode(button_node, "caption");
      std::string skin_text = GameManager::textFromChildNode(button_node, "skin");
      std::string position_text = GameManager::textFromChildNode(button_node, "position");
      GameManager::parseFloats(position_text, values);
      uint32 left = (uint32) values[0];
      uint32 top = (uint32) values[1];
      std::string size_text = GameManager::textFromChildNode(button_node, "size");
      GameManager::parseFloats(size_text, values);
      uint32 width = (uint32) values[0];
      uint32 height = (uint32) values[1];

      std::string file_name_text = GameManager::textFromChildNode(button_node, "file_name");
      std::string script_name_text = GameManager::textFromChildNode(button_node, "script_name");

      std::string font_size_text = GameManager::textFromChildNode(button_node, "font");
      uint32 font_size = (uint32) GameManager::parseFloat(font_size_text);

      MyGUI::Button* b = w->createWidget<MyGUI::Button>(skin_text, left, top, width, height, MyGUI::Align::Default, name_text);
      b->setCaption(caption_text);
      b->setFontHeight(font_size);
      b->setTextColour(MyGUI::Colour(0,0,0));
      b->eventMouseButtonPressed += newDelegate(this, &GUIManager::buttonGUIDelegate);

      GUIWidgetScript* widget_script = new GUIWidgetScript(b, name_text);
      widget_script->setFileName(file_name_text);
      widget_script->setScriptName(script_name_text);

      all_widgets->tableInsert(widget_script);
   }
}
开发者ID:hmkey,项目名称:Game_3,代码行数:35,代码来源:GUIManager.cpp


示例5: add

/*向界面中加入数据相
*/
void SimpleDataUI::add( const MyGUI::UString& caption,SimpleData sd ){

	MyGUI::TextBox* pt = mParent->createWidget<MyGUI::TextBox>(
		"TextBox",MyGUI::IntCoord(),
		MyGUI::Align::Left|MyGUI::Align::Top);
	
	pt->setTextAlign( MyGUI::Align::Right );
	pt->setCaption( caption );
	pt->setUserData( MyGUI::Any(string("@")) ); //打一个标记为删除做准备

	if( sd.type==SimpleData::BOOL ){
		MyGUI::Button* pe = mParent->createWidget<MyGUI::Button>(
		"CheckBox",MyGUI::IntCoord(),
		MyGUI::Align::Left|MyGUI::Align::Top);
		pe->setStateSelected(sd.b);
		sd.change = mep;
		pe->setUserData(MyGUI::Any(sd));
		pe->eventMouseButtonClick += newDelegate(_simpleDataCheckChange);
	}else if( sd.sv.empty() ){//编辑
		MyGUI::EditBox* pe = mParent->createWidget<MyGUI::EditBox>(
		"EditBox",MyGUI::IntCoord(),
		MyGUI::Align::Left|MyGUI::Align::Top);
		if( sd.type== SimpleData::STRING )
			pe->setCaption( sd.str );
		else if( sd.type== SimpleData::REAL)
		{
			pe->setCaption( (boost::format("%.2f")%sd.real).str() );
		}

		sd.change = mep;
		pe->setUserData(MyGUI::Any(sd));
		//数据改变
		pe->eventEditTextChange += newDelegate(_simpleDataEditTextChange);
	}else{//有可选数据
		MyGUI::ComboBox* pc = mParent->createWidget<MyGUI::ComboBox>(
		"ComboBox",MyGUI::IntCoord(),
		MyGUI::Align::Left|MyGUI::Align::Top);
		if( sd.type== SimpleData::STRING )
			pc->setCaption( sd.str );
		else if( sd.type== SimpleData::REAL )
			pc->setCaption( boost::lexical_cast<string>(sd.real) );
		for( vector<MyGUI::UString>::const_iterator i = sd.sv.begin();
			i!=sd.sv.end();++i){
			pc->addItem(*i);
			if( *i == sd.str ){
				if( sd.type== SimpleData::STRING )
					pc->setEditStatic(true);
				pc->setIndexSelected(i-sd.sv.begin());
			}
		}

		sd.change = mep;
		pc->setUserData(MyGUI::Any(sd));
		//数据改变
		pc->eventComboChangePosition += newDelegate(_simpleDataChange);
	}
}
开发者ID:JohnCrash,项目名称:iRobot,代码行数:59,代码来源:SimpleUI.cpp


示例6:

void RigEditorCommands2Panel::CallbackClick_NeedsEngineChekckbox(MyGUI::Widget* sender)
{
	// Clear "mixed values" state
	m_needs_engine_checkbox->setTextColour(m_text_color_default);
	m_data.SetNeedsEngineIsUniform(true);

	// Update data
	MyGUI::Button* button = sender->castType<MyGUI::Button>();
	m_data.SetBoolNeedsEngine(button->getStateSelected());
}
开发者ID:uvbs,项目名称:rigs-of-rods,代码行数:10,代码来源:GUI_RigEditorCommands2Panel.cpp


示例7: checkItem

void SimpleUI::checkItem( const string& name,bool b )
{
	try{
		MyGUI::Button * c = operator [](name)->castType<MyGUI::Button>(false);
		if( c )
			c->setStateSelected( b );
	}catch( out_of_range& e ){
		WARNING_LOG(e.what());
	}
}
开发者ID:JohnCrash,项目名称:iRobot,代码行数:10,代码来源:SimpleUI.cpp


示例8: setNextButtonShow

    void TextInputDialog::setNextButtonShow(bool shown)
    {
        MyGUI::Button* okButton;
        getWidget(okButton, "OKButton");

        if (shown)
            okButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sNext", ""));
        else
            okButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOK", ""));
    }
开发者ID:0xmono,项目名称:openmw,代码行数:10,代码来源:textinput.cpp


示例9: notifyCreateWidgetItem

	void ListBox::notifyCreateWidgetItem(MyGUI::ListCtrl* _sender, MyGUI::Widget* _item)
	{
		const MyGUI::IntSize& size = _item->getSize();

		MyGUI::Button* text = _item->createWidget<MyGUI::Button>(mSkinLine, MyGUI::IntCoord(0, 0, size.width, size.height), MyGUI::Align::Stretch);

		text->setNeedMouseFocus(false);

		_item->setUserData(text);
	}
开发者ID:OndraK,项目名称:openmw,代码行数:10,代码来源:MyGUI_ListBox.cpp


示例10: simpleDataChange

//数据发生改变
void Game::simpleDataChange(SimpleData* psd){
	assert( psd );
	try{
		mNeedReset = true;
		MyGUI::Button* pb = mUI["Apply"]->castType<MyGUI::Button>(false);
		if( pb )pb->setStateSelected(true);
	}catch(  out_of_range& e ){
		WARNING_LOG(e.what());
	}
}
开发者ID:JohnCrash,项目名称:iRobot,代码行数:11,代码来源:Game.cpp


示例11: requestDrawItem

	void WidgetsWindow::requestDrawItem(MyGUI::ItemBox* _sender, MyGUI::Widget* _item, const MyGUI::IBDrawItemInfo& _info)
	{
		MyGUI::Button* button = *_item->getUserData<MyGUI::Button*>();
		SkinInfo data = *_sender->getItemDataAt<SkinInfo>(_info.index);
		if (_info.update)
		{
			button->setCaption(data.widget_button_name);
		}

		button->setStateSelected(_info.select);
	}
开发者ID:Anomalous-Software,项目名称:mygui,代码行数:11,代码来源:WidgetsWindow.cpp


示例12: requestCreateObjectItem

	void ToolControl::requestCreateObjectItem(MyGUI::ItemBox* _sender, MyGUI::Widget* _item)
	{
		MyGUI::Button* button = _item->createWidget<MyGUI::Button>("Button", MyGUI::IntCoord(0, 0, _item->getWidth(), _item->getHeight()), MyGUI::Align::Stretch);

		button->setTextAlign(MyGUI::Align::Center);
		button->eventMouseButtonClick += MyGUI::newDelegate(this, &ToolControl::notifySelectObjectType);
		//button->setNeedToolTip(true);
		//button->eventToolTip += MyGUI::newDelegate(this, &ToolControl::notifyToolTip);

		_item->setUserData(button);
	}
开发者ID:ak4hige,项目名称:myway3d,代码行数:11,代码来源:MainWorkSpace.cpp


示例13: buildBoolControl

    /////////////////// <BOOL CONTROL>
    void PropertyGridManager::buildBoolControl(MyGUI::Widget *const control, PropertyGridProperty *const property)
    {
        int left = insertPropertyIdLabel(control, property) + WIDGET_SPACING;

        int size = control->getClientCoord().height;
        MyGUI::IntCoord coord(left, 0, size, size);
        MyGUI::Button *checkbox = (MyGUI::Button *)control->createWidget<MyGUI::Button>("CheckBox", coord, MyGUI::Align::Left | MyGUI::Align::VCenter, "CheckBox");
        checkbox->setEnabled(!property->isReadOnly());

        checkbox->setUserData(property);
        checkbox->eventMouseButtonClick += MyGUI::newDelegate(this, &PropertyGridManager::onMyGUIMouseButtonClickForCheckboxToggle);
    }
开发者ID:onze,项目名称:Steel,代码行数:13,代码来源:PropertyGridManager.cpp


示例14: requestDrawItem

	void ToolControl::requestDrawItem(MyGUI::ItemBox* _sender, MyGUI::Widget* _item, const MyGUI::IBDrawItemInfo& _info)
	{
		MyGUI::Button* button = *_item->getUserData<MyGUI::Button*>();
		ShapeFactory * sf = *_sender->getItemDataAt<ShapeFactory*>(_info.index);

		if (_info.update)
		{
			button->setCaption(sf->GetTypeName());
		}

		//button->setStateSelected(_info.select);
	}
开发者ID:ak4hige,项目名称:myway3d,代码行数:12,代码来源:MainWorkSpace.cpp


示例15: updateBoolControlValue

    void PropertyGridManager::updateBoolControlValue(MyGUI::Widget *const control, PropertyGridProperty *const property)
    {
        MyGUI::Button *checkbox = (MyGUI::Button *)control->findWidget("CheckBox");

        if(nullptr == checkbox)
        {
            Debug::error(STEEL_METH_INTRO, "could not find checkbox button in bool propertyControl. Control: ", control, " property: ", *property, ". Aborting.").endl();
            return;
        }

        bool checked = false;
        property->read(checked);
        checkbox->setStateSelected(checked);
    }
开发者ID:onze,项目名称:Steel,代码行数:14,代码来源:PropertyGridManager.cpp


示例16: addSpell

    void SpellBuyingWindow::addSpell(const std::string& spellId)
    {
        const MWWorld::ESMStore &store =
            MWBase::Environment::get().getWorld()->getStore();

        const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find(spellId);
        int price = spell->mData.mCost*store.get<ESM::GameSetting>().find("fSpellValueMult")->getFloat();
        price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr,price,true);

        MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
        int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);

        MyGUI::Button* toAdd =
            mSpellsView->createWidget<MyGUI::Button>(
                "SandTextButton",
                0,
                mCurrentY,
                200,
                sLineHeight,
                MyGUI::Align::Default
            );
        toAdd->setEnabled(price<=playerGold);

        mCurrentY += sLineHeight;

        toAdd->setUserData(price);
        toAdd->setCaptionWithReplacing(spell->mName+"   -   "+boost::lexical_cast<std::string>(price)+"#{sgp}");
        toAdd->setSize(toAdd->getTextSize().width,sLineHeight);
        toAdd->eventMouseWheel += MyGUI::newDelegate(this, &SpellBuyingWindow::onMouseWheel);
        toAdd->setUserString("ToolTipType", "Spell");
        toAdd->setUserString("Spell", spellId);
        toAdd->eventMouseButtonClick += MyGUI::newDelegate(this, &SpellBuyingWindow::onSpellButtonClick);
        mSpellsWidgetMap.insert(std::make_pair (toAdd, spellId));
    }
开发者ID:Aozi,项目名称:openmw,代码行数:34,代码来源:spellbuyingwindow.cpp


示例17: _simpleDataCheckChange

/*BOOL型数据改变 Check
*/
static void _simpleDataCheckChange(MyGUI::Widget* _sender){
	MyGUI::Button* sender = _sender->castType<MyGUI::Button>(false);
	if( sender ){
		SimpleData* psd = sender->getUserData<SimpleData>(false);
		sender->setStateSelected(!sender->getStateSelected());
		if( psd ){
			if( psd->type==SimpleData::BOOL ){
				psd->b = sender->getStateSelected();
			}
			if( psd->change )
				psd->change->invoke(psd);
		}
	}
}
开发者ID:JohnCrash,项目名称:iRobot,代码行数:16,代码来源:SimpleUI.cpp


示例18: addDestination

    void TravelWindow::addDestination(const std::string& name, ESM::Position pos, bool interior)
    {
        int price;

        const MWWorld::Store<ESM::GameSetting> &gmst =
            MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();

        MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr();
        int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);

        if (!mPtr.getCell()->isExterior())
        {
            price = gmst.find("fMagesGuildTravel")->mValue.getInteger();
        }
        else
        {
            ESM::Position PlayerPos = player.getRefData().getPosition();
            float d = sqrt(pow(pos.pos[0] - PlayerPos.pos[0], 2) + pow(pos.pos[1] - PlayerPos.pos[1], 2) + pow(pos.pos[2] - PlayerPos.pos[2], 2));
            price = static_cast<int>(d / gmst.find("fTravelMult")->mValue.getFloat());
        }

        price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr, price, true);

        // Add price for the travelling followers
        std::set<MWWorld::Ptr> followers;
        MWWorld::ActionTeleport::getFollowersToTeleport(player, followers);

        // Apply followers cost, in vanilla one follower travels for free
        if (Settings::Manager::getBool("charge for every follower travelling", "Game"))
            price *= 1 + static_cast<int>(followers.size());
        else
            price *= std::max(1, static_cast<int>(followers.size()));

        int lineHeight = MWBase::Environment::get().getWindowManager()->getFontHeight() + 2;

        MyGUI::Button* toAdd = mDestinationsView->createWidget<MyGUI::Button>("SandTextButton", 0, mCurrentY, 200, lineHeight, MyGUI::Align::Default);
        toAdd->setEnabled(price <= playerGold);
        mCurrentY += lineHeight;
        if(interior)
            toAdd->setUserString("interior","y");
        else
            toAdd->setUserString("interior","n");

        std::ostringstream oss;
        oss << price;
        toAdd->setUserString("price",oss.str());

        toAdd->setCaptionWithReplacing("#{sCell=" + name + "}   -   " + MyGUI::utility::toString(price)+"#{sgp}");
        toAdd->setSize(mDestinationsView->getWidth(),lineHeight);
        toAdd->eventMouseWheel += MyGUI::newDelegate(this, &TravelWindow::onMouseWheel);
        toAdd->setUserString("Destination", name);
        toAdd->setUserData(pos);
        toAdd->eventMouseButtonClick += MyGUI::newDelegate(this, &TravelWindow::onTravelButtonClick);
    }
开发者ID:devnexen,项目名称:openmw,代码行数:54,代码来源:travelwindow.cpp


示例19: notifyScaleChange

void SceneObjectPanel::notifyScaleChange(MyGUI::Widget* _sender)
{
	if(mPickableObj == nullptr) return; 

	MyGUI::Button* btn = static_cast<MyGUI::Button*>(_sender);
 
	//TODO: change compare to AnyData injected in the widget later
	std::string btnName = btn->getName();
	btnName = btnName.substr(mPrefix.length(),btnName.length() - mPrefix.length());

	if(btnName  ==  "BT_SCALE_X_RIGHT")
	{
		mScale->x += 1;
		std::string str = Ogre::StringConverter::toString(mScale->x);
		mEditBoxScaleX->setCaption(str);
 	}
	else if(btnName == "BT_SCALE_X_LEFT")
	{
 		mScale->x -= 1;
		std::string str = Ogre::StringConverter::toString(mScale->x);
		mEditBoxScaleX->setCaption(str);
 	}
 	else if(btnName == "BT_SCALE_Y_LEFT")
	{
 		mScale->y -= 1;
		std::string str = Ogre::StringConverter::toString(mScale->y);
		mEditBoxScaleY->setCaption(str);
 	}
 	else if(btnName == "BT_SCALE_Y_RIGHT")
	{
 		mScale->y += 1;
		std::string str = Ogre::StringConverter::toString(mScale->y);
		mEditBoxScaleY->setCaption(str);
 	}
 	else if(btnName == "BT_SCALE_Z_LEFT")
	{
 		mScale->z -= 1;
		std::string str = Ogre::StringConverter::toString(mScale->z);
		mEditBoxScaleZ->setCaption(str);
 	}
 	else if(btnName == "BT_SCALE_Z_RIGHT")
	{
 		mScale->z += 1;
		std::string str = Ogre::StringConverter::toString(mScale->z);
		mEditBoxScaleZ->setCaption(str);
 	}
	mPickableObj->applyOperation(0); 
}
开发者ID:dtbinh,项目名称:AncelApp,代码行数:48,代码来源:SceneObjectPanel.cpp


示例20: requestCreateWidgetItem

	void WidgetsWindow::requestCreateWidgetItem(MyGUI::ItemBox* _sender, MyGUI::Widget* _item)
	{
		MyGUI::Button* button = _item->createWidget<MyGUI::Button>(mButtonSkinName, MyGUI::IntCoord(
			mWidgetsButtonOffset,
			mWidgetsButtonOffset,
			_item->getWidth() - mWidgetsButtonOffset - mWidgetsButtonOffset,
			_item->getHeight() - mWidgetsButtonOffset - mWidgetsButtonOffset),
			MyGUI::Align::Stretch);

		button->setTextAlign(MyGUI::Align::Center);
		button->eventMouseButtonClick += MyGUI::newDelegate(this, &WidgetsWindow::notifySelectWidgetType);
		button->setNeedToolTip(true);
		button->eventToolTip += MyGUI::newDelegate(this, &WidgetsWindow::notifyToolTip);

		_item->setUserData(button);
	}
开发者ID:Anomalous-Software,项目名称:mygui,代码行数:16,代码来源:WidgetsWindow.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ mygui::ButtonPtr类代码示例发布时间:2022-05-31
下一篇:
C++ mwworld::Ptr类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap