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); } } }
void ResetHairColorDateOnHairChanged() { CEGUI::WindowManager& mgr = GetWndMgr(); CEGUI::Combobox* hairColor = WComboBox(mgr.getWindow(CREATEROLE_SEL_HAIRCOLOR_CCB)); if(hairColor) { hairColor->resetList(); //清空发色类型文本 hairColor->getEditbox()->setText(""); for(short i = 0 ; i < CREvent::GetHairColorNum(CREvent::GetSelectSex(),(WORD)CREvent::GetHair()) ; ++i) { CEGUI::ListboxTextItem* lti = new CEGUI::ListboxTextItem(CEGUI::PropertyHelper::intToString(i)); lti->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME); lti->setID(i);//ID和HairColorIndex关联 hairColor->addItem(lti); } } }
void GUISystem::FolderSelector::UpdateFolderList() { if (!mCurrentPath.empty() && !boost::filesystem::is_directory(mCurrentPath)) { ocWarning << "Current path '" << mCurrentPath << "' is an incorrect directory; using current directory"; mCurrentPath = boost::filesystem::current_path<boost::filesystem::path>().directory_string(); } if (!boost::istarts_with(mCurrentPath, mRootPath)) { mCurrentPath = mRootPath; } mFolders.clear(); if (mCurrentPath.empty()) { // if the path is empty it means we're listing drives ListDrives(mFolders); } else { ListDirectoryContent(mCurrentPath, mFolders); } Containers::sort(mFolders.begin(), mFolders.end()); if (IsStringValid(mCurrentPath)) mPathBox->setText(utf8StringToCEGUI(GetRelativePath(mCurrentPath))); else mPathBox->setText("!INVALID-PATH!"); mFolderList->resetList(); for (vector<string>::iterator it = mFolders.begin(); it != mFolders.end(); ++it) { CEGUI::ListboxTextItem* item = new CEGUI::ListboxTextItem(utf8StringToCEGUI(*it)); item->setSelectionBrushImage("Vanilla-Images", "GenericBrush"); item->setID(it - mFolders.begin()); mFolderList->addItem(item); } }
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); } }