2022-08-01 11:18:03 -04:00
|
|
|
#pragma once
|
|
|
|
|
2022-10-13 07:00:41 -04:00
|
|
|
#include <Geode/binding/CustomListView.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:
|
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
|
|
|
|
|
|
|
void updateBGColor(int index);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
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:
|
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
|
|
|
|
);
|
|
|
|
};
|
|
|
|
}
|