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

#ifndef uVKeyH
#define uVKeyH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Forms.hpp>
#include <AppEvnts.hpp>
//---------------------------------------------------------------------------

struct KEYDEF
{
	char cNormal;
	char cShifted;
	int cWidth;
};
//---------------------------------------------------------------------------
class TfrmVKey : public TForm
{
__published:	// IDE-managed Components
   void __fastcall FormCreate(TObject *Sender);
   void __fastcall FormPaint(TObject *Sender);
   void __fastcall FormResize(TObject *Sender);
   void __fastcall FormMouseDown(TObject *Sender, TMouseButton Button,
          TShiftState Shift, int X, int Y);
   void __fastcall FormMouseMove(TObject *Sender, TShiftState Shift, int X,
          int Y);
   void __fastcall FormActivate(TObject *Sender);
   void __fastcall FormDestroy(TObject *Sender);
private:	// User declarations

   HANDLE gFocus;
   bool m_bHanMode; // 2007-07-02
   int nCurKeyState;
   void __fastcall AddKey(char pNormal, char pShifted, int pWidth);
   void __fastcall CalcWidthHeight();
   void __fastcall DrawKey(TCanvas *dc, TRect &rc, KEYDEF *key, bool bHilight = false);
   void __fastcall DrawKeyboard();
   int  __fastcall DescribeKeyState();
   void __fastcall DrawMouseOver(TCanvas *dc, TRect &rc, KEYDEF *key, bool bIsOver);

public:		// User declarations
   __fastcall TfrmVKey(TComponent* Owner);
   __fastcall TfrmVKey(TComponent* Owner, HWND hWnd);
   void __fastcall ReleaseFocus();

protected:
   void  OnWndHookMsg(TMessage Msg);
   void  OnWMMouseActivate(TWMMouseActivate Msg);
//   void  OnWMNCActivate(TWMMouseActivate Msg);

   BEGIN_MESSAGE_MAP
      VCL_MESSAGE_HANDLER(WM_USER + 100,    TMessage, OnWndHookMsg)
      VCL_MESSAGE_HANDLER(WM_MOUSEACTIVATE, TWMMouseActivate, OnWMMouseActivate)
//      VCL_MESSAGE_HANDLER(WM_NCACTIVATE,    TWMMouseActivate, OnWMNCActivate)
   END_MESSAGE_MAP(TForm)
};
//---------------------------------------------------------------------------
extern PACKAGE TfrmVKey *frmVKey;
//---------------------------------------------------------------------------
#endif
