void CFileBrowserListCtrl::SetFolder(LPCTSTR Path)
{
	if (!Path[0] || !m_DirList.List(Path, &m_FiltExt))
		m_DirList.ListDrives();
	if (m_SortCol >= 0)
		m_DirList.Sort(m_SortCol, m_SortDir);
	if (m_ViewType == VTP_SMALLICON || m_ViewType == VTP_LIST)
		SetColumnWidth(0, CalcMinColumnWidth(0));	// order matters
	int	items = m_DirList.GetCount();
	SetItemCountEx(0);	// delete item states
	SetItemCountEx(items);
	m_CachedItemIdx = -1;	// invalidate cached file info
}
Exemple #2
0
void CLiveListCtrl::Apply()
{
	// Remove old items
	for ( CLiveMap::iterator i = m_pItems.begin() ; i != m_pItems.end() ; )
	{
		CLiveItemPtr pItem = (*i).second;
		if ( pItem->m_bOld )
		{
			delete pItem;
			i = m_pItems.erase( i );
		}
		else
		{
			++i;
		}
	}

	// Recreate index
	m_pIndex.clear();
	m_pIndex.reserve( m_pItems.size() );
	for ( CLiveMap::iterator i = m_pItems.begin() ; i != m_pItems.end() ; ++i )
	{
		CLiveItemPtr pItem = (*i).second;
		pItem->m_bOld = true;

		m_pIndex.push_back( pItem );
	}

	// Tune virtual list
	SetItemCountEx( (int)m_pItems.size() );

	Sort();
}
void CGitProgressList::AddItemToList()
{
	int totalcount = GetItemCount();

	SetItemCountEx(totalcount+1, LVSICF_NOSCROLL|LVSICF_NOINVALIDATEALL);
	// make columns width fit
	if (iFirstResized < 30)
	{
		// only resize the columns for the first 30 or so entries.
		// after that, don't resize them anymore because that's an
		// expensive function call and the columns will be sized
		// close enough already.
		ResizeColumns();
		++iFirstResized;
	}

	// Make sure the item is *entirely* visible even if the horizontal
	// scroll bar is visible.
	int count = GetCountPerPage();
	if (totalcount <= (GetTopIndex() + count + nEnsureVisibleCount + 2))
	{
		++nEnsureVisibleCount;
		m_bLastVisible = true;
	}
	else
	{
		nEnsureVisibleCount = 0;
		if (IsIconic() == 0)
			m_bLastVisible = false;
	}
}
   /// <summary>Initialises control and populates</summary>
   /// <param name="lpCreateStruct">The create structure.</param>
   /// <returns></returns>
   int SuggestionList::OnCreate(LPCREATESTRUCT lpCreateStruct)
   {
      try
      {
         if (__super::OnCreate(lpCreateStruct) == -1)
            throw Win32Exception(HERE, L"Unable to create base ListView");
      
         // Display items using a single column. Custom Draw handles the column illusion
         InsertColumn(0, L"text");
         SetColumnWidth(0, lpCreateStruct->cx);
         SetExtendedStyle(LVS_EX_FULLROWSELECT);

         // Populate
         PopulateContent();

         // Ensure we have content
         if (Content.size() == 0)
            throw AlgorithmException(HERE, L"Unable to create list of zero suggestions");

         // Display contents
         SetItemCountEx(Content.size());
         SetItemState(0, LVIS_SELECTED, LVIS_SELECTED);

         // Shrink to fit
         ShrinkToFit();
         OnVisibleItemsChanged();
         return 0;
      }
      catch (ExceptionBase& e)
      {
         Console.Log(HERE, e);
         return -1;
      }
   }
Exemple #5
0
void CTorrents_Tasks::AddDownload(vmsDownloadSmartPtr dld, BOOL bPlaceToTop)
{
	if (bPlaceToTop)
		m_vDlds.insert (m_vDlds.begin (), dld);
	else
		m_vDlds.push_back (dld);
	VirtualView_ItemWillBeAdded (GetSysColor (COLOR_WINDOW), GetSysColor (COLOR_WINDOWTEXT), bPlaceToTop);
	SetItemCountEx (m_vDlds.size (), LVSICF_NOINVALIDATEALL | LVSICF_NOSCROLL);
}
void CFileBrowserListCtrl::SetViewType(int Type)
{
	if (Type == m_ViewType)
		return;	// nothing to do
	m_ViewType = Type;	// order matters
	DWORD	Style;
	CImageList	*ImgList;
	Style = Type;
	ImgList = &m_FileInfoCache.GetImageList(ICON_BIG);
	SetImageList(ImgList, LVSIL_NORMAL);
	ModifyStyle(LVS_TYPEMASK, Style);
	// must set column width AFTER modifying style
	if (Type == VTP_SMALLICON || Type == VTP_LIST)
		SetColumnWidth(0, CalcMinColumnWidth(0));
	// 25feb09: must reset item count, else scroll bar doesn't always update
	SetItemCountEx(m_DirList.GetCount());
}
void CGitProgressList::OnHdnItemclickSvnprogress(NMHDR *pNMHDR, LRESULT *pResult)
{
	LPNMHEADER phdr = reinterpret_cast<LPNMHEADER>(pNMHDR);
	if (m_bThreadRunning)
		return;
	if (m_nSortedColumn == phdr->iItem)
		m_bAscending = !m_bAscending;
	else
		m_bAscending = TRUE;
	m_nSortedColumn = phdr->iItem;
	Sort();

	CString temp;
	SetRedraw(FALSE);
	DeleteAllItems();
	SetItemCountEx (static_cast<int>(m_arData.size()));

	SetRedraw(TRUE);

	*pResult = 0;
}
void SmartListCtrl::changeItemCount( int numItems )
{
	// flag to avoid sending callback messages when manually selecting items
	bool oldIgnore = ignoreSelMessages_;
	ignoreSelMessages_ = true;
	
	// deselect all
	SetItemState( -1, 0, LVIS_SELECTED );

	// change item count
	int numCustomItems = 0;
	if ( customItems_ )
		numCustomItems = customItems_->size();
	SetItemCountEx( numItems + numCustomItems, LVSICF_NOSCROLL );

	// restore selected items
	if ( provider_ )
	{
		clock_t start = clock();
		for( SelectedItemItr s = selItems_.begin();
			s != selItems_.end() && ((clock()-start)*1000/CLOCKS_PER_SEC) < maxSelUpdateMsec_;
			++s )
		{
			for( int item = 0;
				item < numItems && ((clock()-start)*1000/CLOCKS_PER_SEC) < maxSelUpdateMsec_;
				++item )
			{
				if ( (*s).equalTo( provider_->getAssetInfo( item ) ) )
				{
					SetItemState( item, LVIS_SELECTED, LVIS_SELECTED );
					break;
				}
			}
		}
	}
	ignoreSelMessages_ = oldIgnore;
}