Draw authors in correct order

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@16733 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2003-05-16 09:14:52 +00:00
parent 058f678e37
commit 9dce871b41
2 changed files with 46 additions and 33 deletions

View file

@ -1,3 +1,8 @@
2003-05-15 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSInfoPanel.m: Draw authors in the order they occur in
the info.plist
2003-05-14 Serg Stoyan <stoyan@on.com.ua>
* Source/NSMenuView.m

View file

@ -95,45 +95,53 @@ _new_label (NSString *value)
}
/* After initialization, its size is the size it needs, just move it
where we want it to show */
-initWithStringArray: (NSArray *)array
font: (NSFont *)font;
- (id) initWithStringArray: (NSArray *)array
font: (NSFont *)font;
@end
@implementation _GSLabelListView
-initWithStringArray: (NSArray *)array
font: (NSFont *)font
- (id) initWithStringArray: (NSArray *)array
font: (NSFont *)font
{
int count;
NSTextField *field;
int i;
float height = 2;
float width = 0;
NSRect r;
self = [super init];
count = [array count];
for (i = 0; i < count; i++)
if (self != nil)
{
if ([[array objectAtIndex: i] isKindOfClass: [NSString class]] == NO)
continue;
field = _new_label ([array objectAtIndex: i]);
[field setFont: font];
[field sizeToFit];
[field setAutoresizingMask: NSViewNotSizable];
r = [field frame];
r.origin.x = 0;
r.origin.y = height;
if (r.size.width > width)
width = r.size.width;
height += r.size.height + 2;
[field setFrame: r];
[self setFrameSize: NSMakeSize (width, height)];
[self addSubview: field];
unsigned int count;
NSTextField *field;
float height = 2;
float width = 0;
NSRect r;
count = [array count];
/*
* We go through the array in reverse order, adding items from
* the bottom of the view working upwards. This means that the
* order of strings in the array will appear orderd from top to
* bottom in the view.
*/
while (count-- > 0)
{
id item = [array objectAtIndex: count];
if ([item isKindOfClass: [NSString class]] == NO)
continue;
field = _new_label (item);
[field setFont: font];
[field sizeToFit];
[field setAutoresizingMask: NSViewNotSizable];
r = [field frame];
r.origin.x = 0;
r.origin.y = height;
if (r.size.width > width)
width = r.size.width;
height += r.size.height + 2;
[field setFrame: r];
[self setFrameSize: NSMakeSize (width, height)];
[self addSubview: field];
}
[self setFrameSize: NSMakeSize (width, height - 2)];
}
[self setFrameSize: NSMakeSize (width, height - 2)];
return self;
}
@end
@ -369,8 +377,8 @@ _new_label (NSString *value)
[authorTitleLabel setFont: smallFont];
[authorTitleLabel sizeToFit];
authorsList = AUTORELEASE([[_GSLabelListView alloc] initWithStringArray: authors
font: smallFont]);
authorsList = AUTORELEASE([[_GSLabelListView alloc]
initWithStringArray: authors font: smallFont]);
if (url)
{