geode/loader/include/Geode/ui/ListView.hpp
ConfiG 3fec377e96
Improve actions build speed by using sccache, removes PCH (#493)
---------

Co-authored-by: mat <26722564+matcool@users.noreply.github.com>
2024-02-11 15:58:46 -03:00

46 lines
1.4 KiB
C++

#pragma once
#include <Geode/binding/CustomListView.hpp>
#include <Geode/binding/CCIndexPath.hpp>
#include <Geode/binding/TableViewCell.hpp>
namespace geode {
class GEODE_DLL GenericListCell : public TableViewCell {
protected:
GenericListCell(char const* name, cocos2d::CCSize size);
void draw() override;
public:
static GenericListCell* create(char const* key, cocos2d::CCSize size);
void updateBGColor(int index);
};
/**
* 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;
TableViewCell* getListCell(char const* key) override;
void loadCell(TableViewCell* cell, int index) override;
public:
/**
* 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
* @returns The created ListView, or nullptr
* on error
*/
static ListView* create(
cocos2d::CCArray* items, float itemHeight = 40.f, float width = 358.f,
float height = 220.f
);
};
}