1
2/*
3 * Copyright 2011 Google Inc.
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
8
9#import "SkSampleNSView.h"
10#include "SampleApp.h"
11#include <crt_externs.h>
12@implementation SkSampleNSView
13
14- (id)initWithDefaults {
15    if ((self = [super initWithDefaults])) {
16        fWind = new SampleWindow(self, *_NSGetArgc(), *_NSGetArgv(), NULL);
17    }
18    return self;
19}
20
21- (void)swipeWithEvent:(NSEvent *)event {
22    CGFloat x = [event deltaX];
23    if (x < 0)
24        ((SampleWindow*)fWind)->previousSample();
25    else if (x > 0)
26        ((SampleWindow*)fWind)->nextSample();
27    else
28        ((SampleWindow*)fWind)->showOverview();
29}
30
31@end
32