1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/skia/trunk/src/views/mac/SkSampleNSView.mm Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,36 @@ 1.4 + 1.5 +/* 1.6 + * Copyright 2011 Google Inc. 1.7 + * 1.8 + * Use of this source code is governed by a BSD-style license that can be 1.9 + * found in the LICENSE file. 1.10 + */ 1.11 + 1.12 +#import "SkSampleNSView.h" 1.13 +#include "SampleApp.h" 1.14 +#include <crt_externs.h> 1.15 +@implementation SkSampleNSView 1.16 + 1.17 +- (id)initWithDefaults { 1.18 + if ((self = [super initWithDefaults])) { 1.19 + fWind = new SampleWindow(self, *_NSGetArgc(), *_NSGetArgv(), NULL); 1.20 + } 1.21 + return self; 1.22 +} 1.23 + 1.24 +- (void)dealloc { 1.25 + delete fWind; 1.26 + [super dealloc]; 1.27 +} 1.28 + 1.29 +- (void)swipeWithEvent:(NSEvent *)event { 1.30 + CGFloat x = [event deltaX]; 1.31 + if (x < 0) 1.32 + ((SampleWindow*)fWind)->previousSample(); 1.33 + else if (x > 0) 1.34 + ((SampleWindow*)fWind)->nextSample(); 1.35 + else 1.36 + ((SampleWindow*)fWind)->showOverview(); 1.37 +} 1.38 + 1.39 +@end