unsigned int CListBox::AddItem(SListItem ListItem) { m_Items.push_back(ListItem); m_SelectedItems.push_back(false); m_RenderedStrings.push_back(CRenderedString(m_pFontEngine, ListItem.sItemText, CRenderedString::VALIGN_TOP, CRenderedString::HALIGN_LEFT)); int iMax = m_Items.empty() ? 0 : m_Items.size() - 1; // judb correction MaxLimit (number of 'scrolls' = number of items - visible number of items ) m_pVScrollbar->SetMaxLimit(stdex::MaxInt(iMax - (m_ClientRect.Height() / m_iItemHeight) + 1, 0)); Draw(); return m_Items.size(); }
unsigned int CNavigationBar::AddItem(SNavBarItem NavBarItem) { m_Items.push_back(NavBarItem); m_RenderedStrings.push_back(CRenderedString(m_pFontEngine, NavBarItem.sItemText, CRenderedString::VALIGN_BOTTOM, CRenderedString::HALIGN_CENTER)); if (NavBarItem.sPictureFilename != "") { m_Bitmaps.push_back(new CBitmapFileResourceHandle(NavBarItem.sPictureFilename)); // Set transparency color to COLOR_WHITE: SDL_SetColorKey(m_Bitmaps.at(m_Bitmaps.size() - 1)->Bitmap(), SDL_SRCCOLORKEY, COLOR_WHITE.SDLColor(m_pSDLSurface->format)); } else { m_Bitmaps.push_back(nullptr); } Draw(); return m_Items.size(); }