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


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

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


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

示例1: 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

示例2: 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


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