mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-20 17:16:26 +00:00
* Source/GSFontInfo.m (-defaultLineHeightForFont): Adjust line
height calculation. * Source/NSButtonCell.m (-drawInteriorWithFrame:inView:): Always initialize imageRect and titleRect. Adjust the calculations to match the new line height. (-cellSize): Always initialize imageRect and titleRect. * Headers/AppKit/NSCell.h (-_drawImage:inFrame:isFlipped:): Remove. * Source/NSCell.m (-_drawImage:inFrame:isFlipped:): Remove. Move code back ... (-drawInteriorWithFrame:inView:): ... here. * Source/NSToolbarItem.m (+initialize): Remove. (+cellClass): Add. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@20100 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
e2e0084fdb
commit
811ae4cf9f
6 changed files with 69 additions and 50 deletions
|
@ -353,12 +353,12 @@
|
|||
/*
|
||||
* Setting the Images
|
||||
*/
|
||||
- (NSImage*) alternateImage
|
||||
- (NSImage*) alternateImage
|
||||
{
|
||||
return _altImage;
|
||||
}
|
||||
|
||||
- (NSCellImagePosition) imagePosition
|
||||
- (NSCellImagePosition) imagePosition
|
||||
{
|
||||
return _cell.image_position;
|
||||
}
|
||||
|
@ -434,7 +434,7 @@
|
|||
return _buttoncell_is_transparent;
|
||||
}
|
||||
|
||||
- (void) setTransparent: (BOOL)flag
|
||||
- (void) setTransparent: (BOOL)flag
|
||||
{
|
||||
_buttoncell_is_transparent = flag;
|
||||
}
|
||||
|
@ -907,9 +907,11 @@
|
|||
*/
|
||||
switch (ipos)
|
||||
{
|
||||
default:
|
||||
case NSNoImage:
|
||||
imageToDisplay = nil;
|
||||
titleRect = cellFrame;
|
||||
imageRect = NSZeroRect;
|
||||
if (titleSize.width + 6 <= titleRect.size.width)
|
||||
{
|
||||
titleRect.origin.x += 3;
|
||||
|
@ -920,6 +922,7 @@
|
|||
case NSImageOnly:
|
||||
titleToDisplay = nil;
|
||||
imageRect = cellFrame;
|
||||
titleRect = NSZeroRect;
|
||||
break;
|
||||
|
||||
case NSImageLeft:
|
||||
|
@ -949,7 +952,8 @@
|
|||
imageRect.origin.x -= 3;
|
||||
}
|
||||
titleRect.origin = cellFrame.origin;
|
||||
titleRect.size.width = imageRect.origin.x - titleRect.origin.x - GSCellTextImageXDist;
|
||||
titleRect.size.width = imageRect.origin.x - titleRect.origin.x
|
||||
- GSCellTextImageXDist;
|
||||
titleRect.size.height = cellFrame.size.height;
|
||||
if (titleSize.width + 3 <= titleRect.size.width)
|
||||
{
|
||||
|
@ -964,19 +968,22 @@
|
|||
* above the text.
|
||||
* The drawing code below will then center the image in imageRect.
|
||||
*/
|
||||
titleRect.origin.x = cellFrame.origin.x;
|
||||
titleRect.origin.y = cellFrame.origin.y + GSCellTextImageYDist;
|
||||
titleRect.origin = cellFrame.origin;
|
||||
titleRect.size.width = cellFrame.size.width;
|
||||
titleRect.size.height = titleSize.height;
|
||||
if (_cell.is_bordered || _cell.is_bezeled)
|
||||
{
|
||||
titleRect.origin.y += 3;
|
||||
}
|
||||
|
||||
imageRect.origin.x = cellFrame.origin.x;
|
||||
imageRect.origin.y = NSMaxY(titleRect);
|
||||
imageRect.origin.y = NSMaxY(titleRect) + GSCellTextImageYDist;
|
||||
imageRect.size.width = cellFrame.size.width;
|
||||
imageRect.size.height = NSMaxY(cellFrame) - imageRect.origin.y;
|
||||
|
||||
if (_cell.is_bordered || _cell.is_bezeled)
|
||||
{
|
||||
imageRect.origin.y -= 1;
|
||||
imageRect.size.height -= 3;
|
||||
}
|
||||
if (titleSize.width + 6 <= titleRect.size.width)
|
||||
{
|
||||
|
@ -995,6 +1002,10 @@
|
|||
titleRect.origin.y = NSMaxY(cellFrame) - titleSize.height;
|
||||
titleRect.size.width = cellFrame.size.width;
|
||||
titleRect.size.height = titleSize.height;
|
||||
if (_cell.is_bordered || _cell.is_bezeled)
|
||||
{
|
||||
titleRect.origin.y -= 3;
|
||||
}
|
||||
|
||||
imageRect.origin.x = cellFrame.origin.x;
|
||||
imageRect.origin.y = cellFrame.origin.y;
|
||||
|
@ -1003,7 +1014,8 @@
|
|||
|
||||
if (_cell.is_bordered || _cell.is_bezeled)
|
||||
{
|
||||
imageRect.origin.y += 1;
|
||||
imageRect.origin.y += 3;
|
||||
imageRect.size.height -= 3;
|
||||
}
|
||||
if (titleSize.width + 6 <= titleRect.size.width)
|
||||
{
|
||||
|
@ -1028,7 +1040,7 @@
|
|||
{
|
||||
[self drawGradientWithFrame: cellFrame inView: controlView];
|
||||
}
|
||||
|
||||
|
||||
// Draw image
|
||||
if (imageToDisplay != nil)
|
||||
{
|
||||
|
@ -1105,6 +1117,7 @@
|
|||
|
||||
switch (_cell.image_position)
|
||||
{
|
||||
default:
|
||||
case NSNoImage:
|
||||
s = titleSize;
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue