Пример #1
0
void CProductCheckListBox::DisableLicensedItems(void)
{
	int nCount = GetCount();
	
	if (nCount != LB_ERR)
	{
		for (int nIndex = 0; nIndex < nCount; nIndex++)
		{
			CProductCheckListBoxItem* pListBoxItem = GetListBoxItem(nIndex);
			
			if (pListBoxItem != NULL)
			{
				BOOL fLicensed = pListBoxItem->Item()->IsLicensed();
				
				DisableItem(pListBoxItem, nIndex, fLicensed);
				
				if (fLicensed)
				{
					MarkItem(pListBoxItem, nIndex, TRUE);
					SelectItem(pListBoxItem, nIndex, FALSE);
				}
			}
		}
	}
}
Пример #2
0
void CCheckListBox::AdjustChildren(int nIndex)
{
	CCheckListBoxItem* pListBoxItem = GetListBoxItem(nIndex);
	
	if (pListBoxItem != NULL)
	{
		BOOL fMark = pListBoxItem->Mark();
		
		int nCount = GetCount();
			
		if (nCount != LB_ERR)
		{
			for (int nChildIndex = nIndex+1; nChildIndex < nCount; nChildIndex++)
			{
				CCheckListBoxItem* pChildListBoxItem = GetListBoxItem(nChildIndex);
				
				if (pChildListBoxItem != NULL)
				{
					if (pChildListBoxItem->Indent() <= pListBoxItem->Indent())
					{
						break;
					}
					
					if (pChildListBoxItem->Indent() > pListBoxItem->Indent())
					{
						if (!pChildListBoxItem->Disable())
						{
							MarkItem(pChildListBoxItem, nChildIndex, fMark);
						}
					}
				}
			}
		}
	}
}
Пример #3
0
void cMenuFileBrowserBase::ReMarkItems()
{
    for (int i = 0; i < Count(); i++)
    {
        cMenuBrowserItem *item = GetItem(i);
        if(markedEntries_.find(item->GetId()) != markedEntries_.end())
        {
            MarkItem(item);
        }
    }
}
Пример #4
0
void cMenuFileBrowserBase::MarkAllNonTaggedOrFlaggedFiles(bool onlyXinePlayable)
{
   for (int i = 0; i < Count(); i++)
    {
        cMenuBrowserItem *item = GetItem(i);
        if(item->IsFile() && !IsFlagged(item) && !IsTagged(item) &&
	(!onlyXinePlayable || static_cast<cMenuFileItem *>(item)->IsXinePlayable()))
        {
            MarkItem(item, false);
        }
    } 
} 
Пример #5
0
void cMenuFileBrowserBase::MarkAllFiles(bool onlyXinePlayable)
{
    cMenuBrowserItem* item;
    for (int i= 0; i < Count(); i++)
    {
        item = GetItem(i);
        SetCurrent(Get(i));
        if(item->IsFile() && !IsMarked(item) && 
	(!onlyXinePlayable || static_cast<cMenuFileItem *>(item)->IsXinePlayable()))
        {
            MarkItem(item);
        }
    }
}
Пример #6
0
BOOL CCheckListBox::AdjustParents(int nIndex /*=0*/)
{
	BOOL fResult = FALSE;
	
	int nCount = GetCount();
	
	if ((nCount > 0) && (nCount != LB_ERR))
	{
		CCheckListBoxItem* pListBoxItem = GetListBoxItem(nIndex);
		
		if (pListBoxItem != NULL)
		{
			fResult = pListBoxItem->Mark();
			
			BOOL fSeenChild = FALSE;
		
			for (int nChildIndex = nIndex+1; nChildIndex < nCount; nChildIndex++)
			{
				CCheckListBoxItem* pChildListBoxItem = GetListBoxItem(nChildIndex);
				
				if (pChildListBoxItem != NULL)
				{
					if (pChildListBoxItem->Indent() <= pListBoxItem->Indent())
					{
						break;
					}
					
					if (!fSeenChild)
					{
						fResult = TRUE;
						fSeenChild = TRUE;
					}
						
					if (pChildListBoxItem->Indent() == pListBoxItem->Indent()+1)
					{
						fResult &= AdjustParents(nChildIndex);
					}
				}
			}
			
			if ((!fResult) || ((m_dwStyle & CHECK_LIST_BOX_DisableAutoMarkParent) == 0))
			{
				MarkItem(pListBoxItem, nIndex, fResult);
			}
		}
	}
	
	return fResult;
}
Пример #7
0
void COrderListBox::AdjustFree(void)
{
	int nCount;
	int nIndex;
	
	// Check if an item is marked that costs money... Only then do
	// we shower the user with free item(s)!
	
	BOOL fNonFreeMarked = FALSE;
	
	nCount = GetCount();

	if (nCount != LB_ERR)
	{
		for (nIndex = 0; nIndex < nCount; nIndex++)
		{
			CProductCheckListBoxItem* pListBoxItem = GetListBoxItem(nIndex);
			
			if ((pListBoxItem != NULL) && (pListBoxItem->Mark()))
			{
				CProductItem* pItem = pListBoxItem->Item();

				if ((pItem != NULL) && ((!(pItem->TestFlag(PRODUCT_ITEM_Free)))))
				{
					fNonFreeMarked = TRUE;
					break;
				}
			}
		}
		
		// Go through and mark or clear all the free items.
			
		for (nIndex = 0; nIndex < nCount; nIndex++)
		{
			CProductCheckListBoxItem* pListBoxItem = GetListBoxItem(nIndex);
				
			if (pListBoxItem != NULL)
			{
				CProductItem* pItem = pListBoxItem->Item();
	
				if ((pItem != NULL) && (pItem->TestFlag(PRODUCT_ITEM_Free)))
				{
					MarkItem(pListBoxItem, nIndex, fNonFreeMarked);
				}
			}
		}
	}
}
Пример #8
0
void cMenuFileBrowserBase::MarkUnmarkCurrentItem()
{
    cMenuBrowserItem *item = GetCurrentItem();
    if (item && (item->IsFile() || item->IsDir()))
    {
        if(!IsMarked(GetCurrentItem()))
        {
            //select line
            MarkItem(GetCurrentItem());
        }
        else
        {
            //deselect line
            RemoveMark(GetCurrentItem());
        }
        Display();
     }
}
Пример #9
0
BOOL CCheckListBox::Select(int nIndex, BOOL fMark, BOOL fDragging)
{
	CCheckListBoxItem* pListBoxItem = GetListBoxItem(nIndex);
	
	if (pListBoxItem != NULL)
	{
		if (!pListBoxItem->Disable())
		{
			if (pListBoxItem->Mark() != fMark)
			{
				MarkItem(pListBoxItem, nIndex, fMark);
				AdjustChildren(nIndex);
				AdjustFree();
				AdjustParents();
				AdjustSelections();
			}
		}
	}
	return TRUE;
}
Пример #10
0
void COrderListBox::UpdateMarkedItems(void)
{
	int nCount = GetCount();

	if (nCount != LB_ERR)
	{
		for (int nIndex = 0; nIndex < nCount; nIndex++)
		{
			CProductCheckListBoxItem* pChild = GetListBoxItem(nIndex);

			if (!pChild->Disable())
			{
				CProductItem* pItem = pChild->Item();

				MarkItem(pChild, nIndex, pItem->TestFlag(PRODUCT_ITEM_Marked));
			}
		}

		AdjustFree();
		AdjustParents();
		AdjustSelections();
	}
}