本文整理汇总了C++中mygui::TextBox类的典型用法代码示例。如果您正苦于以下问题:C++ TextBox类的具体用法?C++ TextBox怎么用?C++ TextBox使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TextBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addGroup
void SpellWindow::addGroup(const std::string &label, const std::string& label2)
{
if (mSpellView->getChildCount() > 0)
{
MyGUI::ImageBox* separator = mSpellView->createWidget<MyGUI::ImageBox>("MW_HLine",
MyGUI::IntCoord(4, mHeight, mWidth-8, 18),
MyGUI::Align::Left | MyGUI::Align::Top);
separator->setNeedMouseFocus(false);
mHeight += 18;
}
MyGUI::TextBox* groupWidget = mSpellView->createWidget<MyGUI::TextBox>("SandBrightText",
MyGUI::IntCoord(0, mHeight, mWidth, 24),
MyGUI::Align::Left | MyGUI::Align::Top | MyGUI::Align::HStretch);
groupWidget->setCaptionWithReplacing(label);
groupWidget->setTextAlign(MyGUI::Align::Left);
groupWidget->setNeedMouseFocus(false);
if (label2 != "")
{
MyGUI::TextBox* groupWidget2 = mSpellView->createWidget<MyGUI::TextBox>("SandBrightText",
MyGUI::IntCoord(0, mHeight, mWidth-4, 24),
MyGUI::Align::Left | MyGUI::Align::Top);
groupWidget2->setCaptionWithReplacing(label2);
groupWidget2->setTextAlign(MyGUI::Align::Right);
groupWidget2->setNeedMouseFocus(false);
}
mHeight += 24;
}
示例2: setValue
void StatsWindow::setValue (const std::string& id, const MWMechanics::Stat<int>& value)
{
static const char *ids[] =
{
"AttribVal1", "AttribVal2", "AttribVal3", "AttribVal4", "AttribVal5",
"AttribVal6", "AttribVal7", "AttribVal8",
0
};
for (int i=0; ids[i]; ++i)
if (ids[i]==id)
{
std::ostringstream valueString;
valueString << value.getModified();
setText (id, valueString.str());
MyGUI::TextBox* box;
getWidget(box, id);
if (value.getModified()>value.getBase())
box->_setWidgetState("increased");
else if (value.getModified()<value.getBase())
box->_setWidgetState("decreased");
else
box->_setWidgetState("normal");
break;
}
}
示例3: addGroup
void SpellView::addGroup(const std::string &label, const std::string& label2)
{
if (mScrollView->getChildCount() > 0)
{
MyGUI::ImageBox* separator = mScrollView->createWidget<MyGUI::ImageBox>("MW_HLine",
MyGUI::IntCoord(0, 0, mScrollView->getWidth(), 18),
MyGUI::Align::Left | MyGUI::Align::Top);
separator->setNeedMouseFocus(false);
mLines.push_back(LineInfo(separator, (MyGUI::Widget*)NULL, NoSpellIndex));
}
MyGUI::TextBox* groupWidget = mScrollView->createWidget<MyGUI::TextBox>("SandBrightText",
MyGUI::IntCoord(0, 0, mScrollView->getWidth(), 24),
MyGUI::Align::Left | MyGUI::Align::Top);
groupWidget->setCaptionWithReplacing(label);
groupWidget->setTextAlign(MyGUI::Align::Left);
groupWidget->setNeedMouseFocus(false);
if (label2 != "")
{
MyGUI::TextBox* groupWidget2 = mScrollView->createWidget<MyGUI::TextBox>("SandBrightText",
MyGUI::IntCoord(0, 0, mScrollView->getWidth(), 24),
MyGUI::Align::Left | MyGUI::Align::Top);
groupWidget2->setCaptionWithReplacing(label2);
groupWidget2->setTextAlign(MyGUI::Align::Right);
groupWidget2->setNeedMouseFocus(false);
mLines.push_back(LineInfo(groupWidget, groupWidget2, NoSpellIndex));
}
else
mLines.push_back(LineInfo(groupWidget, (MyGUI::Widget*)NULL, NoSpellIndex));
}
示例4: layoutWidgets
void SpellView::layoutWidgets()
{
int height = 0;
for (std::vector< LineInfo >::iterator it = mLines.begin();
it != mLines.end(); ++it)
{
height += (it->mLeftWidget)->getHeight();
}
bool scrollVisible = height > mScrollView->getHeight();
int width = mScrollView->getWidth() - (scrollVisible ? 18 : 0);
height = 0;
for (std::vector< LineInfo >::iterator it = mLines.begin();
it != mLines.end(); ++it)
{
int lineHeight = (it->mLeftWidget)->getHeight();
(it->mLeftWidget)->setCoord(4, height, width - 8, lineHeight);
if (it->mRightWidget)
{
(it->mRightWidget)->setCoord(4, height, width - 8, lineHeight);
MyGUI::TextBox* second = (it->mRightWidget)->castType<MyGUI::TextBox>(false);
if (second)
(it->mLeftWidget)->setSize(width - 8 - second->getTextSize().width, lineHeight);
}
height += lineHeight;
}
// Canvas size must be expressed with VScroll disabled, otherwise MyGUI would expand the scroll area when the scrollbar is hidden
mScrollView->setVisibleVScroll(false);
mScrollView->setCanvasSize(mScrollView->getWidth(), std::max(mScrollView->getHeight(), height));
mScrollView->setVisibleVScroll(true);
}
示例5: RefreshNumbers
void CurveEditor::RefreshNumbers()
{
DeleteNumbersY();
auto size = mCurveCanvasWidget->getSize();
auto width = size.width;
auto height = size.height;
auto inteveralX = width / (gridNumX + 2);
auto inteveralY = height / (gridNumY + 2);
float step = (mValueRange.y - mValueRange.x) / gridNumY;
for (auto i = 0; i <= gridNumY; i += 2)
{
MyGUI::TextBox* text = mCurveCanvasWidget->createWidget<MyGUI::TextBox>("TextBox",
MyGUI::IntCoord(3, i * inteveralY + 5, 30, 15), MyGUI::Align::Default);
text->setFontHeight(14);
text->setTextShadow(true);
text->setTextShadowColour(MyGUI::Colour::Black);
DiString s;
s.Format("%.1f", step*(gridNumY - i) + mValueRange.x);
text->setCaption(s.c_str());
mNumbersY.push_back(text);
}
}
示例6: InitGrid
void CurveEditor::InitGrid()
{
auto size = mCurveCanvasWidget->getSize();
auto width = size.width;
auto height= size.height;
auto inteveralX = width / (gridNumX + 2);
auto inteveralY = height / (gridNumY + 2);
MyGUI::Colour dark(0.1f, 0.1f, 0.1f);
MyGUI::Colour light(0.2f, 0.2f, 0.2f);
std::vector<MyGUI::Colour> colors;
std::vector<MyGUI::FloatPoint> lines;
for (auto i = 1; i <= gridNumX+1; ++i)
{
lines.push_back(MyGUI::FloatPoint(i*inteveralX, 3));
lines.push_back(MyGUI::FloatPoint(i*inteveralX, height-4));
colors.push_back(i == 1 ? dark : light);
colors.push_back(i == 1 ? dark : light);
}
lines.push_back(MyGUI::FloatPoint(inteveralX - 1, 3));
lines.push_back(MyGUI::FloatPoint(inteveralX - 1, height - 4));
colors.push_back(dark);
colors.push_back(dark);
for (auto i = 1; i <= gridNumY + 1; ++i)
{
lines.push_back(MyGUI::FloatPoint(3, i*inteveralY));
lines.push_back(MyGUI::FloatPoint(width - 4, i*inteveralY));
colors.push_back(i == gridNumY + 1 ? dark : light);
colors.push_back(i == gridNumY + 1 ? dark : light);
}
lines.push_back(MyGUI::FloatPoint(3, (gridNumY + 1)*inteveralY + 1));
lines.push_back(MyGUI::FloatPoint(width - 4, (gridNumY + 1)*inteveralY + 1));
colors.push_back(dark);
colors.push_back(dark);
mCurveLines->setPoints(lines, true);
mCurveLines->setColors(colors);
for (auto i = 1; i <= gridNumX + 1; i += 2)
{
MyGUI::TextBox* text = mCurveCanvasWidget->createWidget<MyGUI::TextBox>("TextBox",
MyGUI::IntCoord(i * inteveralX + 2, height - 19, 30, 15), MyGUI::Align::Default);
text->setFontHeight(14);
text->setTextShadow(true);
text->setTextShadowColour(MyGUI::Colour::Black);
DiString s;
s.Format("%.1f", (i - 1) / (float)gridNumX);
text->setCaption(s.c_str());
mNumbersX.push_back(text);
}
}
示例7: onOpen
void LevelupDialog::onOpen()
{
MWBase::World *world = MWBase::Environment::get().getWorld();
MWWorld::Ptr player = world->getPlayerPtr();
MWMechanics::CreatureStats& creatureStats = player.getClass().getCreatureStats(player);
MWMechanics::NpcStats& pcStats = player.getClass().getNpcStats(player);
setClassImage(mClassImage, getLevelupClassImage(pcStats.getSkillIncreasesForSpecialization(0),
pcStats.getSkillIncreasesForSpecialization(1),
pcStats.getSkillIncreasesForSpecialization(2)));
int level = creatureStats.getLevel ()+1;
mLevelText->setCaptionWithReplacing("#{sLevelUpMenu1} " + MyGUI::utility::toString(level));
std::string levelupdescription;
levelupdescription=world->getFallback()->getFallbackString("Level_Up_Level"+MyGUI::utility::toString(level));
if (levelupdescription == "")
levelupdescription=world->getFallback()->getFallbackString("Level_Up_Default");
mLevelDescription->setCaption (levelupdescription);
unsigned int availableAttributes = 0;
for (int i = 0; i < 8; ++i)
{
MyGUI::TextBox* text = mAttributeMultipliers[i];
if (pcStats.getAttribute(i).getBase() < 100)
{
mAttributes[i]->setEnabled(true);
mAttributeValues[i]->setEnabled(true);
availableAttributes++;
int mult = pcStats.getLevelupAttributeMultiplier (i);
mult = std::min(mult, 100-pcStats.getAttribute(i).getBase());
text->setCaption(mult <= 1 ? "" : "x" + MyGUI::utility::toString(mult));
}
else
{
mAttributes[i]->setEnabled(false);
mAttributeValues[i]->setEnabled(false);
text->setCaption("");
}
}
mCoinCount = std::min(sMaxCoins, availableAttributes);
mSpentAttributes.clear();
resetCoins();
setAttributeValues();
center();
// Play LevelUp Music
MWBase::Environment::get().getSoundManager()->streamMusic("Special/MW_Triumph.mp3");
}
示例8: 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);
}
}
示例9: addGroup
void ReviewDialog::addGroup(const std::string &label, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2)
{
MyGUI::TextBox* groupWidget = mSkillView->createWidget<MyGUI::TextBox>("SandBrightText", MyGUI::IntCoord(0, coord1.top, coord1.width + coord2.width, coord1.height), MyGUI::Align::Default);
groupWidget->eventMouseWheel += MyGUI::newDelegate(this, &ReviewDialog::onMouseWheel);
groupWidget->setCaption(label);
mSkillWidgets.push_back(groupWidget);
coord1.top += sLineHeight;
coord2.top += sLineHeight;
}
示例10: open
void LevelupDialog::open()
{
MWBase::World *world = MWBase::Environment::get().getWorld();
MWWorld::Ptr player = world->getPlayerPtr();
MWMechanics::CreatureStats& creatureStats = player.getClass().getCreatureStats (player);
MWMechanics::NpcStats& pcStats = player.getClass().getNpcStats (player);
mSpentAttributes.clear();
resetCoins();
setAttributeValues();
const ESM::NPC *playerData = player.get<ESM::NPC>()->mBase;
// set class image
const ESM::Class *cls =
world->getStore().get<ESM::Class>().find(playerData->mClass);
// Vanilla uses thief.dds for custom classes. A player with a custom class
// doesn't have mId set, see mwworld/esmstore.hpp where it is initialised as
// "$dynamic0". This check should resolve bug #1260.
// Choosing Stealth specialization and Speed/Agility as attributes.
if(world->getStore().get<ESM::Class>().isDynamic(cls->mId))
{
MWWorld::SharedIterator<ESM::Class> it = world->getStore().get<ESM::Class>().begin();
for(; it != world->getStore().get<ESM::Class>().end(); it++)
{
if(it->mData.mIsPlayable && it->mData.mSpecialization == 2 && it->mData.mAttribute[0] == 4 && it->mData.mAttribute[1] == 3)
break;
}
mClassImage->setImageTexture ("textures\\levelup\\" + it->mId + ".dds");
}
else
mClassImage->setImageTexture ("textures\\levelup\\" + cls->mId + ".dds");
int level = creatureStats.getLevel ()+1;
mLevelText->setCaptionWithReplacing("#{sLevelUpMenu1} " + boost::lexical_cast<std::string>(level));
std::string levelupdescription;
if(level>20)
levelupdescription=world->getFallback()->getFallbackString("Level_Up_Default");
else
levelupdescription=world->getFallback()->getFallbackString("Level_Up_Level"+boost::lexical_cast<std::string>(level));
mLevelDescription->setCaption (levelupdescription);
for (int i=0; i<8; ++i)
{
MyGUI::TextBox* text = mAttributeMultipliers[i];
int mult = pcStats.getLevelupAttributeMultiplier (i);
text->setCaption(mult <= 1 ? "" : "x" + boost::lexical_cast<std::string>(mult));
}
center();
}
示例11: addGroup
void StatsWindow::addGroup(const std::string &label, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2)
{
MyGUI::TextBox* groupWidget = skillClientWidget->createWidget<MyGUI::TextBox>("SandBrightText",
MyGUI::IntCoord(0, coord1.top, coord1.width + coord2.width, coord1.height),
MyGUI::Align::Left | MyGUI::Align::Top | MyGUI::Align::HStretch);
groupWidget->setCaption(label);
groupWidget->eventMouseWheel += MyGUI::newDelegate(this, &StatsWindow::onMouseWheel);
skillWidgets.push_back(groupWidget);
coord1.top += lineHeight;
coord2.top += lineHeight;
}
示例12: updateSliderLabel
void SettingsWindow::updateSliderLabel(MyGUI::ScrollBar *scroller, const std::string& value)
{
std::string labelWidgetName = scroller->getUserString("SettingLabelWidget");
if (!labelWidgetName.empty())
{
MyGUI::TextBox* textBox;
getWidget(textBox, labelWidgetName);
std::string labelCaption = scroller->getUserString("SettingLabelCaption");
boost::algorithm::replace_all(labelCaption, "%s", value);
textBox->setCaptionWithReplacing(labelCaption);
}
}
示例13: addItem
void ReviewDialog::addItem(const std::string& text, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2)
{
MyGUI::TextBox* skillNameWidget;
skillNameWidget = mSkillView->createWidget<MyGUI::TextBox>("SandText", coord1 + MyGUI::IntSize(coord2.width, 0), MyGUI::Align::Default);
skillNameWidget->setCaption(text);
skillNameWidget->eventMouseWheel += MyGUI::newDelegate(this, &ReviewDialog::onMouseWheel);
mSkillWidgets.push_back(skillNameWidget);
coord1.top += sLineHeight;
coord2.top += sLineHeight;
}
示例14: addItem
MyGUI::Widget* StatsWindow::addItem(const std::string text, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2)
{
MyGUI::TextBox* skillNameWidget;
skillNameWidget = skillClientWidget->createWidget<MyGUI::TextBox>("SandText", coord1 + MyGUI::IntSize(coord2.width, 0), MyGUI::Align::Default);
skillNameWidget->setCaption(text);
skillNameWidget->eventMouseWheel += MyGUI::newDelegate(this, &StatsWindow::onMouseWheel);
skillWidgets.push_back(skillNameWidget);
coord1.top += lineHeight;
coord2.top += lineHeight;
return skillNameWidget;
}
示例15: changeMission
void GUIMissionWindow::changeMission( int index,MissionState state,std::string caption)
{
MyGUI::ImageBox* icon;
MyGUI::TextBox* text;
if(caption!="")
{
assignWidget(text,str(boost::format("Mission%1%Caption")%(index+1)));
if(caption!="clear")
{
text->setCaption(caption);
}
else
{
text->setCaption("");
}
}
assignWidget(icon,str(boost::format("Mission%1%Icon")%(index+1)));
switch (state)
{
case MS_New:
{
icon->setItemName("New");
break;
}
case MS_Complete:
{
icon->setItemName("Complete");
break;
}
case MS_Fail:
{
icon->setItemName("Fail");
break;
}
case MS_NULL:
{
icon->setItemName("");
break;
}
}
}