#ifndef __COMMENT_H_INCLUDED_
#define __COMMENT_H_INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif 

 
#include "label.h"


#define COMMENT_VERTEX_COUNT  5

 

typedef struct __comment_descriptor{
	GPoint p1,p2,p3,p4,p5;
}GdComment;


class INDIX_API CComment:public CLabel 
{
public:
  
	CComment(void);
	virtual ~CComment(void);

	virtual BOOL Serialize(HANDLE device, BOOL bIn ) ;

	virtual void Show(CDelegate* pDelegate,int mode, BOOL bForce);	

	virtual CUCObj* Clone(  CUCObj *twin);

	virtual BOOL  Create(/*CDelegate* pDelegate=NULL,*/ const TCHAR* strName = NULL, UINT id =-1, int style = RV_UC_DEFAULT_STYLE ) ;
	virtual void  Destroy(/*BOOL bEraseStroke=FALSE*/) ;

	virtual BOOL OnPositionChange(HGPD hOri, HGPD hCur, HGPD hNew, GPoint grabPos, RvOffset &offset);
	virtual BOOL OnExtenderChange(HGPD hCur, HGPD hNew, int index, GPoint &curPos);

	virtual void OnEndTrack(CDelegate* pDelegate,HGPD hCur,  GPoint point, int nHitTest) ;
    
	virtual int HitTest(CDelegate* pDelegate,  GPoint point);
	virtual HGPD CreateGraphicDescriptor(CDelegate* pDelegate);

	virtual void CopyGraphicDescriptor(const HGPD src, HGPD dest)  ;
	virtual void DestroyGraphicDescriptor(HGPD hGpd)  ;

	virtual void ShowSketch(CDelegate* pDelegate,CSketchMark* pMark, HGPD hGpd, int grabType, GPoint grabPos);
	//virtual void ShowSketch(RvPoint leftTop, RvPoint rightBottom);
	 
	virtual GRect GetExtenderRect(CDelegate* pDelegate,int index, RvSize size);
	 
	virtual void Move(double dx, double dy) ;

	virtual void   SetCtrlRect(int left, int top, int right, int bottom) ;
	virtual RvRect GetCtrlRect();
	virtual void   SetCtrlPos(int x, int y);
	virtual RvPoint GetCtrlPos();

protected:
	RV_HANDLE DrawShape(HGDC dc, RV_HANDLE hStroke);

private:

	void  GetCommentPoint(int *pPointLiftX, int *pPointRightX, int *pPointLiftY, int *pPointRightY);
	void  GetShowSketchPoint(int *pPointLiftX, int *pPointRightX, int *pPointLiftY, int *pPointRightY, GdComment* l);

	void GetMaskWidthHigh(int *pMaskW, int *pMaskH);

	void GetHitTestXY(int *pRightX, int *pTopY);
 
	void GetMaskCoord(int *pMaskRightX, int *pMaskTopY);

	void UpdateShapeMask( );
	  

	RvMask  m_mask;
 
	GPoint  m_shapeVertex[COMMENT_VERTEX_COUNT];
	 
	 
};

#endif