1 /* 2 * Copyright 2016 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #ifndef Window_mac_DEFINED 9 #define Window_mac_DEFINED 10 11 #include "../Window.h" 12 13 #import <Cocoa/Cocoa.h> 14 15 namespace sk_app { 16 17 class Window_mac : public Window { 18 public: Window_mac()19 Window_mac() 20 : INHERITED() 21 , fWindow(nil) 22 , fMSAASampleCount(1) {} ~Window_mac()23 ~Window_mac() override { 24 this->closeWindow(); 25 } 26 27 bool initWindow(); 28 29 void setTitle(const char*) override; 30 void show() override; 31 32 bool attach(BackendType) override; 33 34 void onInval() override; 35 view()36 NSView* view() { return [fWindow contentView]; } 37 void closeWindow(); 38 39 private: 40 NSWindow* fWindow; 41 int fMSAASampleCount; 42 43 typedef Window INHERITED; 44 }; 45 46 } // namespace sk_app 47 48 #endif 49