diff options
Diffstat (limited to 'macosx/HBFocusRingView.m')
-rw-r--r-- | macosx/HBFocusRingView.m | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/macosx/HBFocusRingView.m b/macosx/HBFocusRingView.m new file mode 100644 index 000000000..6ff2412a7 --- /dev/null +++ b/macosx/HBFocusRingView.m @@ -0,0 +1,32 @@ +/* HBFocusRingView + + This file is part of the HandBrake source code. + Homepage: <http://handbrake.fr/>. + It may be used under the terms of the GNU General Public License. + */ + +#import "HBFocusRingView.h" + +@implementation HBFocusRingView + +- (void)drawRect:(NSRect)dirtyRect +{ + [super drawRect:dirtyRect]; + + if (self.showFocusRing) + { + [NSGraphicsContext saveGraphicsState]; + NSRect focusRect = NSInsetRect(self.bounds, 2, 2); + NSSetFocusRingStyle(NSFocusRingOnly); + NSRectFill(focusRect); + [NSGraphicsContext restoreGraphicsState]; + } +} + +- (void)setShowFocusRing:(BOOL)showFocusRing +{ + _showFocusRing = showFocusRing; + [self setNeedsDisplay:YES]; +} + +@end |