Source\NSToolbarItem.m: Fixed a bug where calling setImage: on a toolbar item would draw the image even if the toolbar display mode would be set to NSToolbarDisplayModeLabelOnly

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@37777 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Frank Le Grand 2014-03-28 17:47:45 +00:00
parent bee13c1d64
commit ff37e4b2e8
3 changed files with 22 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2013-02-18 Frank Le Grand <frank.legrand@testplant.com>
* Source\NSToolbarItem.m: Fixed a bug where calling setImage:
on a toolbar item would draw the image even if the toolbar
display mode would be set to NSToolbarDisplayModeLabelOnly
2013-02-18 Frank Le Grand <frank.legrand@testplant.com>
* Source\NSCollectionView.m: Fixed a potential "index out

View file

@ -304,7 +304,6 @@
{
NSToolbarItem *item = [toolbar _toolbarItemForIdentifier: identifier
willBeInsertedIntoToolbar: NO];
NSLog(@"item %@ for ident %@", item, identifier);
[_allowedItems addObject: item];
}

View file

@ -1331,7 +1331,13 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
[_image setScalesWhenResized: YES];
//[_image setSize: NSMakeSize(32, 32)];
[(GSToolbarButton*)_backView setImage: image];
// Do not set the image on the button if we are in "LabelOnly"
// mode. If the toolbar's displayMode changes later, we'll
// put the image on the button in the layout method.
if ([[self toolbar] displayMode] != NSToolbarDisplayModeLabelOnly)
{
[(GSToolbarButton*)_backView setImage: image];
}
}
- (void) setLabel: (NSString *)label
@ -1497,6 +1503,15 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
- (void) _layout
{
// Reset to image on the backview: We may have toggled
// from one NSToolbarDisplayMode to another, and it is
// possible setImage: would have been called on the
// NSToolbarItem while we were in NSToolbarDisplayModeLabelOnly
if ([[self toolbar] displayMode] != NSToolbarDisplayModeLabelOnly)
{
[(GSToolbarButton*)_backView setImage: _image];
}
[(id)_backView layout];
}