#pragma once

#include "BKKbdButn.h"

// CBKVKBDView

class CBKVKBDView : public CDockablePane
{
		DECLARE_DYNAMIC(CBKVKBDView)

	protected:
		CRgn m_rgnRes;
		CBrush m_br;
		CBKKbdButn *m_pKbdButn;
		int m_cx;
		int m_cy;
		UINT m_nViewID;

		static const char LatShiftDigitTable[10];
		static const char RusShiftDigitTable[10];
		static const char RusAlphaBetTable[26];
		static const char RusAlphaBetTableShift[26];

		//Клавиатура
		BOOL                m_bIsAr2Press;      //флаг нажатия АР2
		BOOL                m_bIsShiftPress;    //флаг нажатия шифта
		BOOL                m_bIsSuPress;       //флаг нажатия СУ
		BOOL                m_bIsZaglPress;     // TRUE - загл, FALSE - стр
		BOOL                m_bXlatMode;        // TRUE - рус, FALSE - лат

	public:
		CBKVKBDView(UINT nID = IDB_BITMAP_SOFT);
		virtual ~CBKVKBDView();
		void        AdjustLayout();
		int         SetKeyboardView(UINT nID);
		BOOL        TranslateKey(int key, BOOL bExtended, WORD *nScanCode, WORD *nInt);
		inline void SetAR2Status(BOOL bB)
		{
			m_bIsAr2Press = bB;
		}
		inline BOOL isAR2Press()
		{
			return m_bIsAr2Press;
		}
		inline void SetShiftStatus(BOOL bB)
		{
			m_bIsShiftPress = bB;
		}
		inline BOOL isShiftPress()
		{
			return m_bIsShiftPress;
		}
		inline void SetSUStatus(BOOL bB)
		{
			m_bIsSuPress = bB;
		}
		inline BOOL isSUPress()
		{
			return m_bIsSuPress;
		}
		inline void SetCapitalStatus(BOOL bB)
		{
			m_bIsZaglPress = !bB;
		}
		inline BOOL isCapitalPress()
		{
			return m_bIsZaglPress;
		}
		inline void SetXLatStatus(BOOL bB)
		{
			m_bXlatMode = bB;
		}
		inline BOOL isXLatMode()
		{
			return m_bXlatMode;
		}


	protected:
		int             CreateKeyboard();
		int             LatModeTranslation(int key);
		int             RusModeTranslation(int key);
		virtual void    OnAfterFloat();

	protected:
		afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
		afx_msg void OnSize(UINT nType, int cx, int cy);
		afx_msg void OnPaint();
		afx_msg BOOL OnEraseBkgnd(CDC *pDC);
		afx_msg void OnDestroy();
		DECLARE_MESSAGE_MAP()
};


