mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 20:50:48 +00:00
Just white space clean-up.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@25094 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
0b066933b7
commit
73a1bc1df3
3 changed files with 633 additions and 628 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2007-04-29 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
|
* Source/NSButtonCell.m
|
||||||
|
* Source/NSMenuItemCell.m: Whitespace cleanup.
|
||||||
|
|
||||||
2007-04-27 Fred Kiefer <FredKiefer@gmx.de>
|
2007-04-27 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Headers/AppKit/NSDragging.h: Added a few MacOSX 10.2 methods
|
* Headers/AppKit/NSDragging.h: Added a few MacOSX 10.2 methods
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -47,7 +47,7 @@
|
||||||
|
|
||||||
@implementation NSMenuItemCell
|
@implementation NSMenuItemCell
|
||||||
|
|
||||||
static NSImage *arrowImage = nil; /* Cache arrow image. */
|
static NSImage *arrowImage = nil; /* Cache arrow image. */
|
||||||
|
|
||||||
|
|
||||||
+ (void) initialize
|
+ (void) initialize
|
||||||
|
@ -113,7 +113,7 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
|
||||||
mask = _highlightsByMask;
|
mask = _highlightsByMask;
|
||||||
|
|
||||||
if (_cell.state)
|
if (_cell.state)
|
||||||
mask &= ~_showAltStateMask;
|
mask &= ~_showAltStateMask;
|
||||||
}
|
}
|
||||||
else if (_cell.state)
|
else if (_cell.state)
|
||||||
mask = _showAltStateMask;
|
mask = _showAltStateMask;
|
||||||
|
@ -197,11 +197,11 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
|
||||||
shift = (m & NSShiftKeyMask) & ![key isEqualToString: ucKey];
|
shift = (m & NSShiftKeyMask) & ![key isEqualToString: ucKey];
|
||||||
|
|
||||||
key = [NSString stringWithFormat:@"%@%@%@%@%@",
|
key = [NSString stringWithFormat:@"%@%@%@%@%@",
|
||||||
(m & NSControlKeyMask) ? @"^" : @"",
|
(m & NSControlKeyMask) ? @"^" : @"",
|
||||||
(m & NSAlternateKeyMask) ? @"+" : @"",
|
(m & NSAlternateKeyMask) ? @"+" : @"",
|
||||||
shift ? @"/" : @"",
|
shift ? @"/" : @"",
|
||||||
(m & NSCommandKeyMask) ? @"#" : @"",
|
(m & NSCommandKeyMask) ? @"#" : @"",
|
||||||
key];
|
key];
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,30 +226,30 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
|
||||||
if ([_menuItem onStateImage])
|
if ([_menuItem onStateImage])
|
||||||
componentSize = [[_menuItem onStateImage] size];
|
componentSize = [[_menuItem onStateImage] size];
|
||||||
else
|
else
|
||||||
componentSize = NSMakeSize(0,0);
|
componentSize = NSMakeSize(0,0);
|
||||||
_stateImageWidth = componentSize.width;
|
_stateImageWidth = componentSize.width;
|
||||||
if (componentSize.height > neededMenuItemHeight)
|
if (componentSize.height > neededMenuItemHeight)
|
||||||
neededMenuItemHeight = componentSize.height;
|
neededMenuItemHeight = componentSize.height;
|
||||||
|
|
||||||
// NSOffState
|
// NSOffState
|
||||||
if ([_menuItem offStateImage])
|
if ([_menuItem offStateImage])
|
||||||
componentSize = [[_menuItem offStateImage] size];
|
componentSize = [[_menuItem offStateImage] size];
|
||||||
else
|
else
|
||||||
componentSize = NSMakeSize(0,0);
|
componentSize = NSMakeSize(0,0);
|
||||||
if (componentSize.width > _stateImageWidth)
|
if (componentSize.width > _stateImageWidth)
|
||||||
_stateImageWidth = componentSize.width;
|
_stateImageWidth = componentSize.width;
|
||||||
if (componentSize.height > neededMenuItemHeight)
|
if (componentSize.height > neededMenuItemHeight)
|
||||||
neededMenuItemHeight = componentSize.height;
|
neededMenuItemHeight = componentSize.height;
|
||||||
|
|
||||||
// NSMixedState
|
// NSMixedState
|
||||||
if ([_menuItem mixedStateImage])
|
if ([_menuItem mixedStateImage])
|
||||||
componentSize = [[_menuItem mixedStateImage] size];
|
componentSize = [[_menuItem mixedStateImage] size];
|
||||||
else
|
else
|
||||||
componentSize = NSMakeSize(0,0);
|
componentSize = NSMakeSize(0,0);
|
||||||
if (componentSize.width > _stateImageWidth)
|
if (componentSize.width > _stateImageWidth)
|
||||||
_stateImageWidth = componentSize.width;
|
_stateImageWidth = componentSize.width;
|
||||||
if (componentSize.height > neededMenuItemHeight)
|
if (componentSize.height > neededMenuItemHeight)
|
||||||
neededMenuItemHeight = componentSize.height;
|
neededMenuItemHeight = componentSize.height;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -264,7 +264,7 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
|
||||||
componentSize = [anImage size];
|
componentSize = [anImage size];
|
||||||
_imageWidth = componentSize.width;
|
_imageWidth = componentSize.width;
|
||||||
if (componentSize.height > neededMenuItemHeight)
|
if (componentSize.height > neededMenuItemHeight)
|
||||||
neededMenuItemHeight = componentSize.height;
|
neededMenuItemHeight = componentSize.height;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -287,7 +287,7 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
|
||||||
componentSize = [arrowImage size];
|
componentSize = [arrowImage size];
|
||||||
_keyEquivalentWidth = componentSize.width;
|
_keyEquivalentWidth = componentSize.width;
|
||||||
if (componentSize.height > neededMenuItemHeight)
|
if (componentSize.height > neededMenuItemHeight)
|
||||||
neededMenuItemHeight = componentSize.height;
|
neededMenuItemHeight = componentSize.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cache definitive height
|
// Cache definitive height
|
||||||
|
@ -360,42 +360,42 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
|
||||||
if (_mcell_belongs_to_popupbutton && _cell.image_position)
|
if (_mcell_belongs_to_popupbutton && _cell.image_position)
|
||||||
{
|
{
|
||||||
// Special case: draw image on the extreme right
|
// Special case: draw image on the extreme right
|
||||||
cellFrame.origin.x += cellFrame.size.width - _imageWidth - 4;
|
cellFrame.origin.x += cellFrame.size.width - _imageWidth - 4;
|
||||||
cellFrame.size.width = _imageWidth;
|
cellFrame.size.width = _imageWidth;
|
||||||
return cellFrame;
|
return cellFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([_menuView isHorizontal] == YES)
|
if ([_menuView isHorizontal] == YES)
|
||||||
{
|
{
|
||||||
switch (_cell.image_position)
|
switch (_cell.image_position)
|
||||||
{
|
{
|
||||||
case NSNoImage:
|
case NSNoImage:
|
||||||
cellFrame = NSZeroRect;
|
cellFrame = NSZeroRect;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSImageOnly:
|
case NSImageOnly:
|
||||||
case NSImageOverlaps:
|
case NSImageOverlaps:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSImageLeft:
|
case NSImageLeft:
|
||||||
cellFrame.origin.x += 4.; // _horizontalEdgePad
|
cellFrame.origin.x += 4.; // _horizontalEdgePad
|
||||||
cellFrame.size.width = _imageWidth;
|
cellFrame.size.width = _imageWidth;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSImageRight:
|
case NSImageRight:
|
||||||
cellFrame.origin.x += _titleWidth;
|
cellFrame.origin.x += _titleWidth;
|
||||||
cellFrame.size.width = _imageWidth;
|
cellFrame.size.width = _imageWidth;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSImageBelow:
|
case NSImageBelow:
|
||||||
cellFrame.size.height /= 2;
|
cellFrame.size.height /= 2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSImageAbove:
|
case NSImageAbove:
|
||||||
cellFrame.size.height /= 2;
|
cellFrame.size.height /= 2;
|
||||||
cellFrame.origin.y += cellFrame.size.height;
|
cellFrame.origin.y += cellFrame.size.height;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -404,33 +404,33 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
|
||||||
cellFrame.size.width = [_menuView imageAndTitleWidth];
|
cellFrame.size.width = [_menuView imageAndTitleWidth];
|
||||||
|
|
||||||
switch (_cell.image_position)
|
switch (_cell.image_position)
|
||||||
{
|
{
|
||||||
case NSNoImage:
|
case NSNoImage:
|
||||||
cellFrame = NSZeroRect;
|
cellFrame = NSZeroRect;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSImageOnly:
|
case NSImageOnly:
|
||||||
case NSImageOverlaps:
|
case NSImageOverlaps:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSImageLeft:
|
case NSImageLeft:
|
||||||
cellFrame.size.width = _imageWidth;
|
cellFrame.size.width = _imageWidth;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSImageRight:
|
case NSImageRight:
|
||||||
cellFrame.origin.x += _titleWidth + GSCellTextImageXDist;
|
cellFrame.origin.x += _titleWidth + GSCellTextImageXDist;
|
||||||
cellFrame.size.width = _imageWidth;
|
cellFrame.size.width = _imageWidth;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSImageBelow:
|
case NSImageBelow:
|
||||||
cellFrame.size.height /= 2;
|
cellFrame.size.height /= 2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSImageAbove:
|
case NSImageAbove:
|
||||||
cellFrame.size.height /= 2;
|
cellFrame.size.height /= 2;
|
||||||
cellFrame.origin.y += cellFrame.size.height;
|
cellFrame.origin.y += cellFrame.size.height;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return cellFrame;
|
return cellFrame;
|
||||||
}
|
}
|
||||||
|
@ -465,33 +465,33 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
|
||||||
cellFrame.size.height -= 2;
|
cellFrame.size.height -= 2;
|
||||||
|
|
||||||
switch (_cell.image_position)
|
switch (_cell.image_position)
|
||||||
{
|
{
|
||||||
case NSNoImage:
|
case NSNoImage:
|
||||||
case NSImageOverlaps:
|
case NSImageOverlaps:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSImageOnly:
|
case NSImageOnly:
|
||||||
cellFrame = NSZeroRect;
|
cellFrame = NSZeroRect;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSImageLeft:
|
case NSImageLeft:
|
||||||
cellFrame.origin.x += _imageWidth + GSCellTextImageXDist + 4;
|
cellFrame.origin.x += _imageWidth + GSCellTextImageXDist + 4;
|
||||||
cellFrame.size.width = _titleWidth;
|
cellFrame.size.width = _titleWidth;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSImageRight:
|
case NSImageRight:
|
||||||
cellFrame.size.width = _titleWidth;
|
cellFrame.size.width = _titleWidth;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSImageBelow:
|
case NSImageBelow:
|
||||||
cellFrame.size.height /= 2;
|
cellFrame.size.height /= 2;
|
||||||
cellFrame.origin.y += cellFrame.size.height;
|
cellFrame.origin.y += cellFrame.size.height;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSImageAbove:
|
case NSImageAbove:
|
||||||
cellFrame.size.height /= 2;
|
cellFrame.size.height /= 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -500,33 +500,33 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
|
||||||
cellFrame.size.width = [_menuView imageAndTitleWidth];
|
cellFrame.size.width = [_menuView imageAndTitleWidth];
|
||||||
|
|
||||||
switch (_cell.image_position)
|
switch (_cell.image_position)
|
||||||
{
|
{
|
||||||
case NSNoImage:
|
case NSNoImage:
|
||||||
case NSImageOverlaps:
|
case NSImageOverlaps:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSImageOnly:
|
case NSImageOnly:
|
||||||
cellFrame = NSZeroRect;
|
cellFrame = NSZeroRect;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSImageLeft:
|
case NSImageLeft:
|
||||||
cellFrame.origin.x += _imageWidth + GSCellTextImageXDist;
|
cellFrame.origin.x += _imageWidth + GSCellTextImageXDist;
|
||||||
cellFrame.size.width = _titleWidth;
|
cellFrame.size.width = _titleWidth;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSImageRight:
|
case NSImageRight:
|
||||||
cellFrame.size.width = _titleWidth;
|
cellFrame.size.width = _titleWidth;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSImageBelow:
|
case NSImageBelow:
|
||||||
cellFrame.size.height /= 2;
|
cellFrame.size.height /= 2;
|
||||||
cellFrame.origin.y += cellFrame.size.height;
|
cellFrame.origin.y += cellFrame.size.height;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSImageAbove:
|
case NSImageAbove:
|
||||||
cellFrame.size.height /= 2;
|
cellFrame.size.height /= 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return cellFrame;
|
return cellFrame;
|
||||||
}
|
}
|
||||||
|
@ -540,50 +540,50 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
|
||||||
* must inset from that.
|
* must inset from that.
|
||||||
*/
|
*/
|
||||||
return NSMakeRect (theRect.origin.x, theRect.origin.y + 2,
|
return NSMakeRect (theRect.origin.x, theRect.origin.y + 2,
|
||||||
theRect.size.width, theRect.size.height - 2);
|
theRect.size.width, theRect.size.height - 2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (_cell.is_bordered)
|
if (_cell.is_bordered)
|
||||||
{
|
{
|
||||||
float yDelta = [_control_view isFlipped] ? 1. : 2.;
|
float yDelta = [_control_view isFlipped] ? 1. : 2.;
|
||||||
unsigned mask;
|
unsigned mask;
|
||||||
NSRect interiorFrame;
|
NSRect interiorFrame;
|
||||||
|
|
||||||
if (_cell.is_highlighted)
|
if (_cell.is_highlighted)
|
||||||
{
|
{
|
||||||
mask = _highlightsByMask;
|
mask = _highlightsByMask;
|
||||||
|
|
||||||
if (_cell.state)
|
if (_cell.state)
|
||||||
mask &= ~_showAltStateMask;
|
mask &= ~_showAltStateMask;
|
||||||
}
|
}
|
||||||
else if (_cell.state)
|
else if (_cell.state)
|
||||||
mask = _showAltStateMask;
|
mask = _showAltStateMask;
|
||||||
else
|
else
|
||||||
mask = NSNoCellMask;
|
mask = NSNoCellMask;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Special case: Buttons have only three different paths for border.
|
* Special case: Buttons have only three different paths for border.
|
||||||
* One white path at the top left corner, one black path at the
|
* 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.
|
* bottom right and another in dark gray at the inner bottom right.
|
||||||
*/
|
*/
|
||||||
interiorFrame = NSMakeRect(theRect.origin.x + 1.,
|
interiorFrame = NSMakeRect(theRect.origin.x + 1.,
|
||||||
theRect.origin.y + yDelta,
|
theRect.origin.y + yDelta,
|
||||||
theRect.size.width - 3.,
|
theRect.size.width - 3.,
|
||||||
theRect.size.height - 3.);
|
theRect.size.height - 3.);
|
||||||
|
|
||||||
// pushed in buttons contents are displaced to the bottom right 1px
|
// pushed in buttons contents are displaced to the bottom right 1px
|
||||||
if ((mask & NSPushInCellMask))
|
if ((mask & NSPushInCellMask))
|
||||||
{
|
{
|
||||||
interiorFrame
|
interiorFrame
|
||||||
= NSOffsetRect(interiorFrame, 1., [_control_view isFlipped] ? 1. : -1.);
|
= NSOffsetRect(interiorFrame, 1., [_control_view isFlipped] ? 1. : -1.);
|
||||||
}
|
}
|
||||||
return interiorFrame;
|
return interiorFrame;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return theRect;
|
return theRect;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -591,7 +591,7 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
|
||||||
// Drawing.
|
// Drawing.
|
||||||
//
|
//
|
||||||
- (void) drawBorderAndBackgroundWithFrame: (NSRect)cellFrame
|
- (void) drawBorderAndBackgroundWithFrame: (NSRect)cellFrame
|
||||||
inView: (NSView *)controlView
|
inView: (NSView *)controlView
|
||||||
{
|
{
|
||||||
if ([_menuView isHorizontal] == YES)
|
if ([_menuView isHorizontal] == YES)
|
||||||
{
|
{
|
||||||
|
@ -619,21 +619,21 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) drawImageWithFrame: (NSRect)cellFrame
|
- (void) drawImageWithFrame: (NSRect)cellFrame
|
||||||
inView: (NSView *)controlView
|
inView: (NSView *)controlView
|
||||||
{
|
{
|
||||||
cellFrame = [self imageRectForBounds: cellFrame];
|
cellFrame = [self imageRectForBounds: cellFrame];
|
||||||
[self drawImage: _imageToDisplay withFrame: cellFrame inView: controlView];
|
[self drawImage: _imageToDisplay withFrame: cellFrame inView: controlView];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) drawKeyEquivalentWithFrame:(NSRect)cellFrame
|
- (void) drawKeyEquivalentWithFrame:(NSRect)cellFrame
|
||||||
inView:(NSView *)controlView
|
inView:(NSView *)controlView
|
||||||
{
|
{
|
||||||
cellFrame = [self keyEquivalentRectForBounds: cellFrame];
|
cellFrame = [self keyEquivalentRectForBounds: cellFrame];
|
||||||
|
|
||||||
if ([_menuItem hasSubmenu] && arrowImage != nil)
|
if ([_menuItem hasSubmenu] && arrowImage != nil)
|
||||||
{
|
{
|
||||||
NSSize size;
|
NSSize size;
|
||||||
NSPoint position;
|
NSPoint position;
|
||||||
|
|
||||||
size = [arrowImage size];
|
size = [arrowImage size];
|
||||||
position.x = cellFrame.origin.x + cellFrame.size.width - size.width;
|
position.x = cellFrame.origin.x + cellFrame.size.width - size.width;
|
||||||
|
@ -643,7 +643,7 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
|
||||||
* so we must adjust the position to take account of a flipped view.
|
* so we must adjust the position to take account of a flipped view.
|
||||||
*/
|
*/
|
||||||
if ([controlView isFlipped])
|
if ([controlView isFlipped])
|
||||||
position.y += size.height;
|
position.y += size.height;
|
||||||
|
|
||||||
[arrowImage compositeToPoint: position operation: NSCompositeSourceOver];
|
[arrowImage compositeToPoint: position operation: NSCompositeSourceOver];
|
||||||
}
|
}
|
||||||
|
@ -665,33 +665,33 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
|
||||||
|
|
||||||
|
|
||||||
- (void) drawSeparatorItemWithFrame:(NSRect)cellFrame
|
- (void) drawSeparatorItemWithFrame:(NSRect)cellFrame
|
||||||
inView:(NSView *)controlView
|
inView:(NSView *)controlView
|
||||||
{
|
{
|
||||||
// FIXME: This only has sense in MacOS or Windows interface styles.
|
// FIXME: This only has sense in MacOS or Windows interface styles.
|
||||||
// Maybe somebody wants to support this (Lazaro).
|
// Maybe somebody wants to support this (Lazaro).
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) drawStateImageWithFrame: (NSRect)cellFrame
|
- (void) drawStateImageWithFrame: (NSRect)cellFrame
|
||||||
inView: (NSView*)controlView
|
inView: (NSView*)controlView
|
||||||
{
|
{
|
||||||
NSSize size;
|
NSSize size;
|
||||||
NSPoint position;
|
NSPoint position;
|
||||||
NSImage *imageToDisplay;
|
NSImage *imageToDisplay;
|
||||||
|
|
||||||
switch ([_menuItem state])
|
switch ([_menuItem state])
|
||||||
{
|
{
|
||||||
case NSOnState:
|
case NSOnState:
|
||||||
imageToDisplay = [_menuItem onStateImage];
|
imageToDisplay = [_menuItem onStateImage];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSMixedState:
|
case NSMixedState:
|
||||||
imageToDisplay = [_menuItem mixedStateImage];
|
imageToDisplay = [_menuItem mixedStateImage];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSOffState:
|
case NSOffState:
|
||||||
default:
|
default:
|
||||||
imageToDisplay = [_menuItem offStateImage];
|
imageToDisplay = [_menuItem offStateImage];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (imageToDisplay == nil)
|
if (imageToDisplay == nil)
|
||||||
|
@ -717,7 +717,7 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) drawTitleWithFrame:(NSRect)cellFrame
|
- (void) drawTitleWithFrame:(NSRect)cellFrame
|
||||||
inView:(NSView *)controlView
|
inView:(NSView *)controlView
|
||||||
{
|
{
|
||||||
if ([_menuView isHorizontal] == YES)
|
if ([_menuView isHorizontal] == YES)
|
||||||
{
|
{
|
||||||
|
@ -728,13 +728,13 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
|
||||||
NSRect cf = [self titleRectForBounds: cellFrame];
|
NSRect cf = [self titleRectForBounds: cellFrame];
|
||||||
|
|
||||||
if (!_imageWidth)
|
if (!_imageWidth)
|
||||||
[value setAlignment: NSCenterTextAlignment];
|
[value setAlignment: NSCenterTextAlignment];
|
||||||
|
|
||||||
attr = [[NSDictionary alloc] initWithObjectsAndKeys:
|
attr = [[NSDictionary alloc] initWithObjectsAndKeys:
|
||||||
value, NSParagraphStyleAttributeName,
|
value, NSParagraphStyleAttributeName,
|
||||||
_font, NSFontAttributeName,
|
_font, NSFontAttributeName,
|
||||||
[NSColor controlTextColor], NSForegroundColorAttributeName,
|
[NSColor controlTextColor], NSForegroundColorAttributeName,
|
||||||
nil];
|
nil];
|
||||||
|
|
||||||
[[_menuItem title] drawInRect: cf withAttributes: attr];
|
[[_menuItem title] drawInRect: cf withAttributes: attr];
|
||||||
|
|
||||||
|
@ -743,7 +743,7 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[self _drawText: [_menuItem title]
|
[self _drawText: [_menuItem title]
|
||||||
inFrame: [self titleRectForBounds: cellFrame]];
|
inFrame: [self titleRectForBounds: cellFrame]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -774,7 +774,7 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
|
||||||
mask = _highlightsByMask;
|
mask = _highlightsByMask;
|
||||||
|
|
||||||
if (_cell.state)
|
if (_cell.state)
|
||||||
mask &= ~_showAltStateMask;
|
mask &= ~_showAltStateMask;
|
||||||
}
|
}
|
||||||
else if (_cell.state)
|
else if (_cell.state)
|
||||||
mask = _showAltStateMask;
|
mask = _showAltStateMask;
|
||||||
|
@ -794,10 +794,10 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
|
||||||
{
|
{
|
||||||
_imageToDisplay = _altImage;
|
_imageToDisplay = _altImage;
|
||||||
if (!_imageToDisplay)
|
if (!_imageToDisplay)
|
||||||
_imageToDisplay = [_menuItem image];
|
_imageToDisplay = [_menuItem image];
|
||||||
_titleToDisplay = _altContents;
|
_titleToDisplay = _altContents;
|
||||||
if (_titleToDisplay == nil || [_titleToDisplay isEqual: @""])
|
if (_titleToDisplay == nil || [_titleToDisplay isEqual: @""])
|
||||||
_titleToDisplay = [_menuItem title];
|
_titleToDisplay = [_menuItem title];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -814,29 +814,29 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
|
||||||
{
|
{
|
||||||
// Draw the image
|
// Draw the image
|
||||||
if (_imageWidth > 0)
|
if (_imageWidth > 0)
|
||||||
[self drawImageWithFrame: cellFrame inView: controlView];
|
[self drawImageWithFrame: cellFrame inView: controlView];
|
||||||
|
|
||||||
// Draw the title
|
// Draw the title
|
||||||
if (_titleWidth > 0)
|
if (_titleWidth > 0)
|
||||||
[self drawTitleWithFrame: cellFrame inView: controlView];
|
[self drawTitleWithFrame: cellFrame inView: controlView];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Draw the state image
|
// Draw the state image
|
||||||
if (_stateImageWidth > 0)
|
if (_stateImageWidth > 0)
|
||||||
[self drawStateImageWithFrame: cellFrame inView: controlView];
|
[self drawStateImageWithFrame: cellFrame inView: controlView];
|
||||||
|
|
||||||
// Draw the image
|
// Draw the image
|
||||||
if (_imageWidth > 0)
|
if (_imageWidth > 0)
|
||||||
[self drawImageWithFrame: cellFrame inView: controlView];
|
[self drawImageWithFrame: cellFrame inView: controlView];
|
||||||
|
|
||||||
// Draw the title
|
// Draw the title
|
||||||
if (_titleWidth > 0)
|
if (_titleWidth > 0)
|
||||||
[self drawTitleWithFrame: cellFrame inView: controlView];
|
[self drawTitleWithFrame: cellFrame inView: controlView];
|
||||||
|
|
||||||
// Draw the key equivalent
|
// Draw the key equivalent
|
||||||
if (_keyEquivalentWidth > 0)
|
if (_keyEquivalentWidth > 0)
|
||||||
[self drawKeyEquivalentWithFrame: cellFrame inView: controlView];
|
[self drawKeyEquivalentWithFrame: cellFrame inView: controlView];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -889,9 +889,9 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
|
||||||
|
|
||||||
if ([aDecoder versionForClassName: @"NSMenuItemCell"] < 2)
|
if ([aDecoder versionForClassName: @"NSMenuItemCell"] < 2)
|
||||||
{
|
{
|
||||||
/* In version 1, we used to encode the _menuView here. */
|
/* In version 1, we used to encode the _menuView here. */
|
||||||
[aDecoder decodeObject];
|
[aDecoder decodeObject];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_needs_sizing = YES;
|
_needs_sizing = YES;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue