コード例 #1
0
bool CGSelectorArea::LButtonDown (int x, int y)

//	LButtonDown
//
//	Handle mouse button

	{
	int i;

	//	All coordinates are relative to the center of the area.

	const RECT &rcRect = GetRect();
	int xCenter = rcRect.left + (RectWidth(rcRect) / 2);
	int yCenter = rcRect.top + RectHeight(rcRect) / 2;

	//	See if we've clicked on something

	for (i = 0; i < m_Regions.GetCount(); i++)
		{
		const SEntry &Entry = m_Regions[i];

		//	Convert the rect to destination coordinates

		RECT rcRegion;
		CalcRegionRect(Entry, xCenter, yCenter, &rcRegion);

		//	If we clicked in the region, signal an action

		if (x >= rcRegion.left && x < rcRegion.right
				&& y >= rcRegion.top && y < rcRegion.bottom)
			SignalAction(i);
		}

	return false;
	}
コード例 #2
0
ファイル: CGButtonArea.cpp プロジェクト: bmer/Alchemy
void CGButtonArea::LButtonUp (int x, int y)

//	LButtonUp
//
//	Mouse button up

	{
	if (m_bMouseOver && !m_bDisabled && IsVisible())
		SignalAction();
	}
コード例 #3
0
bool CGItemListArea::LButtonDown (int x, int y)

//	LButtonDown
//
//	Handle button down

	{
	if (m_iOldCursor != -1 && m_pListData->GetCount())
		{
		//	Figure out the cursor position that the user clicked on

		int iPos = FindRow((y - GetRect().top) - m_yFirst);
		if (iPos >= 0 && iPos < m_pListData->GetCount())
			SignalAction(iPos);

		return true;
		}

	return false;
	}