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


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

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


在下文中一共展示了ListboxTextItem::setText方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: addToLog

void CSimulatorWindowHandler::addToLog(const std::string &text)
{
    unsigned int historySize = 7;
    unsigned int shortHistorySize = 3;
    std::ostringstream message;
    // If there's text then add it
    if(text.size()) {
        message << m_simulator->getReferee()->getMinute() << "' - " << text.c_str();
        // Add the Editbox text to the history Listbox
        CEGUI::ListboxTextItem* logItem;
        if(m_logHistoryList->getItemCount() == historySize) {
            /* We have reached the capacity of the Listbox so re-use the first Listbox item.
               This code is a little crafty.  By default the ListboxTextItem is created with
               the auto-delete flag set to true, which results in its automatic deletion when
               removed from the Listbox.  So we change that flag to false, extract the item
               from the Listbox, change its text, put the auto-delete flag back to true, and
               finally put the item back into the Listbox. */
            logItem = static_cast<CEGUI::ListboxTextItem*>(m_logHistoryList->getListboxItemFromIndex(0));
            logItem->setAutoDeleted(false);
            m_logHistoryList->removeItem(logItem);
            logItem->setAutoDeleted(true);
            logItem->setText((CEGUI::utf8*)message.str().c_str());
        } else {
            // Create a new listbox item
            logItem = new CEGUI::ListboxTextItem((CEGUI::utf8*)message.str().c_str());
        }
        m_logHistoryList->addItem(logItem);
        m_logHistoryList->ensureItemIsVisible(m_logHistoryList->getItemCount());

        if(m_logHistoryListShort->getItemCount() == shortHistorySize) {
            logItem = static_cast<CEGUI::ListboxTextItem*>(m_logHistoryListShort->getListboxItemFromIndex(0));
            logItem->setAutoDeleted(false);
            m_logHistoryListShort->removeItem(logItem);
            logItem->setAutoDeleted(true);
            logItem->setText((CEGUI::utf8*)message.str().c_str());
        } else {
            logItem = new CEGUI::ListboxTextItem((CEGUI::utf8*)message.str().c_str());
        }
        m_logHistoryListShort->addItem(logItem);
        m_logHistoryListShort->ensureItemIsVisible(m_logHistoryListShort->getItemCount());
    }
}
开发者ID:dividio,项目名称:projectfootball,代码行数:42,代码来源:CSimulatorWindowHandler.cpp

示例2: print

void GameLog::print(const std::string& msg)
{
	CEGUI::ListboxTextItem* text;
	if(log_->getItemCount() >= log_history_)
	{
		text = (CEGUI::ListboxTextItem*)log_->getListboxItemFromIndex(0);
		text->setAutoDeleted(false);
		log_->removeItem(text);
		text->setAutoDeleted(true);
		text->setText(msg);
	}
	else
		text = new CEGUI::ListboxTextItem(msg);
	text->setTextColours(CEGUI::Colour{0.f, 1.f, 0.f});
	log_->addItem(text);
	//log_->getVertScrollbar()->scrollForwardsByStep();
	log_->getVertScrollbar()->setScrollPosition(log_->getVertScrollbar()->getDocumentSize());
}
开发者ID:halbich,项目名称:DK,代码行数:18,代码来源:GameLog.cpp

示例3: updateServer

void ServerList::updateServer(Server *s)
{
    size_t rows = m_listeServeurs->getRowCount();
    int row = -1;
    for(size_t i=0;i<rows;++i)
    {
        if(m_listeServeurs->getItemAtGridReference(CEGUI::MCLGridRef(i, 0))->getUserData() == s)
        {
            row = i;
            break;
        }
    }
    if(row != -1)
    {
        CEGUI::ListboxTextItem *item;
        item = (CEGUI::ListboxTextItem*)m_listeServeurs->getItemAtGridReference(CEGUI::MCLGridRef(row, 0));
        item->setText(s->nom);

        item = (CEGUI::ListboxTextItem*)m_listeServeurs->getItemAtGridReference(CEGUI::MCLGridRef(row, 1));
        item->setText(s->ip);

        std::string joueurs = boost::lexical_cast<std::string>(s->nombre_joueurs_connectes);
        joueurs += "/";
        joueurs += boost::lexical_cast<std::string>(s->nombre_joueurs_max);
        item = (CEGUI::ListboxTextItem*)m_listeServeurs->getItemAtGridReference(CEGUI::MCLGridRef(row, 2));
        item->setText(joueurs);

        item = (CEGUI::ListboxTextItem*)m_listeServeurs->getItemAtGridReference(CEGUI::MCLGridRef(row, 3));
        item->setText(s->carte_jouee);

        item = (CEGUI::ListboxTextItem*)m_listeServeurs->getItemAtGridReference(CEGUI::MCLGridRef(row, 4));
        item->setText(boost::lexical_cast<std::string>(0));

        item = (CEGUI::ListboxTextItem*)m_listeServeurs->getItemAtGridReference(CEGUI::MCLGridRef(row, 5));
        item->setText((s->passwd) ?"OUI":"NON");
        m_listeServeurs->handleUpdatedItemData();
    }
}
开发者ID:xabufr,项目名称:meteor-falls,代码行数:38,代码来源:ServerList.cpp


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