本文整理汇总了C++中TextWidget::SetText方法的典型用法代码示例。如果您正苦于以下问题:C++ TextWidget::SetText方法的具体用法?C++ TextWidget::SetText怎么用?C++ TextWidget::SetText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextWidget
的用法示例。
在下文中一共展示了TextWidget::SetText方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateHelp
void UpdateHelp(unsigned index) {
if (!visible || item_help_callback == nullptr)
return;
help_widget->SetText(item_help_callback(index));
two_widgets->UpdateLayout();
}
示例2: CreateTextWidget
Resource* CreateTextWidget( XMLIterator i, XMLCreatorEnv *env )
{
XMLCreatorEnv ch_env;
XMLAttributes attributes;
XMLStyle branch_style;
CascadeStyles( i, env, attributes, branch_style, ch_env );
std::string font = get_attribute( attributes, "font" );
int bodyAsLink = 0;
try_attribute_i( attributes, "body_as_link", &bodyAsLink );
Text text;
if ( bodyAsLink )
text = QueryText( make_string( (*i)._value ));
else
text = MakeText(to_chars( (*i)._value ));
Widget *ptr;
XMLIterator ch_i = i;
int line_spacing = 0;
std::string alignment;
bool adv_text = try_attribute_i( attributes, "spacing", &line_spacing );
adv_text |= try_attribute( attributes, "align", &alignment );
// create DualText
if ( !!ch_i.StepInto() )
{
int shift = 2;
try_attribute_i( attributes, "shift", &shift );
std::wstring left, right;
for ( ; !!ch_i; ++ch_i )
{
if ( (*ch_i)._name == "left" )
left = to_chars( (*ch_i)._value );
else
if ( (*ch_i)._name == "right" )
right = to_chars( (*ch_i)._value );
}
int bodyAsLink = 0;
try_attribute_i( attributes, "body_as_link", &bodyAsLink );
Text leftT, rightT;
if ( bodyAsLink )
{
leftT = QueryText( make_string( left ));
rightT = QueryText( make_string( right ));
}
else
{
leftT = MakeText(left);
rightT = MakeText(right);
}
DualTextWidget *p_dual;
ptr = p_dual = new DualTextWidget( 100, QueryFont(font), leftT, rightT, shift );
std::string dotcode;
if ( try_attribute( attributes, "dot", &dotcode ) )
p_dual->SetDotCode( ( dotcode.size()>0 ? dotcode[0] : ' ' ) );
}
else
if ( adv_text )
{
int align = 0;
if ( alignment == "left" ) { align = 0; } else
if ( alignment == "right" ) { align = 1; } else
if ( alignment == "center" ) { align = 2; }
if ( (*i)._name == "activetext" )
{
ptr = new ActiveText( QueryFont(font), text, line_spacing, align );
}
else
{
ptr = new AdvTextWidget( QueryFont(font), text, line_spacing, align );
}
}
else
{
TextWidget *ptrTW = new TextWidget( QueryFont(font), text );
ptr = ptrTW;
ptrTW->SetText( text );
}
InsertChildWidget( ptr, attributes, env);
return new AnyResource<Widget*>( ptr );
}
示例3: OnMouseClick
//.........这里部分代码省略.........
}
}
break;
// MENUSAVEQUEST
case BUTTON_MENUEDITQUEST_SAVE: {
if(pWindowMenu)
for(size_t i = 0; i < pWindowMenu->m_pages.size(); i++) {
MenuPage * page = pWindowMenu->m_pages[i];
if(page->eMenuState == EDIT_QUEST_SAVE_CONFIRM) {
page->m_savegame = m_savegame;
TextWidget * me = (TextWidget *) page->m_children.m_widgets[1];
if(me) {
m_targetMenu = MAIN;
ARXMenu_SaveQuest(me->m_text, me->m_savegame);
break;
}
}
}
}
break;
// Delete save from the load menu
case BUTTON_MENUEDITQUEST_DELETE_CONFIRM: {
if(pWindowMenu) {
for(size_t i = 0 ; i < pWindowMenu->m_pages.size(); i++) {
MenuPage * page = pWindowMenu->m_pages[i];
if(page->eMenuState == EDIT_QUEST_LOAD) {
m_savegame = page->m_savegame;
if(m_savegame != SavegameHandle()) {
m_targetMenu = EDIT_QUEST_LOAD;
mainMenu->bReInitAll = true;
savegames.remove(m_savegame);
break;
}
}
}
}
pLoadConfirm->SetCheckOff();
pLoadConfirm->lColor = Color::grayb(127);
pDeleteConfirm->SetCheckOff();
pDeleteConfirm->lColor = Color::grayb(127);
break;
}
// Delete save from the save menu
case BUTTON_MENUEDITQUEST_DELETE: {
if(pWindowMenu) {
for(size_t i = 0 ; i < pWindowMenu->m_pages.size(); i++) {
MenuPage * page = pWindowMenu->m_pages[i];
if(page->eMenuState == EDIT_QUEST_SAVE_CONFIRM) {
page->m_savegame = m_savegame;
TextWidget * me = (TextWidget *) page->m_children.m_widgets[1];
if(me) {
m_targetMenu = EDIT_QUEST_SAVE;
mainMenu->bReInitAll = true;
savegames.remove(me->m_savegame);
break;
}
}
}
}
break;
}
default:
break;
}
if(m_targetMenu == EDIT_QUEST_SAVE_CONFIRM) {
for(size_t i = 0; i < pWindowMenu->m_pages.size(); i++) {
MenuPage * page = pWindowMenu->m_pages[i];
if(page->eMenuState == m_targetMenu) {
page->m_savegame = m_savegame;
TextWidget * me = (TextWidget *) page->m_children.m_widgets[1];
if(me) {
me->m_savegame = m_savegame;
if(m_savegame != SavegameHandle()) {
me->SetText(savegames[m_savegame.handleData()].name);
pDeleteButton->lColor = pDeleteButton->lOldColor;
pDeleteButton->SetCheckOn();
} else {
pDeleteButton->lColor = Color::grayb(127);
pDeleteButton->SetCheckOff();
me->SetText(getLocalised("system_menu_editquest_newsavegame"));
}
page->AlignElementCenter(me);
}
}
}
}
ARX_SOUND_PlayMenu(SND_MENU_CLICK);
return false;
}