From 5dfdc05f6f8ff481bac0251bbe842366160df214 Mon Sep 17 00:00:00 2001 From: Joseph Spiros Date: Wed, 1 Oct 2003 19:19:55 +0000 Subject: [PATCH] Updated ITButtonCell with custom drawing of title. Stupid NSButtonCell not aligning things :(. --- ITButtonCell.m | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ITButtonCell.m b/ITButtonCell.m index 0f60271..30ac956 100755 --- a/ITButtonCell.m +++ b/ITButtonCell.m @@ -50,7 +50,18 @@ { if ( _subStyle == ITGrayRoundedBezelStyle ) { [self drawGrayRoundedBezelWithFrame:rect inView:controlView]; - [super drawInteriorWithFrame:rect inView:controlView]; + if ( [self attributedTitle] ) { + NSPoint stringOrigin; + NSSize stringSize; + stringSize = [[self attributedTitle] size]; + stringOrigin.x = rect.origin.x + (rect.size.width - stringSize.width)/2; + stringOrigin.y = (rect.origin.y + (rect.size.height - stringSize.height)/2) - 2; + [controlView lockFocus]; + [[self attributedTitle] drawAtPoint:stringOrigin]; + [controlView unlockFocus]; + } else { + [super drawInteriorWithFrame:rect inView:controlView]; + } [[controlView superview] setNeedsDisplay:YES]; } else { [super drawWithFrame:rect inView:controlView]; -- 2.20.1