//
//	Class:		CKeyboardButtonST
//
//	Version:	See GetVersionC() or GetVersionI()
//
//	Created:	25/May/2004
//	Updated:	13/July/2007
//				29/Sep/2015
//				22/Dec/2017
//
//	Author:		Davide Calabro'		info@softechsoftware.it
//									http://www.softechsoftware.it
//
//	Disclaimer
//	----------
//	THIS SOFTWARE AND THE ACCOMPANYING FILES ARE DISTRIBUTED "AS IS" AND WITHOUT
//	ANY WARRANTIES WHETHER EXPRESSED OR IMPLIED. NO REPONSIBILITIES FOR POSSIBLE
//	DAMAGES OR EVEN FUNCTIONALITY CAN BE TAKEN. THE USER MUST ASSUME THE ENTIRE
//	RISK OF USING THIS SOFTWARE.
//
//	Terms of use
//	------------
//	In the past years SoftechSoftware has produced many free controls and code snippets.
//	All of this products were released with the full source codes included and hundreds of developers
//	all around the world have taken benefits using these easy and ready to use controls into their applications.
//	In return, SoftechSoftware asked only for a small money donation from developers.
//	Unfortunately only a very limited number of donations has been received from the large number of users
//	that rely on SoftechSoftware products for their applications.
//	Producing and updating good software costs time. So it costs money. Also, maintaning a dedicated web site
//	costs time and money.
//
//	Starting from now on almost all SoftechSoftware products will be distributed into a single general use DLL.
//	This DLL will show an annoying dialog each time your application starts. Also, this demo DLL has resource
//	and memory leaks that make your target application unstable. You can use the demo DLL only for testing
//	the SoftechSoftware product you are interested in. Then if you decide to use this product into your
//	application you must buy the full DLL version directly from SoftechSoftware.
//
//	SoftechSoftware
//	Davide Calabro'
//	Italy
//
//	http://www.softechsoftware.it
//
#pragma once

#include "BtnST.h"

// Uncomment following line if you are using this class outside the DLL
//#define _KEYBOARDBUTTONST_NODLL_

#ifndef _KEYBOARDBUTTONST_NODLL_
#ifndef	_SOFTECHSOFTWAREDLL_NOLIB_
	#ifdef _DEBUG
		#ifdef _UNICODE
			#ifdef	_WIN64
				#pragma comment(lib, "SoftechSoftwareUD64.lib")
			#else
				#pragma comment(lib, "SoftechSoftwareUD.lib")
			#endif
		#else
			#ifdef	_WIN64
				#pragma comment(lib, "SoftechSoftwareD64.lib")
			#else
				#pragma comment(lib, "SoftechSoftwareD.lib")
			#endif
		#endif
	#else
		#ifdef _UNICODE
			#ifdef	_WIN64
				#pragma comment(lib, "SoftechSoftwareU64.lib")
			#else
				#pragma comment(lib, "SoftechSoftwareU.lib")
			#endif
		#else
			#ifdef	_WIN64
				#pragma comment(lib, "SoftechSoftware64.lib")
			#else
				#pragma comment(lib, "SoftechSoftware.lib")
			#endif
		#endif
	#endif
#endif

	#ifdef	_SOFTECHSOFTWAREDLL_BUILDDLL_
		#define	KEYBOARDBUTTONST_EXPORT	__declspec(dllexport)
	#else
		#define	KEYBOARDBUTTONST_EXPORT	__declspec(dllimport)
	#endif

#else
		#define	KEYBOARDBUTTONST_EXPORT
#endif

// MSDN KB Article: 134980
// PRB: C4251 & C4275 Compiler Warnings While Compiling an AFXDLL
#pragma warning(disable: 4275)
#pragma warning(disable: 4251)

class KEYBOARDBUTTONST_EXPORT CKeyboardButtonST : public CButtonST
{
public:
	CKeyboardButtonST();
	virtual ~CKeyboardButtonST();

	enum	{	SHS_NOISE = 0,
				SHS_DIAGSHADE,
				SHS_HSHADE,
				SHS_VSHADE,
				SHS_HBUMP,
				SHS_VBUMP,
				SHS_SOFTBUMP,
				SHS_HARDBUMP,
				SHS_METAL,
				SHS_KEYBOARD,
				SHS_KEYBOARD2,

				SHS_MAX_SHADES};

	enum	{	KEYST_COLOR_MIX = 1,		// Color to mix when creating the shade
				KEYST_COLOR_LOW,			// "Low" color for background
				KEYST_COLOR_MID,			// "Middle" color for background
				KEYST_COLOR_HI,				// "High" color for background
				KEYST_COLOR_FOCUS_UP,		// Color of the up/left focus rectangle
				KEYST_COLOR_FOCUS_DOWN,		// Color of the down/right focus rectangle
				KEYST_COLOR_PRESSED_UP,		// Color of the up/left pressed rectangle
				KEYST_COLOR_PRESSED_DOWN,	// Color of the down/right pressed rectangle
				KEYST_COLOR_TEXT_NORMAL,	// Color of the text when the key is normal
				KEYST_COLOR_TEXT_PRESSED,	// Color of the text when the key is pressed
				KEYST_COLOR_TEXT_FOCUSED,	// Color of the text when the key is focused

				KEYST_MAX_COLORS};

	DWORD SetShade(BYTE byShade, BOOL bRepaint = TRUE);

	DWORD SetDefaultColors(BOOL bRepaint = TRUE);
	DWORD SetColor(BYTE byColorIndex, COLORREF crColor, BOOL bRepaint = TRUE);

	DWORD SetBlueBorder(BOOL bBlueBorder, BOOL bRepaint = TRUE);
	DWORD SetRoundPressed(BOOL bRoundPressed, BOOL bRepaint = TRUE);

	void DrawTransparent(BOOL bRepaint = FALSE);
	DWORD SetBk(CDC* pDC);

	static short GetVersionI()		{return 12;}
	static LPCTSTR GetVersionC()	{return (LPCTSTR)_T("1.2");}

protected:
	virtual DWORD OnDrawBackground(CDC* pDC, CRect* pRect);
	virtual DWORD OnDrawBorder(CDC* pDC, CRect* pRect);

private:
	BYTE		m_byShadeIndex;
	COLORREF	m_crColors[KEYST_MAX_COLORS];	// Colors to be used
	BOOL		m_bBlueBorder;
	BOOL		m_bRoundPressed;
};

#pragma warning(default: 4275)
#pragma warning(default: 4251)
