//---------------------------------------------------------------------------

#ifndef KeyBoardH
#define KeyBoardH
#include <vcl.h>
#include "PNGButton.hpp"
#include "GlobalUnit.h"
//---------------------------------------------------------------------------
class TKeyBoard : public TPanel
{

private:
	TPNGButton *m_PngClose;
	TImage *m_imgKeyboard;
	TPaintBox *m_pbKeyboard;

	struct {
		int xPos;
		TBitmap * pBmp;
	} m_aKey[12];
	struct {
		int x1;
		int x2;
		int iKey;
	} m_aBlackHitTest[5];

	bool m_bKeyDown;
	int m_nGroupWidth,
		m_nWhiteWidth,
		m_nBlackWidth,
		m_nBlackHeight,
		m_iPressGroup,
		m_iPressKey;

	TBitmap * m_pBmpWhiteDDown,
			* m_pBmpWhiteLDown,
			* m_pBmpWhiteRDown,
			* m_pBmpBlackDown;

	TPngImage * m_imgFirst,
			  * m_imgSecond,
			  * m_imgThird,
			  * m_imgForth,
			  * m_ImgClose,          //¹Ø±Õ
			  * m_ImgBrk;            //¸ÖÇÙ±³¾°
private:
	int KeyboardGetPressKey(int X, int Y);
	void __fastcall CloseClick(System::TObject* Sender);

	void __fastcall KeyboardPaint(TObject *Sender);
	void __fastcall KeyboardMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift,
          int X, int Y);
	void __fastcall KeyboardMouseMove(TObject *Sender, TShiftState Shift, int X, int Y);
	void __fastcall KeyboardMouseLeave(TObject *Sender);
	void __fastcall KeyboardMouseEnter(TObject *Sender);
	void __fastcall KeyboardMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift,
		  int X, int Y);

public:
	void __fastcall ShowKeyboard( bool bShow );

	__fastcall TKeyBoard(TComponent* Owner);
	__fastcall ~TKeyBoard();
};
#endif
