michael@0: michael@0: /* michael@0: * Copyright 2011 Google Inc. michael@0: * michael@0: * Use of this source code is governed by a BSD-style license that can be michael@0: * found in the LICENSE file. michael@0: */ michael@0: michael@0: #import "SkSampleNSView.h" michael@0: #include "SampleApp.h" michael@0: #include michael@0: @implementation SkSampleNSView michael@0: michael@0: - (id)initWithDefaults { michael@0: if ((self = [super initWithDefaults])) { michael@0: fWind = new SampleWindow(self, *_NSGetArgc(), *_NSGetArgv(), NULL); michael@0: } michael@0: return self; michael@0: } michael@0: michael@0: - (void)dealloc { michael@0: delete fWind; michael@0: [super dealloc]; michael@0: } michael@0: michael@0: - (void)swipeWithEvent:(NSEvent *)event { michael@0: CGFloat x = [event deltaX]; michael@0: if (x < 0) michael@0: ((SampleWindow*)fWind)->previousSample(); michael@0: else if (x > 0) michael@0: ((SampleWindow*)fWind)->nextSample(); michael@0: else michael@0: ((SampleWindow*)fWind)->showOverview(); michael@0: } michael@0: michael@0: @end