mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-29 20:47:38 +00:00
* Source/GSThemeDrawing.m (-drawTableViewRect:inView:): Use
correct imp type. * Source/NSButtonCell.m (-setBackgroundColor:): Update the control view. * Source/NSSegmentedCell.m (-drawSegment:inFrame:withView:): * Draw image if available. * Source/NSPopUpButtonCell.m (-initWithCoder:): Add work around for NSClassSwapper cell replacement. Patches based on changes by Josh Freeman <pikopixel@twilightedge.com> git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@39006 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
1d2c5d5ebd
commit
be98a77769
5 changed files with 80 additions and 14 deletions
|
@ -544,28 +544,28 @@
|
|||
withView: (NSView *)view
|
||||
{
|
||||
id segment = [_items objectAtIndex: seg];
|
||||
NSString *label = [segment label];
|
||||
NSSize textSize = [label sizeWithAttributes: [NSDictionary dictionary]];
|
||||
NSRect textFrame = frame;
|
||||
CGFloat x_offset = (frame.size.width - textSize.width) / 2;
|
||||
NSString *label = [self labelForSegment: seg];
|
||||
NSImage *segmentImage = [self imageForSegment: seg];
|
||||
GSThemeControlState state = GSThemeNormalState;
|
||||
BOOL roundedLeft = NO;
|
||||
BOOL roundedRight = NO;
|
||||
|
||||
textFrame.origin.x += x_offset;
|
||||
textFrame.size.width -= x_offset;
|
||||
[segment setFrame: frame];
|
||||
|
||||
if([segment isSelected])
|
||||
if ([segment isSelected])
|
||||
{
|
||||
state = GSThemeSelectedState;
|
||||
}
|
||||
|
||||
if (seg == 0)
|
||||
roundedLeft = YES;
|
||||
{
|
||||
roundedLeft = YES;
|
||||
}
|
||||
|
||||
if (seg == ([_items count] - 1))
|
||||
roundedRight = YES;
|
||||
{
|
||||
roundedRight = YES;
|
||||
}
|
||||
|
||||
[[GSTheme theme] drawSegmentedControlSegment: self
|
||||
withFrame: frame
|
||||
|
@ -574,7 +574,32 @@
|
|||
state: state
|
||||
roundedLeft: roundedLeft
|
||||
roundedRight: roundedRight];
|
||||
[self _drawText: [segment label] inFrame: textFrame];
|
||||
if (label)
|
||||
{
|
||||
NSSize textSize = [label sizeWithAttributes: [self _nonAutoreleasedTypingAttributes]];
|
||||
NSRect textFrame = frame;
|
||||
CGFloat x_offset = (frame.size.width - textSize.width) / 2;
|
||||
|
||||
textFrame.origin.x += x_offset;
|
||||
textFrame.size.width -= x_offset;
|
||||
[self _drawText: label inFrame: textFrame];
|
||||
}
|
||||
|
||||
if (segmentImage)
|
||||
{
|
||||
NSSize size = [segmentImage size];
|
||||
NSPoint position;
|
||||
NSRect destinationRect;
|
||||
|
||||
position.x = MAX(NSMidX(frame) - (size.width/2.), 0.);
|
||||
position.y = MAX(NSMidY(frame) - (size.height/2.), 0.);
|
||||
destinationRect = NSMakeRect(position.x, position.y, size.width, size.height);
|
||||
|
||||
[segmentImage drawInRect: destinationRect
|
||||
fromRect: NSZeroRect
|
||||
operation: NSCompositeSourceOver
|
||||
fraction: 1.0];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) drawInteriorWithFrame: (NSRect)cellFrame
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue