Ejemplo n.º 1
0
void COptionTree::AddToVisibleList(COptionTreeItem *otiItem)
{
	// Declare variables
	COptionTreeItem *otiNext;
	
	// Make sure item is not NULL
	if (!otiItem)
	{
		return;
	}

	// Check for an empty visible list
	if (!m_otiVisibleList)
	{
		m_otiVisibleList = otiItem;
	}
	else
	{
		// -- Add the new item to the end of the list
		otiNext = m_otiVisibleList;
		while (otiNext->GetNextVisible())
		{
			otiNext = otiNext->GetNextVisible();
		}
		otiNext->SetNextVisible(otiItem);
	}

	// Set next visible
	otiItem->SetNextVisible(NULL);
}
Ejemplo n.º 2
0
COptionTreeItem * COptionTree::FocusLast()
{
	// Declare variables
	COptionTreeItem* otiNext;
	COptionTreeItem* otiChange;

	// Set pointers
	otiChange = m_otiFocus;
	otiNext = m_otiVisibleList;

	// Set focu on last
	if (otiNext != NULL)
	{
		while (otiNext->GetNextVisible())
		{
			otiNext = otiNext->GetNextVisible();
		}
		SetFocusedItem(otiNext);

		if (m_otiFocus != NULL)
		{
			SelectItems(NULL, FALSE);
			m_otiFocus->Select();
		}
	}

	// Send notify to user
	if (otiChange != m_otiFocus)
	{
		SendNotify(OT_NOTIFY_SELCHANGE, m_otiFocus);
	}

	return otiNext;
}
Ejemplo n.º 3
0
COptionTreeItem * COptionTree::FocusPrev()
{
	// Declare variables
	COptionTreeItem* otiNext;
	COptionTreeItem* otiChange;

	// Set pointers
	otiChange = m_otiFocus;

	// Get the last visible item
	if (m_otiFocus == NULL)
	{
		otiNext = m_otiVisibleList;
		while (otiNext && otiNext->GetNextVisible())
		{
			otiNext = otiNext->GetNextVisible();
		}
	}
	else
	{
		otiNext = m_otiVisibleList;
		while (otiNext && otiNext->GetNextVisible() != m_otiFocus)
		{
			otiNext = otiNext->GetNextVisible();
		}
	}

	// Set focus items
	if (otiNext)
	{
		SetFocusedItem(otiNext);
	}
	
	// Select items
	if (m_otiFocus != NULL)
	{
		SelectItems(NULL, FALSE);
		m_otiFocus->Select();
	}

	// Send notify to user
	if (otiChange != m_otiFocus)
	{
		SendNotify(OT_NOTIFY_SELCHANGE, m_otiFocus);
	}

	return otiNext;
}
Ejemplo n.º 4
0
BOOL COptionTree::IsItemVisible(COptionTreeItem *otiItem)
{
	// Declare varibles
	COptionTreeItem *otiNext = NULL;
	
	// Make sure item is valid
	if (otiItem == NULL)
	{
		return FALSE;
	}

	// Search fr visible
	for (otiNext = m_otiVisibleList; otiNext; otiNext = otiNext->GetNextVisible())
	{
		if (otiNext == otiItem)
		{
			return TRUE;
		}
	}

	return FALSE;
}
Ejemplo n.º 5
0
COptionTreeItem* COptionTree::FindItem(const POINT& pt)
{
	// Delcare variables
	COptionTreeItem* otiItem;
	CPoint ptPoint = pt;
	CPoint ptLoc;

	// Convert screen to tree coordinates
	ptPoint.y += m_ptOrigin.y;

	// Search the visible list for the item
	for (otiItem = m_otiVisibleList; otiItem; otiItem = otiItem->GetNextVisible())
	{
		// -- Get item location
		ptLoc = otiItem->GetLocation();
		if (ptPoint.y >= ptLoc.y && ptPoint.y < ptLoc.y + otiItem->GetHeight())
		{
			return otiItem;
		}
	}

	return NULL;
}