// RunningLabel.h: interface for the CRunningLabel class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(__RV_RUNNINGLABEL_H_INCLUDED_)
#define __RV_RUNNINGLABEL_H_INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "Label.h"


#define RV_RLS_SLOW    1
#define RV_RLS_MEDIUM  2
#define RV_RLS_HIGH    3

class INDIX_API CRunningLabel : public CLabel  
{
public:
	//move speed
	enum RL_MOVE_SPEED{
		RL_MS_SLOW = 1*1,
		RL_MS_MEDIUM = 1*5,
		RL_MS_HIGH = 1*7,
	};

	CRunningLabel();
	virtual ~CRunningLabel();

    

	//for internal use only.
	//void Play();

	//virtual void Beat();
	 
	void MoveText();
		
	void SetCaption(const TCHAR* strCaption); 

	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 CUCObj* Clone(  CUCObj* twin);
	virtual void Show(CDelegate* pDelegate,int mode, BOOL bForce);	

	 //virtual void SetClientRect(int x, int y, int w, int h);
	 virtual void   SetCtrlRect(int left, int top, UINT width, UINT height) ;

	void SetRunVertical(BOOL val);

	//void SetTextColor(GRgb& val);
	//GRgb& GetTextColor() {return m_rgbTextColor;};
	
	//void SetTextMoveSpeed(RL_MOVE_SPEED val);
	//RL_MOVE_SPEED GetTextMoveSpeed() {return m_nSpeed;};

	virtual BOOL Serialize(HANDLE device, BOOL bIn ) ;

//	BOOL IsFilledShape(){ return m_bFilled; };
//	void SetFillState(BOOL flag);
	virtual void EnableAnimation(BOOL flag, CDelegate* pDelegate );
	  
	//动态控件如滚动条，动画，时间显示的内容切换
	virtual void Beat(CDelegate* pDelegate );


public:
	RL_MOVE_SPEED   m_nSpeed;
	int             m_nPeriod; //刷新频率， 默认：25 fps
protected:
	virtual void OnEndTrack(CDelegate* pDelegate,HGPD hCur,  GPoint point, int type) ;
	
	void Relayout(CDelegate* pDelegate);

private:
	BOOL     m_bRunVertical;
	//BOOL     m_bRelayout;  //临时
	//__int64  m_nRunCounter;
	__int64  m_nStartTime;



	//DWORD  m_nTimerID;

	//GRgb m_rgbTextColor;
	//int m_x, m_y;
	int m_curX, m_curY;
	int m_nTextWidth, m_nTextHeight;

	//BOOL m_bTextModified;
	//BOOL m_bFilled;

	//CRITICAL_SECTION m_cs;
};















#endif // !defined(__RV_RUNNINGLABEL_H_INCLUDED_)
