diff --git a/loader/include/Geode/ui/ListView.hpp b/loader/include/Geode/ui/ListView.hpp index 40c9da0d..490e931a 100644 --- a/loader/include/Geode/ui/ListView.hpp +++ b/loader/include/Geode/ui/ListView.hpp @@ -18,7 +18,7 @@ namespace geode { public: static GenericListCell* create(char const* key, cocos2d::CCSize size); - virtual void updateBGColor(int index); + void updateBGColor(int index); void setPrimaryColor(cocos2d::ccColor3B color); void setSecondaryColor(cocos2d::ccColor3B color); void setOpacity(GLubyte opacity); @@ -30,6 +30,10 @@ namespace geode { */ class GEODE_DLL ListView : public CustomListView { protected: + cocos2d::ccColor3B m_primaryCellColor; + cocos2d::ccColor3B m_secondaryCellColor; + GLubyte m_cellOpacity; + void setupList(float) override; TableViewCell* getListCell(char const* key) override; void loadCell(TableViewCell* cell, int index) override; @@ -49,5 +53,9 @@ namespace geode { cocos2d::CCArray* items, float itemHeight = 40.f, float width = 358.f, float height = 220.f ); + + void setPrimaryCellColor(cocos2d::ccColor3B color); + void setSecondaryCellColor(cocos2d::ccColor3B color); + void setCellOpacity(GLubyte opacity); }; } diff --git a/loader/src/ui/nodes/ListView.cpp b/loader/src/ui/nodes/ListView.cpp index a5fe20c5..6e3845bc 100644 --- a/loader/src/ui/nodes/ListView.cpp +++ b/loader/src/ui/nodes/ListView.cpp @@ -35,6 +35,18 @@ void GenericListCell::updateBGColor(int index) { m_backgroundLayer->setOpacity(m_opacity); } +void GenericListCell::setPrimaryColor(cocos2d::ccColor3B color) { + m_primaryColor = color; +} + +void GenericListCell::setSecondaryColor(cocos2d::ccColor3B color) { + m_secondaryColor = color; +} + +void GenericListCell::setOpacity(GLubyte opacity) { + m_opacity = opacity; +} + void ListView::setupList(float) { if (!m_entries->count()) return; m_tableView->reloadData(); @@ -65,6 +77,9 @@ void ListView::loadCell(TableViewCell* cell, int index) { node->setContentSize(lcell->getScaledContentSize()); node->setPosition(0, 0); lcell->addChild(node); + lcell->setPrimaryColor(m_primaryCellColor); + lcell->setSecondaryColor(m_secondaryCellColor); + lcell->setOpacity(m_cellOpacity); lcell->updateBGColor(index); } } @@ -73,6 +88,9 @@ ListView* ListView::create(CCArray* items, float itemHeight, float width, float auto ret = new ListView(); if (ret) { ret->m_itemSeparation = itemHeight; + ret->m_primaryCellColor = ccc3(0xa1, 0x58, 0x2c); + ret->m_secondaryCellColor = ccc3(0xc2, 0x72, 0x3e); + ret->m_cellOpacity = 0xff; if (ret->init(items, BoomListType::Default, width, height)) { ret->autorelease(); return ret; @@ -82,14 +100,14 @@ ListView* ListView::create(CCArray* items, float itemHeight, float width, float return nullptr; } -void GenericListCell::setPrimaryColor(cocos2d::ccColor3B color) { - m_primaryColor = color; +void ListView::setPrimaryCellColor(cocos2d::ccColor3B color) { + m_primaryCellColor = color; } -void GenericListCell::setSecondaryColor(cocos2d::ccColor3B color) { - m_secondaryColor = color; +void ListView::setSecondaryCellColor(cocos2d::ccColor3B color) { + m_secondaryCellColor = color; } -void GenericListCell::setOpacity(GLubyte opacity) { - m_opacity = opacity; -} +void ListView::setCellOpacity(GLubyte opacity) { + m_cellOpacity = opacity; +} \ No newline at end of file