geode/loader/include/Geode/ui/ListView.hpp

46 lines
1.3 KiB
C++
Raw Normal View History

#pragma once
#include <Geode/binding/CustomListView.hpp>
2022-10-30 14:59:20 -04:00
#include <Geode/binding/TableViewCell.hpp>
namespace geode {
class GEODE_DLL GenericListCell : public TableViewCell {
protected:
2022-10-30 14:59:20 -04:00
GenericListCell(char const* name, cocos2d::CCSize size);
void draw() override;
public:
2022-10-30 14:59:20 -04:00
static GenericListCell* create(char const* key, cocos2d::CCSize size);
void updateBGColor(int index);
};
/**
2022-10-30 14:59:20 -04:00
* Class for a generic scrollable list of
* items like the level list in GD
*/
class GEODE_DLL ListView : public CustomListView {
protected:
void setupList(float) override;
2022-10-30 14:59:20 -04:00
TableViewCell* getListCell(char const* key) override;
void loadCell(TableViewCell* cell, int index) override;
public:
/**
2022-10-30 14:59:20 -04:00
* Create a generic scrollable list of
* 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
* on error
*/
static ListView* create(
2022-10-30 14:59:20 -04:00
cocos2d::CCArray* items, float itemHeight = 40.f, float width = 358.f,
float height = 220.f
);
};
}