updated graphics, text color

git-svn-id: svn://qnap.local/TwoTerm/branches/frameless@2471 5590a31f-7b70-45f8-8c82-aa3a8e5f4507
This commit is contained in:
Kelvin Sherlock 2012-08-04 22:35:03 +00:00
parent a3271980d3
commit 91ac76dfb6
2 changed files with 29 additions and 6 deletions

View File

@ -11,6 +11,7 @@
@interface TitleBarView : NSView
{
NSColor *_backgroundColor;
NSColor *_textColor;
NSTextField *_label;
NSImage *_rightImage;
NSImage *_leftImage;
@ -20,6 +21,7 @@
}
@property (nonatomic, retain) NSColor *backgroundColor;
@property (nonatomic, retain) NSColor *textColor;
@property (nonatomic, retain) IBOutlet NSTextField *label;
@property (nonatomic, retain) NSString *title;

View File

@ -13,6 +13,7 @@
@implementation TitleBarView
@synthesize label = _label;
@synthesize backgroundColor = _backgroundColor;
@synthesize textColor = _textColor;
-(id)initWithFrame:(NSRect)frameRect
{
@ -27,9 +28,9 @@
-(void)awakeFromNib
{
_leftImage = [[NSImage imageNamed: @"titlebar-left.png"] retain];
_rightImage = [[NSImage imageNamed: @"titlebar-right.png"] retain];
_centerImage = [[NSImage imageNamed: @"titlebar-center.png"] retain];
_leftImage = [[NSImage imageNamed: @"titlebar-left"] retain];
_rightImage = [[NSImage imageNamed: @"titlebar-right"] retain];
_centerImage = [[NSImage imageNamed: @"titlebar-center"] retain];
@ -41,6 +42,7 @@
-(void)dealloc
{
[_backgroundColor release];
[_textColor release];
[_leftImage release];
[_rightImage release];
[_centerImage release];
@ -71,6 +73,16 @@
[self updateTitle];
}
-(void)setTextColor: (NSColor *)textColor
{
if (_textColor == textColor) return;
[_textColor release];
_textColor = [textColor retain];
[_label setTextColor: _textColor];
//[self updateTitle];
}
-(void)setTitle:(NSString *)title
{
[_label setStringValue: title];
@ -102,7 +114,7 @@
return;
}
[_label setTextColor: _dark ? [NSColor whiteColor] : [NSColor blackColor]];
//[_label setTextColor: _dark ? [NSColor whiteColor] : [NSColor blackColor]];
shadow = [NSShadow new];
[shadow setShadowBlurRadius: 1.0];
@ -123,6 +135,7 @@
[as release];
[ps release];
[shadow release];
}
@ -144,7 +157,8 @@
bounds = [self bounds];
NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect: NSMakeRect(0, 0, bounds.size.width, bounds.size.height)
rect = NSMakeRect(0, 0, bounds.size.width, bounds.size.height);
NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect: rect
xRadius: 4.0
yRadius: 4.0];
[path addClip];
@ -155,7 +169,14 @@
rect = NSMakeRect(0, 0, bounds.size.width, 24.0);
rect = NSInsetRect(rect, 1, 0);
NSDrawThreePartImage(rect, _leftImage, _centerImage, _rightImage, NO, NSCompositeSourceOver, 1.0, YES);
NSDrawThreePartImage(rect,
_leftImage,
_centerImage,
_rightImage,
NO,
NSCompositeSourceOver /*NSCompositeDestinationOver*/,
1.0,
YES);
}