First a correction to the make/Changelog file to add my e-mail to

a past entry I did (I forgot :)
GUI: Changes to make buttons NeXTish and nicer.  Modified size and drawing
methods in core/gui/Source/NSButtonCell.m


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4886 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
David Lazaro Saz 1999-09-14 01:45:58 +00:00
parent af23dcaaff
commit 061c43304a
2 changed files with 42 additions and 11 deletions

View file

@ -1,4 +1,16 @@
iMon Sep 13 1999 Nicola Pero <n.pero@mi.flashnet.it>
1999-09-14 David Lazaro Saz <khelekir@encomix.es>
* Source/NSButtonCell.m: NeXT look-alike changes
([-drawingRectForBounds:]): Made NSButton a special case. The
drawing rect is calculated in a different way than the other
cell types.
([-cellSize]): Added changes that take the above into account and
removed extra inner border if only there's an image to draw and
no text.
([-drawInteriorWithFrame:inView:]): Added a nice translation
effect when pushing a button.
Mon Sep 13 1999 Nicola Pero <n.pero@mi.flashnet.it>
* Source/NSImageView.m ([-setImage:]): Added update of the cell.
([-setImageAlignment:]): idem.

View file

@ -427,6 +427,12 @@
cellFrame = [self drawingRectForBounds: cellFrame];
// pushed in buttons contents are displaced to the bottom right 1px
if ([self isBordered] && [self isHighlighted]
&& ([self highlightsBy] & NSPushInCellMask))
cellFrame = NSOffsetRect (cellFrame,
1., [control_view isFlipped] ? 1. : -1.);
// determine the background color
if ([self state])
{
@ -649,12 +655,16 @@
}
// Add some spacing between text/image and border
s.width += 2 * xDist;
s.height += 2 * yDist;
// if there is text in the button
if (titleToDisplay) {
s.width += 2 * xDist;
s.height += 2 * yDist;
}
// Get border size
if ([self isBordered])
borderSize = [NSCell sizeForBorderType: NSBezelBorder];
// Buttons only have three paths for border (NeXT looks)
borderSize = NSMakeSize (1.5, 1.5);
else
borderSize = [NSCell sizeForBorderType: NSNoBorder];
@ -664,17 +674,26 @@
return s;
}
- (NSRect) drawingRectForBounds: (NSRect)theRect
{
NSSize borderSize;
// Get border size
if (cell_bordered)
borderSize = [NSCell sizeForBorderType: NSBezelBorder];
{
// Special case: Buttons have only three different paths for border.
// One white path at the top left corner, one black path at the
// bottom right and another in dark gray at the inner bottom right.
float yDelta = [control_view isFlipped] ? 1. : 2.;
return NSMakeRect (theRect.origin.x + 1.,
theRect.origin.y + yDelta,
theRect.size.width - 3.,
theRect.size.height - 3.);
}
else
borderSize = [NSCell sizeForBorderType: NSNoBorder];
return NSInsetRect (theRect, borderSize.width, borderSize.height);
{
// Get border size
NSSize borderSize = [NSCell sizeForBorderType: NSNoBorder];
return NSInsetRect (theRect, borderSize.width, borderSize.height);
}
}
- (id) copyWithZone: (NSZone*)zone