axmol/extensions/fairygui/DragDropManager.h

35 lines
687 B
C
Raw Normal View History

2020-08-04 12:31:33 +08:00
#ifndef __DRAGDROPMANAGER_H__
#define __DRAGDROPMANAGER_H__
#include "FairyGUIMacros.h"
#include "cocos2d.h"
#include "GLoader.h"
NS_FGUI_BEGIN
class DragDropManager
{
public:
DragDropManager();
~DragDropManager();
static DragDropManager* getInstance();
GLoader* getAgent() const { return _agent; }
bool isDragging() const { return _agent->getParent() != nullptr; }
2022-08-08 18:02:17 +08:00
void startDrag(const std::string& icon, const ax::Value& sourceData = ax::Value::Null, int touchPointID = -1);
2020-08-04 12:31:33 +08:00
void cancel();
private:
void onDragEnd(EventContext* context);
static DragDropManager* _inst;
GLoader* _agent;
2022-08-08 18:02:17 +08:00
ax::Value _sourceData;
2020-08-04 12:31:33 +08:00
};
NS_FGUI_END
#endif