/********************************************************************
*
* Created: 22/4/2014 14:16
*
* File: fsCDragDropComponent.h
*
* Author: Mick Waites
*
* Purpose: Short lived sprite based entities which can be
* dragged around a scene and dropped.
*
*********************************************************************/
#ifndef fsCDragDropComponenthdr
#define fsCDragDropComponenthdr
#include <fsCore/src/fsCUniqueId.h>
#include "fsIGestureHandlingComponent.h"
class fsCLine;
struct fsPoint;
class fsCBrush;
// #define COLLISION_DEBUG_RENDERING
// #define COLLISION_DEBUG_MESSAGES
class fsCDragDropComponent : public fsIGestureHandlingComponent
{
friend class fsCComponentFactory;
public:
static const fsCUniqueId mTypeId;
static const fsCUniqueId mDragEndMsg;
#ifdef COLLISION_DEBUG_MESSAGES
static const fsCUniqueId mDragingMsg;
#endif
static fsCEntity* dragDropEntityCreate(const fsStr& pEntName, std::shared_ptr<fsCBrush> pBrush, fsCEntity* pEnt,
const fsPoint& pOffset);
void dragStart(const fsPoint& pPos, fsS32 pPointerIndexForDrag);
protected:
fsBool acceptingInputGet() const override;
void onDragMove(const fsPoint& pCurrPos) override;
void onDragEnd(const fsPoint& pEndPos) override;
void renderDo() override;<--- Function in derived class
void matrixApplyDo() override;<--- Function in derived class
static fsIComponent* create(fsCEntity* pParent);
fsCDragDropComponent(fsCEntity* pParent);
virtual ~fsCDragDropComponent();<--- Destructor in derived class
private:
void spritePositionSet(const fsPoint& pCurrPos) const;
const fsS32 mTouchFingerVerticalOffset;
fsPoint mOffset;
#ifdef COLLISION_DEBUG_RENDERING
fsCLine* mLine;
#endif
};
#endif