comparison mac/dw.m @ 1963:80f6be39b7fe

Mac: Miscellaneous container/listox fixes. Add a single pixel to the column width during optimization, to prevent cases of abbreviating the column. During _cont_new() which is used by both containers and listboxes force the striping to be disabled initially. Automatically optimize the column sizes of listboxes when adding or deleting contents.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Fri, 26 Jul 2019 23:20:54 +0000
parents 9ac432c8620c
children 6315f668f5f6
comparison
equal deleted inserted replaced
1962:50c71474709b 1963:80f6be39b7fe
2616 width = 16; 2616 width = 16;
2617 } 2617 }
2618 /* Sanity check... don't set the width to 0 */ 2618 /* Sanity check... don't set the width to 0 */
2619 if(width) 2619 if(width)
2620 { 2620 {
2621 [column setWidth:width]; 2621 [column setWidth:width+1];
2622 } 2622 }
2623 } 2623 }
2624 else 2624 else
2625 { 2625 {
2626 [column sizeToFit]; 2626 if(self.headerView)
2627 [column sizeToFit];
2627 } 2628 }
2628 } 2629 }
2629 } 2630 }
2630 } 2631 }
2631 } 2632 }
5354 [cont setDataSource:cont]; 5355 [cont setDataSource:cont];
5355 [cont setDelegate:cont]; 5356 [cont setDelegate:cont];
5356 [scrollview setDocumentView:cont]; 5357 [scrollview setDocumentView:cont];
5357 [cont setTag:cid]; 5358 [cont setTag:cid];
5358 [cont autorelease]; 5359 [cont autorelease];
5360 [cont setRowBgOdd:DW_RGB_TRANSPARENT andEven:DW_RGB_TRANSPARENT];
5359 return cont; 5361 return cont;
5360 } 5362 }
5361 5363
5362 /* 5364 /*
5363 * Create a new listbox window (widget) to be packed. 5365 * Create a new listbox window (widget) to be packed.
5407 DWContainer *cont = handle; 5409 DWContainer *cont = handle;
5408 NSString *nstr = [ NSString stringWithUTF8String:text ]; 5410 NSString *nstr = [ NSString stringWithUTF8String:text ];
5409 NSArray *newrow = [NSArray arrayWithObject:nstr]; 5411 NSArray *newrow = [NSArray arrayWithObject:nstr];
5410 5412
5411 [cont addRow:newrow]; 5413 [cont addRow:newrow];
5412 /*[cont performSelectorOnMainThread:@selector(addRow:)
5413 withObject:newrow
5414 waitUntilDone:YES];*/
5415 [cont reloadData]; 5414 [cont reloadData];
5415 [cont optimize];
5416 [cont setNeedsDisplay:YES]; 5416 [cont setNeedsDisplay:YES];
5417 } 5417 }
5418 DW_FUNCTION_RETURN_NOTHING; 5418 DW_FUNCTION_RETURN_NOTHING;
5419 } 5419 }
5420 5420
5445 NSString *nstr = [ NSString stringWithUTF8String:text ]; 5445 NSString *nstr = [ NSString stringWithUTF8String:text ];
5446 NSArray *newrow = [NSArray arrayWithObject:nstr]; 5446 NSArray *newrow = [NSArray arrayWithObject:nstr];
5447 5447
5448 [cont insertRow:newrow at:pos]; 5448 [cont insertRow:newrow at:pos];
5449 [cont reloadData]; 5449 [cont reloadData];
5450 [cont optimize];
5450 [cont setNeedsDisplay:YES]; 5451 [cont setNeedsDisplay:YES];
5451 } 5452 }
5452 DW_FUNCTION_RETURN_NOTHING; 5453 DW_FUNCTION_RETURN_NOTHING;
5453 } 5454 }
5454 5455
5488 NSArray *newrow = [NSArray arrayWithObjects:nstr,nil]; 5489 NSArray *newrow = [NSArray arrayWithObjects:nstr,nil];
5489 5490
5490 [cont addRow:newrow]; 5491 [cont addRow:newrow];
5491 } 5492 }
5492 [cont reloadData]; 5493 [cont reloadData];
5494 [cont optimize];
5493 [cont setNeedsDisplay:YES]; 5495 [cont setNeedsDisplay:YES];
5494 } 5496 }
5495 DW_FUNCTION_RETURN_NOTHING; 5497 DW_FUNCTION_RETURN_NOTHING;
5496 } 5498 }
5497 5499
5667 { 5669 {
5668 NSString *nstr = [ NSString stringWithUTF8String:buffer ]; 5670 NSString *nstr = [ NSString stringWithUTF8String:buffer ];
5669 5671
5670 [cont editCell:nstr at:index and:0]; 5672 [cont editCell:nstr at:index and:0];
5671 [cont reloadData]; 5673 [cont reloadData];
5674 [cont optimize];
5672 [cont setNeedsDisplay:YES]; 5675 [cont setNeedsDisplay:YES];
5673 } 5676 }
5674 } 5677 }
5675 DW_FUNCTION_RETURN_NOTHING; 5678 DW_FUNCTION_RETURN_NOTHING;
5676 } 5679 }