// page item icon set/get function void UIScrollPage::SetPageItemIcon(int ipage, int icolumn, int irow, string iconFile) { if (ipage > (int) m_ipageCount || ipage < 0) return; if (icolumn >(int) m_icolumn || icolumn < 0) return; if (irow > (int) m_irow || irow < 0) return; CCSprite* elfIcon1 = CCSprite::createWithSpriteFrameName(iconFile.c_str()); IconButton* pButton = m_lstButton[ipage * m_irow * m_icolumn + irow * m_icolumn + icolumn]; if (pButton) { pButton->SetNormalIcon(elfIcon1); } }
void UIScrollPage::SetPageItemIconWithSprite(int ipage, int icolmun, int irow, CCSprite* isprite) { if (ipage > (int) m_ipageCount || ipage < 0) return; if (icolmun >(int) m_icolumn || icolmun < 0) return; if (irow > (int) m_irow || irow < 0) return; size_t index = ipage * m_irow * m_icolumn + irow * m_icolumn + icolmun; if(index < m_lstButton.size()) { IconButton* pButton = m_lstButton[ipage * m_irow * m_icolumn + irow * m_icolumn + icolmun]; if (pButton) { pButton->SetNormalIcon(isprite); } } }