aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/views/mac/SkSampleNSView.mm
blob: 7c0fc5907be9828e1d13402af32f71cca5dbc3e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

/*
 * Copyright 2011 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#import "SkSampleNSView.h"
#include "SampleApp.h"
#include <crt_externs.h>
@implementation SkSampleNSView

- (id)initWithDefaults {
    if ((self = [super initWithDefaults])) {
        fWind = new SampleWindow(self, *_NSGetArgc(), *_NSGetArgv(), NULL);
    }
    return self;
}

- (void)swipeWithEvent:(NSEvent *)event {
    CGFloat x = [event deltaX];
    if (x < 0)
        ((SampleWindow*)fWind)->previousSample();
    else if (x > 0)
        ((SampleWindow*)fWind)->nextSample();
    else
        ((SampleWindow*)fWind)->showOverview();
}

@end