mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 18:50:48 +00:00
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:
parent
790c9776ca
commit
2ae529c683
2 changed files with 46 additions and 33 deletions
|
@ -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>
|
2003-05-14 Serg Stoyan <stoyan@on.com.ua>
|
||||||
|
|
||||||
* Source/NSMenuView.m
|
* Source/NSMenuView.m
|
||||||
|
|
|
@ -95,45 +95,53 @@ _new_label (NSString *value)
|
||||||
}
|
}
|
||||||
/* After initialization, its size is the size it needs, just move it
|
/* After initialization, its size is the size it needs, just move it
|
||||||
where we want it to show */
|
where we want it to show */
|
||||||
-initWithStringArray: (NSArray *)array
|
- (id) initWithStringArray: (NSArray *)array
|
||||||
font: (NSFont *)font;
|
font: (NSFont *)font;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation _GSLabelListView
|
@implementation _GSLabelListView
|
||||||
|
|
||||||
-initWithStringArray: (NSArray *)array
|
- (id) initWithStringArray: (NSArray *)array
|
||||||
font: (NSFont *)font
|
font: (NSFont *)font
|
||||||
{
|
{
|
||||||
int count;
|
|
||||||
NSTextField *field;
|
|
||||||
int i;
|
|
||||||
float height = 2;
|
|
||||||
float width = 0;
|
|
||||||
NSRect r;
|
|
||||||
|
|
||||||
self = [super init];
|
self = [super init];
|
||||||
|
if (self != nil)
|
||||||
count = [array count];
|
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
|
||||||
{
|
{
|
||||||
if ([[array objectAtIndex: i] isKindOfClass: [NSString class]] == NO)
|
unsigned int count;
|
||||||
continue;
|
NSTextField *field;
|
||||||
field = _new_label ([array objectAtIndex: i]);
|
float height = 2;
|
||||||
[field setFont: font];
|
float width = 0;
|
||||||
[field sizeToFit];
|
NSRect r;
|
||||||
[field setAutoresizingMask: NSViewNotSizable];
|
|
||||||
r = [field frame];
|
count = [array count];
|
||||||
r.origin.x = 0;
|
/*
|
||||||
r.origin.y = height;
|
* We go through the array in reverse order, adding items from
|
||||||
if (r.size.width > width)
|
* the bottom of the view working upwards. This means that the
|
||||||
width = r.size.width;
|
* order of strings in the array will appear orderd from top to
|
||||||
height += r.size.height + 2;
|
* bottom in the view.
|
||||||
[field setFrame: r];
|
*/
|
||||||
[self setFrameSize: NSMakeSize (width, height)];
|
while (count-- > 0)
|
||||||
[self addSubview: field];
|
{
|
||||||
|
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;
|
return self;
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
@ -369,8 +377,8 @@ _new_label (NSString *value)
|
||||||
[authorTitleLabel setFont: smallFont];
|
[authorTitleLabel setFont: smallFont];
|
||||||
[authorTitleLabel sizeToFit];
|
[authorTitleLabel sizeToFit];
|
||||||
|
|
||||||
authorsList = AUTORELEASE([[_GSLabelListView alloc] initWithStringArray: authors
|
authorsList = AUTORELEASE([[_GSLabelListView alloc]
|
||||||
font: smallFont]);
|
initWithStringArray: authors font: smallFont]);
|
||||||
|
|
||||||
if (url)
|
if (url)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue