diff --git a/ChangeLog b/ChangeLog index 635313cb8..199b9a61a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,12 +10,17 @@ popupbuttons.app in core/Testing to see. * Source/NSPopUpButtonCell.m: modifications to make NSPopUpButton work. Also implemented representedObject as I think it should be. + Also made popupbutton arrow image work for popups that use images. * Source/NSTableColumn.m: fixes to make some things work a little better. * Source/NSTableView.m: fixes to make things behave. Still doesn't compile in, but it is getting there. Modifications will have to be made to NSScrollView before we can use this class. * Source/NSTabView.m: fixed (- contentRect) for the no tabs case. + + * Images/: added common_UpAndDownArrowSmall.tiff and + common_DownArrowSmall.tiff for popupbuttons with images in them. + * Headers/NSMenu.h: mods for changes. * Headers/NSPopUpButton.h: ditto. * Headers/NSPopUpButtonCell.h: ditto, also changed to inherit from diff --git a/Images/GNUmakefile b/Images/GNUmakefile index 3bc3d0e69..673a71b79 100644 --- a/Images/GNUmakefile +++ b/Images/GNUmakefile @@ -73,6 +73,8 @@ common_TabUnSelectedJunction.tiff \ common_TabUnSelectedLeft.tiff \ common_TabUnSelectedRight.tiff \ common_Tile.tiff \ +common_UpAndDownArrowSmall.tiff \ +common_DownArrowSmall.tiff \ common_Nibble.tiff \ common_Dimple.tiff \ common_ret.tiff \ diff --git a/Images/common_DownArrowSmall.tiff b/Images/common_DownArrowSmall.tiff new file mode 100644 index 000000000..0c3377caf Binary files /dev/null and b/Images/common_DownArrowSmall.tiff differ diff --git a/Images/common_UpAndDownArrowSmall.tiff b/Images/common_UpAndDownArrowSmall.tiff new file mode 100644 index 000000000..faa574bf2 Binary files /dev/null and b/Images/common_UpAndDownArrowSmall.tiff differ diff --git a/Source/NSPopUpButtonCell.m b/Source/NSPopUpButtonCell.m index e5a587f34..5200d3cd2 100644 --- a/Source/NSPopUpButtonCell.m +++ b/Source/NSPopUpButtonCell.m @@ -82,26 +82,32 @@ if (cell_image) { [self _drawImage:cell_image inFrame:cellFrame]; - return; + + rect.size.width = 5; // calc image rect + rect.size.height = 11; + rect.origin.x = cellFrame.origin.x + cellFrame.size.width - 8; + rect.origin.y = cellFrame.origin.y + 3; } + else + { + [cell_font set]; - [cell_font set]; + point.y = rect.origin.y + (rect.size.height/2) - 4; + point.x = rect.origin.x + xDist; + rect.origin = point; - point.y = rect.origin.y + (rect.size.height/2) - 4; - point.x = rect.origin.x + xDist; - rect.origin = point; - - [[NSColor blackColor] set]; + [[NSColor blackColor] set]; - // Draw the title. + // Draw the title. - DPSmoveto(ctxt, rect.origin.x, rect.origin.y); - DPSshow(ctxt, [contents cString]); + DPSmoveto(ctxt, rect.origin.x, rect.origin.y); + DPSshow(ctxt, [contents cString]); - rect.size.width = 15; // calc image rect - rect.size.height = cellFrame.size.height; - rect.origin.x = cellFrame.origin.x + cellFrame.size.width - (6 + 11); - rect.origin.y = cellFrame.origin.y; + rect.size.width = 15; // calc image rect + rect.size.height = cellFrame.size.height; + rect.origin.x = cellFrame.origin.x + cellFrame.size.width - (6 + 11); + rect.origin.y = cellFrame.origin.y; + } if ([view isKindOfClass:[NSMenuView class]]) { @@ -114,6 +120,13 @@ else [super _drawImage:[NSImage imageNamed:@"common_3DArrowDown"] inFrame:rect]; } + else if ([[[popb selectedItem] representedObject] isEqual: cell_image]) + { + if ([popb pullsDown] == NO) + [super _drawImage:[NSImage imageNamed:@"common_UpAndDownArrowSmall.tiff"] inFrame:rect]; + else + [super _drawImage:[NSImage imageNamed:@"common_DownArrowSmall"] inFrame:rect]; + } } else if ([view isKindOfClass:[NSPopUpButton class]]) { @@ -125,6 +138,13 @@ else [super _drawImage:[NSImage imageNamed:@"common_3DArrowDown"] inFrame:rect]; } + else if ([[[(NSPopUpButton *)view selectedItem] representedObject] isEqual: cell_image]) + { + if ([(NSPopUpButton *)view pullsDown] == NO) + [super _drawImage:[NSImage imageNamed:@"common_UpAndDownArrowSmall"] inFrame:rect]; + else + [super _drawImage:[NSImage imageNamed:@"common_DownArrowSmall"] inFrame:rect]; + } } } @end