Modified NSToolbarItem to correctly init separator items and use the right item width in NSToolbarDisplayModeIconOnly (Fixes for bug #15112)

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@22169 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Quentin Mathe 2005-12-15 16:59:29 +00:00
parent a2e2bb6167
commit 671bf31202
2 changed files with 16 additions and 3 deletions

View file

@ -1,3 +1,16 @@
2005-12-15 Quentin Mathe <qmathe@club-internet.fr>
* Source/NSToolbarItem.m:
(-[GSToolbarButton layout]): Don't set button based items width to their
label width when NSToolbarDisplayModeIconOnly is active (based on patch
by Wolfgang Sourdeau, partial fix for bug #15112). Removed superfuous code
which substracted label height to button width in
NSToolbarDisplayModeIconOnly case.
(-initWithItemIdentifier:): Removed logical operator 'not' wrongly used
with GSToolbarSeparatorItemIdentifier class identity test, it
prevented any separator items to be inited therefore used (patch by
Wolfgang Sourdeau, partial fix for bug #15112).
2005-12-05 fabien <fabien@sonappart.net>
* Source/NSCursor.m: Improved documentation

View file

@ -236,7 +236,8 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
attrStr = [[NSAttributedString alloc] initWithString: label attributes: attr];
textWidth = [attrStr size].width + 2 * InsetItemTextX;
if (layoutedWidth != -1 && textWidth > layoutedWidth)
if ([[_toolbarItem toolbar] displayMode] != NSToolbarDisplayModeIconOnly
&& layoutedWidth != -1 && textWidth > layoutedWidth)
layoutedWidth = textWidth;
// Adjust the layout in accordance with NSToolbarDisplayMode
@ -252,7 +253,6 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
case NSToolbarDisplayModeIconOnly:
[self setImagePosition: NSImageOnly];
layoutedHeight -= [attrStr size].height + InsetItemTextY;
layoutedWidth -= [attrStr size].height + InsetItemTextY;
break;
case NSToolbarDisplayModeLabelOnly:
[self setImagePosition: NSNoImage];
@ -1019,7 +1019,7 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
// GNUstep predefined toolbar items
if ([itemIdentifier isEqualToString: @"NSToolbarSeparatorItemIdentifier"]
&& ![self isKindOfClass:[GSToolbarSeparatorItem class]] == NO)
&& [self isKindOfClass:[GSToolbarSeparatorItem class]] == NO)
{
[self release];
self = [[GSToolbarSeparatorItem alloc]