#include "C:\L\Button\Button.h"
myButton::myButton()
{
	Reset();
}
myButton::~myButton()
{
}
void myButton::Reset()
{
	X				= 0;
	Y				= 0;
	Width			= 0;
	Height			= 0;
	BmpX			= 0;
	BmpY			= 0;
	BmpXAlt			= 0;
	BmpYAlt			= 0;
	PopUpLength		= 0;
	DisplayLength	= 0;
	isActive		= true;
	BmpXInactive	= 0;
	BmpYInactive	= 0;
	PopUpHelp		= "";		
	DisplayText		= "";
}
void myButton::SetPopUp(string data)
{
	if(data.length() > 0)
	{
		PopUpHelp		= data;
		PopUpLength		= int(data.length());
	}
	else
	{
		PopUpHelp		= "";
		PopUpLength		= 0;
	}
}
string myButton::GetPopUp() const
{
	return PopUpHelp;
}
int	myButton::GetPopUpLength()
{
	return PopUpLength;
}
void myButton::SetDisplayText(string data)
{
	if(data.length() > 0)
	{
		DisplayText		= data;
		DisplayLength	= int(data.length());
	}
	else
	{
		DisplayText		= "";
		DisplayLength	= 0;
	}
}
string myButton::GetDisplayText() const
{
	return DisplayText;
}
int	myButton::GetDisplayLength()
{
	return 	DisplayLength;
}
void myButton::SetX(int data)
{
	X = data;
}
int	myButton::GetX() const
{
	return X;
}
void myButton::SetY(int data)
{
	Y = data;
}
int	myButton::GetY() const
{
	return Y;
}
void myButton::SetWidth(int data)
{
	Width = data;
}
int	myButton::GetWidth() const
{
	return Width;
}
void myButton::SetHeight(int data)
{
	Height = data;
}
int	myButton::GetHeight() const
{
	return Height;
}
void myButton::SetBmpX(int data)
{
	BmpX = data;
}
int	myButton::GetBmpX() const
{
	return BmpX;
}
void myButton::SetBmpY(int data)
{
	BmpY = data;
}
int myButton::GetBmpY() const
{
	return BmpY;
}
int	myButton::GetBmpW()
{
	return int(BmpX + Width);
}
int	myButton::GetBmpH()
{
	return int(BmpY + Height);
}
void myButton::SetBmpXAlt(int data)
{
	BmpXAlt = data;
}
int myButton::GetBmpXAlt() const
{
	return BmpXAlt;
}

void myButton::SetBmpYAlt(int data)
{
	BmpYAlt = data;
}
int	myButton::GetBmpYAlt() const
{
	return BmpYAlt;
}
int	myButton::GetBmpAltW()
{
	return int(BmpXAlt + Width);
}
int	myButton::GetBmpAltH()
{
	return int(BmpYAlt + Height);
}
void myButton::SetProperties(int iX, int iY, int iW, int iH, int iBmpX, int iBmpY, int iBmpAltX, int iBmpAltY, int bmpInactX, int bmpInactY, bool Active,  string Help, string Display)
{
	X				= iX;
	Y				= iY;				
	Width			= iW;			
	Height			= iH;			
	BmpX			= iBmpX;
	BmpY			= iBmpY;
	BmpXAlt			= iBmpAltX;
	BmpYAlt			= iBmpAltY;
	isActive		= Active;
	BmpXInactive	= bmpInactX;
	BmpYInactive	= bmpInactY;
	if(Help.length() > 0)
	{
		PopUpHelp	= Help;
		PopUpLength	= int(PopUpHelp.length());
	}
	else
	{
		PopUpHelp	= "";
		PopUpLength	= 0;
	}
	if(Display.length() > 0)
	{
		DisplayText		= Display;
		DisplayLength	= int(DisplayText.length());
	}
	else
	{
		DisplayText		= "";
		DisplayLength	= 0;
	}
}
bool myButton::DidItHit(int MX, int MY)
{
	//We took out the check to see if the button was active...
	//We want to return something useful so that main() program will react to
	//the User's attempt to use the button - M. White 09 August, 2019
	if(MX > X && MX < (X + Width) && MY > Y && MY < (Y + Height))	return true;
	else															return false;
}
void myButton::SetIsActive(bool Status)
{
	isActive = Status;
}
bool myButton::GetIsActive() const
{
	return isActive;
}
void myButton::SetBmpInActX(int x)
{
	BmpXInactive = x;
}
int myButton::GetBmpInActX() const
{
	return BmpXInactive;
}
void myButton::SetBmpInActY(int y)
{
	BmpYInactive = y;
}
int myButton::GetBmpInActY() const
{
	return BmpYInactive;
}
void myButton::SetHover(int hoverCount)
{
	HoverCount = hoverCount;
}
int myButton::GetHover() const
{
	return HoverCount;
}