Esempio n. 1
0
//更新右搜索(筛选)菜单
bool OnSearchRightMenuUpdate(const CEGUI::EventArgs& e)
{
    CEGUI::Combobox* cbbox = WComboBox(WEArgs(e).window);
    cbbox->clearAllSelections();
    cbbox->resetList();
    cbbox->getEditbox()->setText("");

    //由索引关联商城类型
    SCGData::eSCType eShopCityType = GetShopCityTypeByTabContentSelIndex();
    //由索引关联商店类型,tabControl的索引0单独对应热销商品
    SCGData::eSType shoptype = GetShopTypeByTabContentSelIndex();
    if(shoptype == SCGData::TABTYPE_HOT)//热销没有筛选项
        return true;
    //根据商城和商店类型获取筛选数据
    SCGData* dt = GetInst(ShopCityMsgMgr).GetShopCityGoodsData();
    SCGData::MapFLDTA& mapSel = dt->GetFilterList();
    SCGData::MapUFLDTPA& mapUSel = mapSel[eShopCityType];
    SCGData::MapStrFilDTPA& mapStrSel = mapUSel[shoptype];
    SCGData::MapStrFilDTPA::iterator iter = mapStrSel.begin();
    for( ; iter != mapStrSel.end() ; ++iter)
    {
        //初始化筛选菜单
        string str = (*iter).first;
        //CEGUI::ListboxItem* lbi = new CEGUI::ListboxTextItem(str.c_str());
        CEGUI::ListboxItem* lbi = new CEGUI::ListboxTextItem(ToCEGUIString(str.c_str()));
        lbi->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME);
        if(iter == mapStrSel.begin() )//默认让第一个为选中项
            lbi->setSelected(true);
        cbbox->addItem(lbi);
    }
    return true;
}
Esempio n. 2
0
//更新左搜索(导购)菜单
bool OnSearchLeftMenuUpdate(const CEGUI::EventArgs& e)
{
    CEGUI::Combobox* cbbox = WComboBox(WEArgs(e).window);
    cbbox->clearAllSelections();
    cbbox->resetList();
    cbbox->getEditbox()->setText("");
    //由索引关联商城类型
    SCGData::eSCType eCityType = GetShopCityTypeByTabContentSelIndex();
    SCGData* dt = GetInst(ShopCityMsgMgr).GetShopCityGoodsData();
    SCGData::MapGuideDataA& mapGuide = dt->GetGuideList();
    //根据索引获取导购数据
    SCGData::MapStrGGDTPA& mapGuideDTA = mapGuide[eCityType];
    CEGUI::Combobox* cbboxRight = WComboBox(GetWndMgr().getWindow(SHOPCITY_SEARCH_RIGHTWND_NAME));
    if(cbboxRight)
    {
        CEGUI::ListboxItem* lbi = cbboxRight->getSelectedItem();
        size_t idx = 0;
        if(lbi)
            idx = cbboxRight->getItemIndex(lbi);
        SCGData::MapStrGGDTPA::iterator iter = mapGuideDTA.begin();
        for(; iter != mapGuideDTA.end() ; ++iter)
        {
            //添加导购菜单
            string menuStr = iter->first;
            //CEGUI::ListboxItem* lbi = new CEGUI::ListboxTextItem(menuStr.c_str());
            CEGUI::ListboxItem* lbi = new CEGUI::ListboxTextItem(ToCEGUIString(menuStr.c_str()));
            lbi->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME);
            if(iter == mapGuideDTA.begin())//默认让第一个为选中
                lbi->setSelected(true);
            cbbox->addItem(lbi);
        }
    }
    return true;
}