本文整理汇总了C++中cegui::ListboxTextItem::setSelected方法的典型用法代码示例。如果您正苦于以下问题:C++ ListboxTextItem::setSelected方法的具体用法?C++ ListboxTextItem::setSelected怎么用?C++ ListboxTextItem::setSelected使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cegui::ListboxTextItem
的用法示例。
在下文中一共展示了ListboxTextItem::setSelected方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ResetDataBySexSelChanged
void ResetDataBySexSelChanged()
{
CEGUI::WindowManager& mgr = GetWndMgr();
CEGUI::Combobox* SelFac = WComboBox(mgr.getWindow(CREATEROLE_SEL_FAC_CCB));
uint SelSex = (uint)CREvent::GetSelectSex();
if(SelFac)
{
SelFac->resetList();
//更改性别后,修改默认Face和HairStyle时,对应修改文本显示
SelFac->getEditbox()->setText(CEGUI::PropertyHelper::intToString(0));
for(short i = 0 ; i < CREvent::GetFaceNum(SelSex) ; ++i)
{
CEGUI::ListboxTextItem* lti = new CEGUI::ListboxTextItem(CEGUI::PropertyHelper::intToString(i));
lti->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME);
lti->setID(i);//ID和FacIndex关联
if(0==i) //更改性别后,修改默认Face和HairStyle时,对应修改ItemList选中状态
lti->setSelected(true);
SelFac->addItem(lti);
}
}
CEGUI::Combobox* SelHair = WComboBox(mgr.getWindow(CREATEROLE_SEL_HAIR_CCB));
if(SelHair)
{
SelHair->resetList();
//更改性别后,修改默认Face和HairStyle时,对应修改文本显示
SelHair->getEditbox()->setText(CEGUI::PropertyHelper::intToString(0));
for(short i = 0 ; i < CREvent::GetHairNum(SelSex) ; ++i)
{
CEGUI::ListboxTextItem* lti = new CEGUI::ListboxTextItem(CEGUI::PropertyHelper::intToString(i));
lti->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME);
lti->setID(i);// ID和HairIndex关联
if(0 == i)//更改性别后,修改默认Face和HairStyle时,对应修改ItemList选中状态
lti->setSelected(true);
SelHair->addItem(lti);
}
}
}
示例2: SetCreateRoleInitProperty
void SetCreateRoleInitProperty(CEGUI::Window* pgWnd)
{
if(!pgWnd)
return;
CEGUI::Combobox* SelCountry = WComboBox(pgWnd->getChildRecursive(CREATEROLE_SEL_COUNTRY_CCB));
if(SelCountry)
{
SelCountry->subscribeEvent(CEGUI::Combobox::EventListSelectionAccepted,CEGUI::SubscriberSlot(OnCountryChanged));
SelCountry->setReadOnly(true);
CCountryList::MapCountryList* mapCL = CCountryList::GetCountryList();
for(uint cnt = 0; cnt < mapCL->size(); ++cnt)
{
const char* ctName = CCountryList::GetCountryName((BYTE)cnt+1);
if(ctName)
{
CEGUI::ListboxTextItem* lti = new CEGUI::ListboxTextItem(ToCEGUIString(ctName));
lti->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME);
lti->setID(cnt+1);//ID和国家ID关联
if(cnt == 0)
lti->setSelected(true);//设置国家默认值
SelCountry->addItem(lti);
}
}
//根据国家默认值,设置显示文本
SelCountry->getEditbox()->setText(ToCEGUIString(CCountryList::GetCountryName(0+1)));//加一是因为data/CountryList.xml配置造成
/***********************************************************************/
/* zhaohang fix 2010-9-3
/***********************************************************************/
CREvent::SetSelectCountry(1);//逻辑上的国家默认值
}
CEGUI::Combobox* selHair = WComboBox(pgWnd->getChildRecursive(CREATEROLE_SEL_HAIR_CCB));
if(selHair)
{
selHair->subscribeEvent(CEGUI::Combobox::EventListSelectionAccepted,CEGUI::SubscriberSlot(OnHairChanged));
selHair->setReadOnly(true);
}
CEGUI::Combobox* selHairColor = WComboBox(pgWnd->getChildRecursive(CREATEROLE_SEL_HAIRCOLOR_CCB));
if(selHairColor)
{
selHairColor->subscribeEvent(CEGUI::Combobox::EventListSelectionAccepted,CEGUI::SubscriberSlot(OnHairColorChanged));
selHairColor->setReadOnly(true);
}
CEGUI::Combobox* selFac = WComboBox(pgWnd->getChildRecursive(CREATEROLE_SEL_FAC_CCB));
if(selFac)
{
selFac->subscribeEvent(CEGUI::Combobox::EventListSelectionAccepted,CEGUI::SubscriberSlot(OnFacChanged));
selFac->setReadOnly(true);
}
CEGUI::Combobox* selSex = WComboBox(pgWnd->getChildRecursive(CREATEROLE_SEL_SEX_CCB));
if(selSex)
{
CEGUI::ListboxTextItem* itm1 = new CEGUI::ListboxTextItem(ToCEGUIString(CREATEROLE_SEX_MALE));
itm1->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME);
itm1->setID(0);//用ID和性别关联
selSex->addItem(itm1);
CEGUI::ListboxTextItem* itm2 = new CEGUI::ListboxTextItem(ToCEGUIString(CREATEROLE_SEX_FAMALE));
itm2->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME);
itm2->setID(1);//用ID和性别关联
selSex->addItem(itm2);
//注册事件
selSex->subscribeEvent(CEGUI::Combobox::EventListSelectionAccepted,CEGUI::SubscriberSlot(OnSexChanged));
selSex->setReadOnly(true);
}
}