diff options
| author | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
|---|---|---|
| committer | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
| commit | b691c43c44ff180d10e7d4a9afc83b98551ff586 (patch) | |
| tree | 3e9849222cbc6ba49f2f1fc6e5fe7179632c7390 /Minecraft.Client/ScrolledSelectionList.h | |
| parent | def8cb415354ac390b7e89052a50605285f1aca9 (diff) | |
Initial commit
Diffstat (limited to 'Minecraft.Client/ScrolledSelectionList.h')
| -rw-r--r-- | Minecraft.Client/ScrolledSelectionList.h | 62 |
1 files changed, 62 insertions, 0 deletions
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<Button *> *buttons, int upButtonId, int downButtonId); +private: + void capYPosition(); +public: + void buttonClicked(Button *button); + void render(int xm, int ym, float a); +private: + void renderHoleBackground(int y0, int y1, int a0, int a1); +};
\ No newline at end of file |
