2022-08-01 11:18:03 -04:00
|
|
|
#pragma once
|
|
|
|
|
2022-10-13 07:00:41 -04:00
|
|
|
#include <Geode/binding/CustomListView.hpp>
|
2024-02-11 13:58:46 -05:00
|
|
|
#include <Geode/binding/CCIndexPath.hpp>
|
2022-10-30 14:59:20 -04:00
|
|
|
#include <Geode/binding/TableViewCell.hpp>
|
2022-08-01 11:18:03 -04:00
|
|
|
|
|
|
|
namespace geode {
|
|
|
|
class GEODE_DLL GenericListCell : public TableViewCell {
|
|
|
|
protected:
|
2024-06-06 04:03:36 -04:00
|
|
|
cocos2d::ccColor3B m_primaryColor;
|
|
|
|
cocos2d::ccColor3B m_secondaryColor;
|
|
|
|
GLubyte m_opacity;
|
|
|
|
|
2022-10-30 14:59:20 -04:00
|
|
|
GenericListCell(char const* name, cocos2d::CCSize size);
|
2022-08-01 11:18:03 -04:00
|
|
|
|
|
|
|
void draw() override;
|
|
|
|
|
|
|
|
public:
|
2022-10-30 14:59:20 -04:00
|
|
|
static GenericListCell* create(char const* key, cocos2d::CCSize size);
|
2022-08-01 11:18:03 -04:00
|
|
|
|
2024-06-06 08:20:44 -04:00
|
|
|
void updateBGColor(int index);
|
2024-06-06 04:03:36 -04:00
|
|
|
void setPrimaryColor(cocos2d::ccColor3B color);
|
|
|
|
void setSecondaryColor(cocos2d::ccColor3B color);
|
|
|
|
void setOpacity(GLubyte opacity);
|
2022-08-01 11:18:03 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2022-10-30 14:59:20 -04:00
|
|
|
* Class for a generic scrollable list of
|
2022-08-01 11:18:03 -04:00
|
|
|
* items like the level list in GD
|
|
|
|
*/
|
|
|
|
class GEODE_DLL ListView : public CustomListView {
|
|
|
|
protected:
|
2024-06-06 08:20:44 -04:00
|
|
|
cocos2d::ccColor3B m_primaryCellColor;
|
|
|
|
cocos2d::ccColor3B m_secondaryCellColor;
|
|
|
|
GLubyte m_cellOpacity;
|
|
|
|
|
2023-12-21 11:42:01 -05:00
|
|
|
void setupList(float) override;
|
2022-10-30 14:59:20 -04:00
|
|
|
TableViewCell* getListCell(char const* key) override;
|
2023-06-04 19:45:56 -04:00
|
|
|
void loadCell(TableViewCell* cell, int index) override;
|
2022-08-01 11:18:03 -04:00
|
|
|
|
|
|
|
public:
|
|
|
|
/**
|
2022-10-30 14:59:20 -04:00
|
|
|
* Create a generic scrollable list of
|
2022-08-01 11:18:03 -04:00
|
|
|
* items
|
|
|
|
* @param items Nodes to add as children
|
|
|
|
* @param itemHeight Height of each child
|
|
|
|
* @param width Width of the list
|
|
|
|
* @param height Height of the list
|
2022-10-30 14:59:20 -04:00
|
|
|
* @returns The created ListView, or nullptr
|
2022-08-01 11:18:03 -04:00
|
|
|
* on error
|
|
|
|
*/
|
|
|
|
static ListView* create(
|
2022-10-30 14:59:20 -04:00
|
|
|
cocos2d::CCArray* items, float itemHeight = 40.f, float width = 358.f,
|
2022-08-01 11:18:03 -04:00
|
|
|
float height = 220.f
|
|
|
|
);
|
2024-06-06 08:20:44 -04:00
|
|
|
|
|
|
|
void setPrimaryCellColor(cocos2d::ccColor3B color);
|
|
|
|
void setSecondaryCellColor(cocos2d::ccColor3B color);
|
|
|
|
void setCellOpacity(GLubyte opacity);
|
2022-08-01 11:18:03 -04:00
|
|
|
};
|
|
|
|
}
|