ui/cocoa/list.m

changeset 1156
cc488843c92b
parent 1057
b0bc313dea43
child 1157
0a9f4d689c12
equal deleted inserted replaced
1155:066fc6df92d1 1156:cc488843c92b
506 - (void)update:(int)row { 506 - (void)update:(int)row {
507 // TODO: check row 507 // TODO: check row
508 508
509 [_sections removeAllObjects]; 509 [_sections removeAllObjects];
510 510
511 CxIterator i = cxListIterator(_sublists); 511 if(_sublists) {
512 int index = 0; 512 CxIterator i = cxListIterator(_sublists);
513 int rownum = 0; 513 int index = 0;
514 cx_foreach(UiSubList *, sl, i) { 514 int rownum = 0;
515 UiSourceListItem *section = [[UiSourceListItem alloc] init:self sublist:sl]; 515 cx_foreach(UiSubList *, sl, i) {
516 section.sublistIndex = index; 516 UiSourceListItem *section = [[UiSourceListItem alloc] init:self sublist:sl];
517 section.rownum = rownum; 517 section.sublistIndex = index;
518 section.sublistStartRow = rownum; 518 section.rownum = rownum;
519 [section update:-1]; 519 section.sublistStartRow = rownum;
520 [_sections addObject:section]; 520 [section update:-1];
521 index++; 521 [_sections addObject:section];
522 rownum += 1 + section.items.count; 522 index++;
523 rownum += 1 + section.items.count;
524 }
525 } else if (_dynamic_sublists) {
526 UiList *sublists = _dynamic_sublists->value;
527 UiSubList *sl = sublists->first(sublists);
528 int index = 0;
529 int rownum = 0;
530 while(sl) {
531 UiSourceListItem *section = [[UiSourceListItem alloc] init:self sublist:sl];
532 section.sublistIndex = index;
533 section.rownum = rownum;
534 section.sublistStartRow = rownum;
535 [section update:-1];
536 [_sections addObject:section];
537 index++;
538 rownum += 1 + section.items.count;
539
540 sl = sublists->next(sublists);
541 }
523 } 542 }
524 543
525 [_outlineView reloadData]; 544 [_outlineView reloadData];
526 [_outlineView expandItem:nil expandChildren:YES]; 545 [_outlineView expandItem:nil expandChildren:YES];
527 } 546 }

mercurial