#ifndef EDITML_H_
#define EDITML_H_

#include "GraphLow.h"
#include "GraphBase.h"
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include "MyLongString.h"

class TEditML{
	private:
		struct{
			unsigned int Width;
			unsigned int Color;
		}Border;
		char TmpChar[4];
		int OneLineTextCount;
		int LineNum;
		int LineSpacing;
	public:
		TMyLongString Str;
		bool Enable;
		int FontSize;
		int DrawMode;	//dmRaised=1 dmLowered=-1 dmNone=0
		unsigned int Color;
		unsigned int TextColor;
		unsigned int Index;
		unsigned int Edit;
		int TabOrder;
	
		int Selected;
		unsigned int SelectedColor;
		unsigned int SelectedTextColor;
	
		TPoint OwnerLeftTop;	//Parrent Left Top;
		TRect Bound;
		TRect Content;
		int Pst;
		int MaxLen;
		bool 	FlickDominance;
		unsigned int FlickTick;
		TInputMethod InputMethod;
		unsigned int Visible;
		int IsShowCursor;
	public:
		TEditML(void){};
		TEditML(int aX, int aY, int aW, int aH, int OwnerX, int OwnerY, u32 aBorderWidth, u32 aBorderColor){
			Init(aX, aY, aW, aH, OwnerX, OwnerY, aBorderWidth, aBorderColor);
		}
		void Init(int aX, int aY, int aW, int aH, int OwnerX, int OwnerY, u32 aBorderWidth, u32 aBorderColor);
		void SetText(char *p, int aFontSize);
		void SetText(const char *p, int aFontSize);
		void SelfDraw(void);
		void TextClear(void);
		
		void SetLineSpacing(int aSpacing);
		void SetSelect(void);
		void SetDeSelect(void);
		void ReDraw(void);
		void Show(void);
		
		void KeyIn(unsigned char aKey);
		
		void OnTime100mS(void);
		void SetMaxLen(unsigned int aLen);
		
		void SetInputMaskEn(void);
		void SetInputCN(void);
		
		void SetPstTail(void);
		char GetLastChar();
		void SetLastChar(char aChr);
		
		char GetCurrentChar();
		void SetCurrentChar(char aChr);
};

#endif

