Beispiel #1
0
BOOL duTreeListCtrl::DeleteItemT(TreeListItem *pItem)
{
	if (pItem == NULL)
		return FALSE;

	TreeListItem *pChildItem = pItem->pFirstChild;
	while (pChildItem)
	{
		TreeListItem *pDelItem = pChildItem;
		pChildItem = pChildItem->pNextSibling;
		DeleteItemT(pDelItem);
	}

	if (pItem != &m_RootItem)
	{
		if (m_pSel == pItem->pPlugin)
			m_pSel = NULL;
	
		int nIndex = GetLinePluginIndex(pItem->pPlugin);
		if (nIndex == -1)
		{
			Plugin_Delete(pItem->pPlugin);
		}

		DeleteLine(nIndex, FALSE);
		delete pItem;
	}

	return TRUE;
}
Beispiel #2
0
BOOL WINAPI duListCtrl::DeleteLine(int nIndex, BOOL fAdjust)
{
	int nLineCount = GetLineCount();
	if (nIndex < 0 || nIndex >= nLineCount)
		return FALSE;

	duPlugin *pDelete = m_vtLines[nIndex];
	if (pDelete == NULL)
		return FALSE;

	duRect rcDelete;
	pDelete->GetRect(&rcDelete);

	if (nIndex < m_nFirstLine)
		m_nFLTotalHeight -= rcDelete.Height();

	m_nViewCy -= rcDelete.Height();
	
	vector<duPlugin *>::iterator iterDelete = m_vtLines.begin() + nIndex;
	m_vtLines.erase(iterDelete);
	UpdateScroll();

	if (pDelete == m_pSel)
		m_pSel = NULL;

	if (pDelete == m_pHot)
		m_pHot = NULL;
	
	Plugin_Delete(pDelete);
	CompleteAdjustLine();

	return TRUE;
}