mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-01 12:31:55 +00:00
Made working for a flipped view.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@25478 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
e1cb2b75ef
commit
d8f3c46725
2 changed files with 64 additions and 23 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2007-09-12 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
|
* Source/NSToolbarItem.m (GSToolbarButtonCell-drawInteriorWithFrame:inView:):
|
||||||
|
Made working for a flipped view.
|
||||||
|
|
||||||
2007-09-11 Fred Kiefer <FredKiefer@gmx.de>
|
2007-09-11 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Source/NSSplitView.m (-displayRectIgnoringOpacity:inContext:):
|
* Source/NSSplitView.m (-displayRectIgnoringOpacity:inContext:):
|
||||||
|
|
|
@ -392,6 +392,7 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
// FIXME: Why does this class exists at all?
|
||||||
@implementation GSToolbarButtonCell
|
@implementation GSToolbarButtonCell
|
||||||
|
|
||||||
/* Overriden NSButtonCell method to handle cell type in a basic way which avoids
|
/* Overriden NSButtonCell method to handle cell type in a basic way which avoids
|
||||||
|
@ -413,28 +414,63 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Overriden NSButtonCell method
|
// Overriden NSButtonCell method to make sure all test is at the same height.
|
||||||
- (void) drawInteriorWithFrame: (NSRect)cellFrame inView: (NSView*)controlView
|
- (void) drawInteriorWithFrame: (NSRect)cellFrame inView: (NSView*)controlView
|
||||||
{
|
{
|
||||||
NSSize titleSize = [[self attributedTitle] size];
|
BOOL flippedView = [controlView isFlipped];
|
||||||
|
NSCellImagePosition ipos = _cell.image_position;
|
||||||
// We ignore alternateAttributedTitle, it is not needed
|
// We ignore alternateAttributedTitle, it is not needed
|
||||||
|
NSSize titleSize = [[self attributedTitle] size];
|
||||||
|
|
||||||
|
if (flippedView == YES)
|
||||||
|
{
|
||||||
|
if (ipos == NSImageAbove)
|
||||||
|
{
|
||||||
|
ipos = NSImageBelow;
|
||||||
|
}
|
||||||
|
else if (ipos == NSImageBelow)
|
||||||
|
{
|
||||||
|
ipos = NSImageAbove;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* We store the values we need to customize the drawing into titleRect and
|
/* We store the values we need to customize the drawing into titleRect and
|
||||||
imageRect. */
|
imageRect. */
|
||||||
|
switch (ipos)
|
||||||
|
{
|
||||||
|
case NSNoImage:
|
||||||
|
titleRect = cellFrame;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NSImageOnly:
|
||||||
|
imageRect = cellFrame;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
case NSImageBelow:
|
||||||
|
titleRect.origin.x = cellFrame.origin.x;
|
||||||
|
titleRect.origin.y = NSMaxY(cellFrame) - titleSize.height - InsetItemTextY;
|
||||||
|
titleRect.size.width = cellFrame.size.width;
|
||||||
|
titleRect.size.height = titleSize.height;
|
||||||
|
|
||||||
|
imageRect.origin.x = cellFrame.origin.x;
|
||||||
|
imageRect.origin.y = cellFrame.origin.y;
|
||||||
|
imageRect.size.width = cellFrame.size.width;
|
||||||
|
imageRect.size.height = cellFrame.size.height - titleRect.size.height;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NSImageAbove:
|
||||||
titleRect.origin.x = cellFrame.origin.x;
|
titleRect.origin.x = cellFrame.origin.x;
|
||||||
titleRect.origin.y = cellFrame.origin.y + InsetItemTextY;
|
titleRect.origin.y = cellFrame.origin.y + InsetItemTextY;
|
||||||
titleRect.size.width = cellFrame.size.width;
|
titleRect.size.width = cellFrame.size.width;
|
||||||
titleRect.size.height = titleSize.height;
|
titleRect.size.height = titleSize.height;
|
||||||
|
|
||||||
imageRect.origin.x = cellFrame.origin.x;
|
imageRect.origin.x = cellFrame.origin.x;
|
||||||
imageRect.origin.y = cellFrame.origin.y;
|
imageRect.origin.y = cellFrame.origin.y + titleRect.size.height;
|
||||||
if ([self imagePosition] != NSImageOnly)
|
|
||||||
imageRect.origin.y += titleRect.size.height;
|
|
||||||
imageRect.size.width = cellFrame.size.width;
|
imageRect.size.width = cellFrame.size.width;
|
||||||
imageRect.size.height = cellFrame.size.height;
|
imageRect.size.height = cellFrame.size.height - titleRect.size.height;
|
||||||
if ([self imagePosition] != NSImageOnly)
|
break;
|
||||||
imageRect.size.height -= titleRect.size.height;
|
}
|
||||||
|
|
||||||
[super drawInteriorWithFrame: cellFrame inView: controlView];
|
[super drawInteriorWithFrame: cellFrame inView: controlView];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue