// // RoundRecTextField.m // Flycut // // Flycut by Gennadiy Potapov and contributors. Based on Jumpcut by Steve Cook. // Copyright 2011 General Arcade. All rights reserved. // // This code is open-source software subject to the MIT License; see the homepage // at for details. // // #import "RoundRecTextField.h" #import "RoundRecBezierPath.h" // Okay, on doing some reading, the -best- way to handle this is probably to cache // an NSImage on the init and then (as needed) composite it to the back of the view. // We can then turn the rectangles on and off by compositing or not compositing the // images. // This can wait for another time. @implementation RoundRecTextField // We may want to make this a more flexible class sometime by taking radius as an argument. // Until then, this is kind of useless code. /* - (id)initWithFrame:(NSRect)frame { self = [super initWithFrame:frame]; if (self) { // Initialization code here. } return self; } */ - (BOOL)isOpaque { return NO; } - (void)drawRect:(NSRect)rect { // Oh, the hackishness. NSBezierPath *roundedRec = [NSBezierPath bezierPathWithRoundRectInRect:rect radius:8]; [[self backgroundColor] set]; [roundedRec fill]; [self setDrawsBackground:NO]; // We might eventually want to pass [super drawRect] something smaller than rect, to ensure that we don't bleed over the corners [super drawRect:rect]; [self setDrawsBackground:YES]; } @end