#ifndef LISTBOX_H_
#define LISTBOX_H_

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

#define ListBoxMaxLineCount 36
#define ListBoxMaxLineWidth 100

class TListBoxForm{
	private:
		int FontSize;
		int FontHeight;
		struct{
			u16 Width;
			unsigned int Color;
		}Border;
		struct {
			u32 Color;
			u32 RibbonColor;
		}VScrollBar;
		unsigned char *TextMount[ListBoxMaxLineCount];
	public:
		struct{
			int Count;
			int TopIndex;
			int SelectedIndex;
		}Items;
		int Visible;
		int LineHeight;

		
		u32 BoderColor;
		u32 Color;
		u32 TextColor;
		u32 SelectedColor;
		u32 SelectedTextColor;
	
		int TabOrder;
	
		TPoint OwnerLeftTop; //ParrentLeftTop;
		TRect Bound;
		TRect VScrollBarBox;
		TRect Content;
		
		unsigned char Caption[64];
	
	private:
		
	
	public:
		TListBoxForm(){};
		TListBoxForm(int aX, int aY, int aW, int aH, int OwnerX, int OwnerY, u16 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, u16 aBorderWidth, u32 aBorderColor);
		void SetFontSize(int size);
		void SetOwnerLeftTop(int OwnerX, int OwnerY);
		
		void DrawSelf(void);
		void DrawVertScrollBar(void);
		void DrawList(void);
		void Show(void);
		
		void KeyIn(int step);	
		int  GetTopIndex(void); 		//return ListBox First Line Pointer to (StringList or Data)'s ItemIndex;
		int  GetSelectedItemIndex(void); 	//return ListBox Selected Line Pointer to (StringList or Data)'s ItemIndex;
		void SetTextMount(unsigned char *pTextMount, u32 Ind); //set ListBox Line Text Pointer
		
		void FullRePaint(void);
		void RePaint(void);
		
		int ExtRequst(unsigned char Prm){return 0;}
};









#endif

