From b691c43c44ff180d10e7d4a9afc83b98551ff586 Mon Sep 17 00:00:00 2001 From: daoge_cmd <3523206925@qq.com> Date: Sun, 1 Mar 2026 12:16:08 +0800 Subject: Initial commit --- Minecraft.Client/ScrolledSelectionList.h | 62 ++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 Minecraft.Client/ScrolledSelectionList.h (limited to 'Minecraft.Client/ScrolledSelectionList.h') diff --git a/Minecraft.Client/ScrolledSelectionList.h b/Minecraft.Client/ScrolledSelectionList.h new file mode 100644 index 00000000..77ec1fd8 --- /dev/null +++ b/Minecraft.Client/ScrolledSelectionList.h @@ -0,0 +1,62 @@ +#pragma once +class Button; +class Tesselator; + +class ScrolledSelectionList +{ +private: + static const int NO_DRAG = -1; + static const int DRAG_OUTSIDE = -2; + + Minecraft *minecraft; + int width; + int height; +protected: + int y0; + int y1; +private: + int x1; + int x0; +protected: + int itemHeight; +private: + int upId; + int downId; + + float yDrag; + float yDragScale; + float yo; + + int lastSelection; + __int64 lastSelectionTime ; + + bool renderSelection; + bool _renderHeader; + int headerHeight; + +public: + ScrolledSelectionList(Minecraft *minecraft, int width, int height, int y0, int y1, int itemHeight); + void setRenderSelection(bool renderSelection); + +protected: + void setRenderHeader(bool renderHeader, int headerHeight); + virtual int getNumberOfItems() = 0; + virtual void selectItem(int item, bool doubleClick) = 0; + virtual bool isSelectedItem(int item) = 0; + virtual int getMaxPosition(); + virtual void renderBackground() = 0; + virtual void renderItem(int i, int x, int y, int h, Tesselator *t) = 0; + void renderHeader(int x, int y, Tesselator *t); + void clickedHeader(int headerMouseX, int headerMouseY); + void renderDecorations(int mouseX, int mouseY); +public: + int getItemAtPosition(int x, int y); + void init(vector