blob: 65970608a28321f78cb5f2c5a2f692eb75ff7645 [file] [log] [blame]
Alexandre Lisione77f6f92016-04-17 23:39:39 -04001/*
2 * Copyright (C) 2016 Savoir-faire Linux Inc.
3 * Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20#import "BackgroundView.h"
21
22@interface BackgroundView()
23
24@property __strong NSImage* centerImage;
25
26@end
27
28@implementation BackgroundView
29
30-(void) awakeFromNib
31{
32 switch (self.theme) {
33 case Dark:
34 self.centerImage = [NSImage imageNamed:@"background-dark.png"];
35 break;
36 case Light:
37 default:
38 self.centerImage = [NSImage imageNamed:@"background-light.png"];
39 break;
40 }
41}
42
43- (void) drawRect:(NSRect)dirtyRect
44{
45 NSDrawThreePartImage([self frame], nil, self.centerImage, nil, NO, NSCompositeSourceOver, 1.0, NO);
46}
47
48@end