Пример #1
0
////////////////////////////////////////////////////
//
//  CNewsBrowser::AddNewsTab
//
//
//
////////////////////////////////////////////////////
void CNewsBrowser::AddNewsTab(const SNewsItem& newsItem)
{
    CGUI* pManager = g_pCore->GetGUI();

    CGUITab* pTab = m_pTabPanel->CreateTab("News");
    m_TabList.push_back(pTab);

    // Create everything under a scrollpane
    CGUIScrollPane* m_pScrollPane = reinterpret_cast<CGUIScrollPane*>(pManager->CreateScrollPane(pTab));
    m_pScrollPane->SetProperty("ContentPaneAutoSized", "True");
    m_pScrollPane->SetPosition(CVector2D(3, 3), 0);
    m_pScrollPane->SetSize(CVector2D(618.0f, 390.0f));
    m_pScrollPane->SetVerticalScrollStepSize(0.15f);
    m_pScrollPane->SetVerticalScrollBar(true);

    // Switch cwd
    pManager->PushGuiWorkingDirectory(newsItem.strContentFullDir);

    // Load files
    CGUIWindow* pWindow = LoadLayoutAndImages(m_pScrollPane, newsItem);
    m_TabContentList.push_back(pWindow);

    // Set tab name from content window title
    if (pWindow)
    {
        SString strTitle = pWindow->GetText();
        if (!strTitle.empty())
            pTab->SetText(strTitle);
    }

    // Restore cwd
    pManager->PopGuiWorkingDirectory(newsItem.strContentFullDir);
}