| 280 | } |
| 281 | |
| 282 | int InsertItem(int nItem, HPROPERTY hProp) |
| 283 | { |
| 284 | // NOTE: This is the only InsertItem() we support... |
| 285 | ATLASSERT(::IsWindow(m_hWnd)); |
| 286 | ATLASSERT(hProp); |
| 287 | // You must have initialized columns before calling this! |
| 288 | // And you are not allowed to add columns once the list is populated! |
| 289 | if( m_nColumns == 0 ) m_nColumns = m_ctrlHeader.GetItemCount(); |
| 290 | ATLASSERT(m_nColumns>0); |
| 291 | ATLASSERT(m_ctrlHeader.GetItemCount()==m_nColumns); |
| 292 | // Create a place-holder for all sub-items |
| 293 | IProperty** props = NULL; |
| 294 | ATLTRY( props = new IProperty*[m_nColumns] ); |
| 295 | ATLASSERT(props); |
| 296 | if( props == NULL ) return -1; |
| 297 | ::ZeroMemory(props, sizeof(IProperty*) * m_nColumns); |
| 298 | props[0] = hProp; |
| 299 | // Finally create the listview item itself... |
| 300 | if( nItem < 0 || nItem > GetItemCount() ) nItem = GetItemCount(); |
| 301 | UINT mask = LVIF_TEXT | LVIF_PARAM; |
| 302 | int iItem = TBase::InsertItem(mask, nItem, hProp->GetName(), 0, 0, 0, (LPARAM) props); |
| 303 | if( iItem != -1 ) hProp->SetOwner(m_hWnd, NULL); |
| 304 | return iItem; |
| 305 | } |
| 306 | |
| 307 | BOOL SetSubItem(int nItem, int nSubItem, HPROPERTY hProp) |
| 308 | { |
no test coverage detected