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     void disableErrorMessageDialog() 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 setOrientation(int width, int height) override;
49     bool setPosition(int x, int y) override;
50     bool resize(int width, int height) override;
51     void setVisible(bool isVisible) override;
52 
53     void signalTestEvent() override;
54 
55     NSWindow *getNSWindow() const;
56 
57   private:
58     bool initializeImpl(const std::string &name, int width, int height) override;
59 
60     NSWindow *mWindow;
61     WindowDelegate *mDelegate;
62     ContentView *mView;
63 };
64 
65 #endif  // UTIL_OSX_WINDOW_H_
66