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