164 lines
3.5 KiB
C++
164 lines
3.5 KiB
C++
#pragma once
|
|
#include "KObject.h"
|
|
#include "KTypes.h"
|
|
//#include <string>
|
|
|
|
class KUIWnd;
|
|
class KViewportObject;
|
|
class KSpritePrimitive;
|
|
|
|
class KUIDragAndDropObject : public KObject
|
|
{
|
|
public:
|
|
KUIDragAndDropObject() {}
|
|
~KUIDragAndDropObject() {}
|
|
|
|
void Set(KUIWnd* _pSenderParent, KUIWnd* _pSenderControl)
|
|
{
|
|
m_pSenderParent = _pSenderParent;
|
|
m_pSenderControl = _pSenderControl;
|
|
}
|
|
|
|
|
|
KUIWnd* GetParent() { return m_pSenderParent;}
|
|
KUIWnd* GetControl() { return m_pSenderControl;}
|
|
|
|
LPCSTR GetParentID();
|
|
LPCSTR GetControlID();
|
|
|
|
protected:
|
|
KUIWnd* m_pSenderParent;
|
|
KUIWnd* m_pSenderControl;
|
|
};
|
|
|
|
|
|
class KUIDragAndDropRenderer : public KObject
|
|
{
|
|
public:
|
|
KUIDragAndDropRenderer() {}
|
|
virtual ~KUIDragAndDropRenderer() {}
|
|
|
|
virtual void Render(KViewportObject* pViewport) = 0;
|
|
void SetPosition(int x, int y)
|
|
{
|
|
m_ptPos.x = x;
|
|
m_ptPos.y = y;
|
|
}
|
|
|
|
protected:
|
|
KPoint m_ptPos;
|
|
};
|
|
|
|
/// 가장 일반적으로 쓰일것.
|
|
class KUIDragAndDropNormalIconRenderer : public KUIDragAndDropRenderer
|
|
{
|
|
public:
|
|
KUIDragAndDropNormalIconRenderer();
|
|
virtual ~KUIDragAndDropNormalIconRenderer();
|
|
|
|
void SetMaxState(DWORD dwMaxState);
|
|
void SetStateIcon(LPCSTR lpszSprName, LPCSTR lpszAniName, int nFrameIndex, DWORD dwState);
|
|
void EnableState(DWORD dwState, bool bEnable);
|
|
|
|
virtual void Render(KViewportObject* pViewport);
|
|
|
|
protected:
|
|
DWORD m_dwMaxState;
|
|
KSpritePrimitive* m_pSpritePrimitiveArray;
|
|
};
|
|
|
|
|
|
class KUIDragAndDropNullRenderer : public KUIDragAndDropRenderer // 아무것도 그리지 않는 렌더러
|
|
{
|
|
public:
|
|
KUIDragAndDropNullRenderer() {}
|
|
virtual ~KUIDragAndDropNullRenderer() {}
|
|
|
|
virtual void Render(KViewportObject* pViewport) {}
|
|
|
|
static KUIDragAndDropNullRenderer* GetInstance() { static KUIDragAndDropNullRenderer inst; return &inst; }
|
|
};
|
|
|
|
|
|
/// "UI_CANDROP"
|
|
struct KUIDragAndDropMessage : public KArg
|
|
{
|
|
KUIDragAndDropMessage()
|
|
{
|
|
pObject = NULL;
|
|
}
|
|
|
|
// Output
|
|
|
|
std::string sRecvDropParentID; ///< Drop 받을 Control의 Parent의 ID
|
|
std::string sRecvDropControlID; ///< Drop 받을 Control의 ID
|
|
|
|
// Input
|
|
KPoint ptDropPos;
|
|
KUIDragAndDropObject* pObject;
|
|
};
|
|
|
|
|
|
/// "UI_ON_CHECK_DROP"
|
|
struct KUIOnCheckDropMessage : public KArg
|
|
{
|
|
std::string sSendDropControlID;
|
|
std::string sRecvDropControlID;
|
|
std::string sRecvDropParentID;
|
|
KPoint ptDropPos;
|
|
|
|
};
|
|
|
|
/// "UI_BEGIN_DRAG"
|
|
struct KUIBeginDragMessage : public KArg
|
|
{
|
|
KUIBeginDragMessage()
|
|
{
|
|
pDragAndDropRenderer = NULL;
|
|
}
|
|
std::string sDragControlID;
|
|
KUIDragAndDropNormalIconRenderer* pDragAndDropRenderer;
|
|
};
|
|
|
|
/** "UI_RECV_DROP"
|
|
"UI_SEND_DROP" */
|
|
struct KUISendRecvDropMessage : public KArg
|
|
{
|
|
// 2011.04.26 - servantes
|
|
KUISendRecvDropMessage()
|
|
{
|
|
sRecvDropParentID = "";
|
|
sRecvDropControlID = "";
|
|
sSendDropParentID = "";
|
|
sSendDropControlID = "";
|
|
ptDropPos.x = ptDropPos.y = 0;
|
|
}
|
|
|
|
KUISendRecvDropMessage( const KUIDragAndDropMessage& msg)
|
|
{
|
|
sRecvDropParentID = msg.sRecvDropParentID;
|
|
sRecvDropControlID = msg.sRecvDropControlID;
|
|
|
|
sSendDropParentID = msg.pObject->GetParentID();
|
|
sSendDropControlID = msg.pObject->GetControlID();
|
|
|
|
ptDropPos = msg.ptDropPos;
|
|
|
|
}
|
|
|
|
bool IsMeaningless( ) const
|
|
{
|
|
return ( sSendDropParentID == sRecvDropParentID && sSendDropControlID == sRecvDropControlID ) ? true : false;
|
|
}
|
|
|
|
std::string sSendDropParentID; ///< Drop을 보낸 Control Parent의 ID
|
|
std::string sSendDropControlID; ///< Drop을 보낸 Control의 Id
|
|
|
|
std::string sRecvDropParentID; ///< Drop 받을 Control의 Parent의 ID
|
|
std::string sRecvDropControlID; ///< Drop 받을 Control의 ID
|
|
|
|
KPoint ptDropPos;
|
|
};
|
|
|
|
|