mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 13:10:59 +00:00
Fix image positioning
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4901 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
3d430874e9
commit
25e6b5545e
2 changed files with 13 additions and 9 deletions
|
@ -1,6 +1,10 @@
|
|||
Thu Sep 16 8:38:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
* Source/NSBrowserCell.m: Fix for positioning of leaf images.
|
||||
|
||||
Thu Sep 16 7:11:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
* NSBrowser.m: ([-setPath:]) ensure column zero is loaded - patch
|
||||
* Source/NSBrowser.m: ([-setPath:]) ensure column zero is loaded - patch
|
||||
from Tim Bissell.
|
||||
|
||||
1999-09-13 Pedro Ivo Andrade Tavares <ptavares@iname.com>
|
||||
|
|
|
@ -285,7 +285,9 @@ static Class colorClass;
|
|||
image_rect.size.height = cellFrame.size.height;
|
||||
image_rect.size.width = image_rect.size.height;
|
||||
// Right justify
|
||||
image_rect.origin.x += cellFrame.size.width- image_rect.size.width;
|
||||
image_rect.origin.x += cellFrame.size.width - image_rect.size.width;
|
||||
image_rect.origin.y
|
||||
= MAX(NSMidY(image_rect) - ([image size].height/2.),0.);
|
||||
}
|
||||
else
|
||||
image_rect = NSZeroRect;
|
||||
|
@ -300,7 +302,9 @@ static Class colorClass;
|
|||
image_rect.size.height = cellFrame.size.height;
|
||||
image_rect.size.width = image_rect.size.height;
|
||||
// Right justify
|
||||
image_rect.origin.x += cellFrame.size.width- image_rect.size.width;
|
||||
image_rect.origin.x += cellFrame.size.width - image_rect.size.width;
|
||||
image_rect.origin.y
|
||||
= MAX(NSMidY(image_rect) - ([image size].height/2.),0.);
|
||||
}
|
||||
else
|
||||
image_rect = NSZeroRect;
|
||||
|
@ -312,19 +316,15 @@ static Class colorClass;
|
|||
|
||||
if (image)
|
||||
{
|
||||
NSSize size;
|
||||
NSPoint position;
|
||||
NSPoint position = image_rect.origin;
|
||||
|
||||
[image setBackgroundColor: backColor];
|
||||
size = [image size];
|
||||
position.x = MAX(NSMidX(cellFrame) - (size.width/2.),0.);
|
||||
position.y = MAX(NSMidY(cellFrame) - (size.height/2.),0.);
|
||||
/*
|
||||
* Images are always drawn with their bottom-left corner at the origin
|
||||
* so we must adjust the position to take account of a flipped view.
|
||||
*/
|
||||
if ([control_view isFlipped])
|
||||
position.y += size.height;
|
||||
position.y += [image size].height;
|
||||
[image compositeToPoint: position operation: NSCompositeCopy];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue