| 307 | |
| 308 | |
| 309 | void CSearchListCtrl::UpdateItemColor(long index) |
| 310 | { |
| 311 | wxListItem item; |
| 312 | item.SetId( index ); |
| 313 | item.SetColumn( ID_SEARCH_COL_SIZE ); |
| 314 | item.SetMask( |
| 315 | wxLIST_MASK_STATE | |
| 316 | wxLIST_MASK_TEXT | |
| 317 | wxLIST_MASK_IMAGE | |
| 318 | wxLIST_MASK_DATA | |
| 319 | wxLIST_MASK_WIDTH | |
| 320 | wxLIST_MASK_FORMAT); |
| 321 | |
| 322 | if (GetItem(item)) { |
| 323 | CMuleColour newcol(wxSYS_COLOUR_WINDOWTEXT); |
| 324 | |
| 325 | CSearchFile* file = reinterpret_cast<CSearchFile*>(GetItemData(index)); |
| 326 | |
| 327 | int red = newcol.Red(); |
| 328 | int green = newcol.Green(); |
| 329 | int blue = newcol.Blue(); |
| 330 | |
| 331 | switch (file->GetDownloadStatus()) { |
| 332 | case CSearchFile::DOWNLOADED: |
| 333 | // File has already been downloaded. Mark as green. |
| 334 | green = 255; |
| 335 | break; |
| 336 | case CSearchFile::QUEUED: |
| 337 | // File is downloading. |
| 338 | case CSearchFile::QUEUEDCANCELED: |
| 339 | // File is downloading and has been canceled before. |
| 340 | // Mark as red |
| 341 | red = 255; |
| 342 | break; |
| 343 | case CSearchFile::CANCELED: |
| 344 | // File has been canceled. Mark as magenta. |
| 345 | red = 255; |
| 346 | blue = 255; |
| 347 | break; |
| 348 | default: |
| 349 | // File is new, colour after number of files |
| 350 | blue += file->GetSourceCount() * 5; |
| 351 | if ( blue > 255 ) { |
| 352 | blue = 255; |
| 353 | } |
| 354 | } |
| 355 | |
| 356 | // don't forget to set the item data back... |
| 357 | wxListItem newitem; |
| 358 | newitem.SetId( index ); |
| 359 | newitem.SetTextColour( wxColour( red, green, blue ) ); |
| 360 | SetItem( newitem ); |
| 361 | } |
| 362 | } |
| 363 | |
| 364 | |
| 365 | void CSearchListCtrl::ShowResults( wxUIntPtr ResultsID ) |
nothing calls this directly
no test coverage detected