Example #1
0
ALERROR AGScreen::AddArea (AGArea *pArea, const RECT &rcRect, DWORD dwTag)

//	AddArea
//
//	Add an area to the screen

	{
	ALERROR error;

	//	Initialize the area

	if (error = pArea->Init(this, this, rcRect, dwTag))
		return error;

	//	Add the area

	if (error = m_Areas.AppendObject(pArea, NULL))
		return error;

	//	Get the mouse position and fire mouse move, if appropriate

	POINT pt;
	GetMousePos(&pt);

	if (HitTest(pt) == pArea)
		SetMouseOver(pArea);

	return NOERROR;
	}
Example #2
0
/*------------------------------------------------------------------*
 * MODIFICATIONS													*
 *	Date		Description							Author			*
 * ===========	==================================	===============	*
 *																	*
 *------------------------------------------------------------------*/
void ZURLLabel::mouseMoveEvent(QMouseEvent *pEvt)
{
	static bool bInside = false;

	/*
	 * Check to see if the mouse is inside the hitbox.  The hitbox
	 * is a rectangle calculated to be roughly the size of the text.
	 */
	if (mHitBox.contains(pEvt->pos()))
	{
		if (bInside == false)
		{
			bInside = true;
			SetMouseOver();
		}
	}
	else
	{
		if (bInside == true)
		{
			bInside = false;
			SetMouseOut();
		}
	}
}
Example #3
0
bool CText::MouseMove( CMouse * pMouse, bool )
{
	CPos Pos = *GetRelPos();
	if(GetParent()) Pos = *GetParent()->GetAbsPos() + Pos;

	SetElementState( SetMouseOver( pMouse->InArea( Pos.GetX(), Pos.GetY(), GetFont()->GetStringWidth( GetFormatted().c_str() ), GetFont()->GetStringHeight() ) )?_UI("MouseOver"):_UI("Norm") );
	return 0;
}
void Widget::Update(long time)
{
	lastMouseState=mouseState;

	if (isMouseOver(inputSystem->MouseX(), inputSystem->MouseY()))
		if (inputSystem->MouseButtonPressed(0))
			SetMousePressed();
		else
			SetMouseOver();
	else
		SetMouseNotOver();
}
Example #5
0
void AGScreen::FireMouseMove (const POINT &pt)

//	FireMouseMove
//
//	Fires MouseEnter, MouseMove, and MouseLeave events

	{
	if (m_pMouseCapture)
		{
		//	Check to see if we've entered the area

		if (::PtInRect(&m_pMouseCapture->GetRect(), pt))
			SetMouseOver(m_pMouseCapture);
		else
			SetMouseOver(NULL);

		m_pMouseCapture->MouseMove(pt.x, pt.y);
		}
	else
		{
		//	Are we still over the same area?

		if (m_pMouseOver && ::PtInRect(&m_pMouseOver->GetRect(), pt))
			m_pMouseOver->MouseMove(pt.x, pt.y);

		//	If not, find out what area we're over

		else
			{
			AGArea *pNewMouseOver = HitTest(pt);
			SetMouseOver(pNewMouseOver);

			if (m_pMouseOver)
				m_pMouseOver->MouseMove(pt.x, pt.y);
			}
		}
	}