diff --git a/ChangeLog b/ChangeLog index 3be5ce5d3..776cf5d2e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2006-02-03 Quentin Mathe + + * Source/NSToolbarItem.m (-[GSToolbarButtonCell setImagePosition:]): + New method to override NSButtonCell behavior. It should be the last commit + needed to correct bug #15112 (reported by Wolfgang Sourdeau). Precisely it + eliminates the default title set with separator or space toolbar + items and the image release with toolbar items which include one (both + issues occurs when NSToolbarDisplayModeLabelnOnly is set). + 2006-02-03 Quentin Mathe * Source/NSButtonCell.m (-setImagePosition:): Fixed the title lost (reset to diff --git a/Source/NSToolbarItem.m b/Source/NSToolbarItem.m index 551e796f6..ad0168d5b 100644 --- a/Source/NSToolbarItem.m +++ b/Source/NSToolbarItem.m @@ -393,6 +393,25 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType"; @implementation GSToolbarButtonCell +/* Overriden NSButtonCell method to handle cell type in a basic way which avoids + to lose image or empty title on new image position (when this involves a cell + type switch) and the need to reset it. That would happen in GSToolbarButton + -layout method (on toolbar display mode switch). + Note that empty title are used with space or separator toolbar items. */ +- (void) setImagePosition: (NSCellImagePosition)aPosition +{ + _cell.image_position = aPosition; + + if (_cell.image_position == NSNoImage) + { + _cell.type = NSTextCellType; + } + else + { + _cell.type = NSImageCellType; + } +} + // Overriden NSButtonCell method - (void) drawInteriorWithFrame: (NSRect)cellFrame inView: (NSView*)controlView {