当前位置: 首页>>代码示例>>C++>>正文


C++ ListboxTextItem::setID方法代码示例

本文整理汇总了C++中cegui::ListboxTextItem::setID方法的典型用法代码示例。如果您正苦于以下问题:C++ ListboxTextItem::setID方法的具体用法?C++ ListboxTextItem::setID怎么用?C++ ListboxTextItem::setID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cegui::ListboxTextItem的用法示例。


在下文中一共展示了ListboxTextItem::setID方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
        }
    }
}
开发者ID:,项目名称:,代码行数:37,代码来源:

示例2: ResetHairColorDateOnHairChanged

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);
        }
    }
}
开发者ID:,项目名称:,代码行数:18,代码来源:

示例3: ListDrives

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);
    }
}
开发者ID:trietptm,项目名称:Ocerus,代码行数:38,代码来源:FolderSelector.cpp

示例4: 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);
    }
}
开发者ID:,项目名称:,代码行数:64,代码来源:


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