Fixes for nspopupbutton

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4678 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
michael 1999-07-31 00:44:25 +00:00
parent c32570418e
commit b0223fd729
5 changed files with 41 additions and 14 deletions

View file

@ -10,12 +10,17 @@
popupbuttons.app in core/Testing to see. popupbuttons.app in core/Testing to see.
* Source/NSPopUpButtonCell.m: modifications to make NSPopUpButton * Source/NSPopUpButtonCell.m: modifications to make NSPopUpButton
work. Also implemented representedObject as I think it should be. 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 * Source/NSTableColumn.m: fixes to make some things work a little
better. better.
* Source/NSTableView.m: fixes to make things behave. Still doesn't * Source/NSTableView.m: fixes to make things behave. Still doesn't
compile in, but it is getting there. Modifications will have to compile in, but it is getting there. Modifications will have to
be made to NSScrollView before we can use this class. be made to NSScrollView before we can use this class.
* Source/NSTabView.m: fixed (- contentRect) for the no tabs case. * 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/NSMenu.h: mods for changes.
* Headers/NSPopUpButton.h: ditto. * Headers/NSPopUpButton.h: ditto.
* Headers/NSPopUpButtonCell.h: ditto, also changed to inherit from * Headers/NSPopUpButtonCell.h: ditto, also changed to inherit from

View file

@ -73,6 +73,8 @@ common_TabUnSelectedJunction.tiff \
common_TabUnSelectedLeft.tiff \ common_TabUnSelectedLeft.tiff \
common_TabUnSelectedRight.tiff \ common_TabUnSelectedRight.tiff \
common_Tile.tiff \ common_Tile.tiff \
common_UpAndDownArrowSmall.tiff \
common_DownArrowSmall.tiff \
common_Nibble.tiff \ common_Nibble.tiff \
common_Dimple.tiff \ common_Dimple.tiff \
common_ret.tiff \ common_ret.tiff \

Binary file not shown.

Binary file not shown.

View file

@ -82,26 +82,32 @@
if (cell_image) if (cell_image)
{ {
[self _drawImage:cell_image inFrame:cellFrame]; [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; [[NSColor blackColor] set];
point.x = rect.origin.x + xDist;
rect.origin = point;
[[NSColor blackColor] set];
// Draw the title. // Draw the title.
DPSmoveto(ctxt, rect.origin.x, rect.origin.y); DPSmoveto(ctxt, rect.origin.x, rect.origin.y);
DPSshow(ctxt, [contents cString]); DPSshow(ctxt, [contents cString]);
rect.size.width = 15; // calc image rect rect.size.width = 15; // calc image rect
rect.size.height = cellFrame.size.height; rect.size.height = cellFrame.size.height;
rect.origin.x = cellFrame.origin.x + cellFrame.size.width - (6 + 11); rect.origin.x = cellFrame.origin.x + cellFrame.size.width - (6 + 11);
rect.origin.y = cellFrame.origin.y; rect.origin.y = cellFrame.origin.y;
}
if ([view isKindOfClass:[NSMenuView class]]) if ([view isKindOfClass:[NSMenuView class]])
{ {
@ -114,6 +120,13 @@
else else
[super _drawImage:[NSImage imageNamed:@"common_3DArrowDown"] inFrame:rect]; [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]]) else if ([view isKindOfClass:[NSPopUpButton class]])
{ {
@ -125,6 +138,13 @@
else else
[super _drawImage:[NSImage imageNamed:@"common_3DArrowDown"] inFrame:rect]; [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 @end