2022-08-01 11:18:03 -04:00
|
|
|
#pragma once
|
|
|
|
|
2022-10-13 05:56:23 -04:00
|
|
|
#include <cocos2d.h>
|
2024-02-11 13:58:46 -05:00
|
|
|
#include <cocos-ext.h>
|
|
|
|
#include <Geode/binding/CCScrollLayerExt.hpp>
|
2022-08-01 11:18:03 -04:00
|
|
|
|
|
|
|
namespace geode {
|
2022-09-27 17:14:53 -04:00
|
|
|
class GEODE_DLL Scrollbar : public cocos2d::CCLayer {
|
2022-08-01 11:18:03 -04:00
|
|
|
protected:
|
|
|
|
CCScrollLayerExt* m_target = nullptr;
|
|
|
|
cocos2d::extension::CCScale9Sprite* m_track;
|
|
|
|
cocos2d::extension::CCScale9Sprite* m_thumb;
|
|
|
|
cocos2d::CCPoint m_clickOffset;
|
|
|
|
float m_width;
|
|
|
|
bool m_resizeThumb;
|
|
|
|
bool m_trackIsRotated;
|
|
|
|
bool m_hoverHighlight;
|
2022-09-27 17:14:53 -04:00
|
|
|
bool m_touchDown = false;
|
2022-08-01 11:18:03 -04:00
|
|
|
|
2022-09-27 17:14:53 -04:00
|
|
|
bool ccTouchBegan(cocos2d::CCTouch* touch, cocos2d::CCEvent* event) override;
|
|
|
|
void ccTouchMoved(cocos2d::CCTouch* touch, cocos2d::CCEvent* event) override;
|
|
|
|
void ccTouchEnded(cocos2d::CCTouch* touch, cocos2d::CCEvent* event) override;
|
|
|
|
void ccTouchCancelled(cocos2d::CCTouch* touch, cocos2d::CCEvent* event) override;
|
2022-08-01 11:18:03 -04:00
|
|
|
void scrollWheel(float y, float x) override;
|
2022-09-27 17:14:53 -04:00
|
|
|
void registerWithTouchDispatcher() override;
|
2022-10-30 14:59:20 -04:00
|
|
|
|
2022-08-01 11:18:03 -04:00
|
|
|
void draw() override;
|
|
|
|
|
2022-09-27 17:14:53 -04:00
|
|
|
bool init(CCScrollLayerExt* list);
|
2022-08-01 11:18:03 -04:00
|
|
|
|
|
|
|
public:
|
|
|
|
void setTarget(CCScrollLayerExt* list);
|
|
|
|
|
|
|
|
static Scrollbar* create(CCScrollLayerExt* list);
|
|
|
|
};
|
|
|
|
}
|