1 // 2 // Copyright 2015 The ANGLE Project Authors. All rights reserved. 3 // Use of this source code is governed by a BSD-style license that can be 4 // found in the LICENSE file. 5 // 6 7 // OSXWindow.h: Definition of the implementation of OSWindow for OSX 8 9 #ifndef UTIL_OSX_WINDOW_H_ 10 #define UTIL_OSX_WINDOW_H_ 11 12 #import <Cocoa/Cocoa.h> 13 14 #include "util/OSWindow.h" 15 16 class OSXWindow; 17 18 @interface WindowDelegate : NSObject { 19 OSXWindow *mWindow; 20 } 21 - (id)initWithWindow:(OSXWindow *)window; 22 @end 23 24 @interface ContentView : NSView { 25 OSXWindow *mWindow; 26 NSTrackingArea *mTrackingArea; 27 int mCurrentModifier; 28 } 29 - (id)initWithWindow:(OSXWindow *)window; 30 @end 31 32 class OSXWindow : public OSWindow 33 { 34 public: 35 OSXWindow(); 36 ~OSXWindow() override; 37 38 bool initialize(const std::string &name, int width, int height) override; 39 void destroy() override; 40 41 void resetNativeWindow() override; 42 EGLNativeWindowType getNativeWindow() const override; 43 EGLNativeDisplayType getNativeDisplay() const override; 44 45 void messageLoop() override; 46 47 void setMousePosition(int x, int y) override; 48 bool setPosition(int x, int y) override; 49 bool resize(int width, int height) override; 50 void setVisible(bool isVisible) override; 51 52 void signalTestEvent() override; 53 54 NSWindow *getNSWindow() const; 55 56 private: 57 NSWindow *mWindow; 58 WindowDelegate *mDelegate; 59 ContentView *mView; 60 }; 61 62 #endif // UTIL_OSX_WINDOW_H_ 63