Exemplo n.º 1
0
void WidgetDemo::logFiredEvent(const CEGUI::String& logMessage)
{
    ListboxItem* item = d_widgetSelectorListbox->getFirstSelectedItem();
    if(!item)
        return;

    CEGUI::String eventsLog = d_widgetsEventsLog->getText();
    eventsLog += logMessage;

    //Remove line
    int pos = std::max<int>(static_cast<int>(eventsLog.length() - 2056), 0);
    int len = std::min<int>(static_cast<int>(eventsLog.length()), 2056);
    eventsLog = eventsLog.substr(pos, len);
    if(len == 2056)
    {
        int newlinePos = eventsLog.find_first_of("\n");
        if(newlinePos != std::string::npos)
            eventsLog = eventsLog.substr(newlinePos, std::string::npos);
    }
    d_widgetsEventsLog->setText(eventsLog);

    //Scroll to end
    CEGUI::Scrollbar* scrollbar = static_cast<CEGUI::Scrollbar*>(d_widgetsEventsLog->getChild("__auto_vscrollbar__"));
    scrollbar->setScrollPosition(scrollbar->getDocumentSize() - scrollbar->getPageSize());
}
Exemplo n.º 2
0
float CGUIMemo_Impl::GetScrollbarPageSize ( void )
{
    CEGUI::Scrollbar* pScrollbar = reinterpret_cast < CEGUI::MultiLineEditbox* > ( m_pWindow )->d_vertScrollbar;
    if ( pScrollbar )
    {
        return pScrollbar->getPageSize ();
    }

    return 1.0f;
}
Exemplo n.º 3
0
void CGUIGridList_Impl::SetVerticalScrollPosition ( float fPosition )
{
    try
    {
        CEGUI::Scrollbar* pScrollbar = reinterpret_cast < CEGUI::MultiColumnList* > ( m_pWindow )->d_vertScrollbar;
        if ( pScrollbar )
            pScrollbar->setScrollPosition ( fPosition * ( pScrollbar->getDocumentSize () - pScrollbar->getPageSize () ) );
    }
    catch ( CEGUI::Exception ) {}
}
Exemplo n.º 4
0
float CGUIGridList_Impl::GetVerticalScrollPosition ( void )
{
    try
    {
        CEGUI::Scrollbar* pScrollbar = reinterpret_cast < CEGUI::MultiColumnList* > ( m_pWindow )->d_vertScrollbar;
        if ( pScrollbar )
            return ( pScrollbar->getScrollPosition () / ( pScrollbar->getDocumentSize () - pScrollbar->getPageSize () ) );
    }
    catch ( CEGUI::Exception ) {}
    return 0.0f;
}