Example #1
0
void CNBListViewCtrl::AddDiskObject(CNBUnitDevice *o)
{
	LVITEM lvItem = { 0 };
	WTL::CString strName = o->GetName();

	lvItem.mask		= LVIF_TEXT | LVIF_PARAM;
	lvItem.iItem	= GetItemCount();
	lvItem.pszText	= strName.LockBuffer();
	lvItem.lParam	= (LPARAM)o;
	CListViewCtrl::InsertItem( &lvItem );
	CListViewCtrl::SetItemText(lvItem.iItem, 1, o->GetCapacityString());
}
Example #2
0
void CNBListViewCtrl::AddDiskObject(CDiskObjectPtr o)
{
	LVITEM lvItem = { 0 };
	const CObjectUIHandler *pHandler = CObjectUIHandler::GetUIHandler(o);
	WTL::CString strName = pHandler->GetTitle(o);
	WTL::CString strCapacity;

	strCapacity.FormatMessage( 
		IDS_DISKPROPERTYPAGE_SIZE_IN_GB,
		pHandler->GetSizeInMB( o ) / 1024,
		(pHandler->GetSizeInMB( o ) % 1024) / 10 
		);

	lvItem.mask		= LVIF_TEXT | LVIF_PARAM;
	lvItem.iItem	= GetItemCount();
	lvItem.pszText	= strName.LockBuffer(); //LPSTR_TEXTCALLBACK;
	lvItem.lParam	= static_cast<LPARAM>(o->GetUniqueID());
	CListViewCtrl::InsertItem( &lvItem );
	CListViewCtrl::SetItemText(lvItem.iItem, 1, strCapacity.LockBuffer() );
	m_mapObject[o->GetUniqueID()] = o;
}
Example #3
0
BOOL CNBTreeListView::Initialize()
{
	// Initialize Column
	HDITEM col = { 0 };
	col.mask = HDI_FORMAT | HDI_TEXT | HDI_WIDTH;
	col.fmt = HDF_LEFT;

//	SetExtendedListViewStyle ( LVS_EX_FULLROWSELECT);

	int i = 0;
	WTL::CString strHeader;

	for ( i=0; i < countof(column_info); i++ )
	{
		strHeader.LoadString( column_info[i].nColHeaderID );
		col.cxy = column_info[i].nWidth;
		col.pszText = strHeader.LockBuffer();
		GetHeaderControl().InsertItem(i, &col);
	}


	// Image List
	CImageList imageList;
	//	imageList.Create(64, 32, ILC_COLOR8|ILC_MASK, sizeof(anIconIDs)/sizeof(anIconIDs[0]), 1);
	imageList.Create(32, 32, ILC_COLOR8|ILC_MASK, sizeof(anIconIDs)/sizeof(anIconIDs[0]), 1);
	for ( int i=0; i < sizeof(anIconIDs)/sizeof(anIconIDs[0]); i++ )
	{
		HICON hIcon = ::LoadIcon(_Module.GetResourceInstance(), MAKEINTRESOURCE(anIconIDs[i]) );
		// Uncomment this if you want 32x32 icon.
		// HICON hIcon = (HICON)::LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(anIconIDs[i]), IMAGE_ICON, 32, 32, LR_DEFAULTCOLOR);
		imageList.AddIcon( hIcon );
	}

	GetTreeControl().SetImageList( imageList, LVSIL_NORMAL);

	return TRUE;
}