ASPiK SDK
cocoaopenglview.h
1 // This file is part of VSTGUI. It is subject to the license terms
2 // in the LICENSE file found in the top-level directory of this
3 // distribution and at http://github.com/steinbergmedia/vstgui/LICENSE
4 
5 #ifndef __cocoaopenglview__
6 #define __cocoaopenglview__
7 
8 #include "../../iplatformopenglview.h"
9 
10 #if VSTGUI_OPENGL_SUPPORT
11 #if MAC_COCOA
12 
13 #ifdef __OBJC__
14 #import <Cocoa/Cocoa.h>
15 #else
16 struct NSOpenGLView;
17 struct NSView;
18 #endif
19 
20 namespace VSTGUI {
21 class NSViewFrame;
22 
23 //-----------------------------------------------------------------------------
24 class CocoaOpenGLView : public IPlatformOpenGLView
25 {
26 public:
27  CocoaOpenGLView (NSView* parent);
28  ~CocoaOpenGLView () noexcept override = default;
29 
30  bool init (IOpenGLView* view, PixelFormat* pixelFormat = nullptr) override;
31  void remove () override;
32 
33  void invalidRect (const CRect& rect) override;
34  void viewSizeChanged (const CRect& visibleSize) override;
35 
36  bool makeContextCurrent () override;
37  bool lockContext () override;
38  bool unlockContext () override;
39 
40  void swapBuffers () override;
41 
42  void doDraw (const CRect& r);
43  void reshape ();
44 protected:
45  static void initClass ();
46 
47  NSView* parent;
48  NSOpenGLView* platformView;
49  IOpenGLView* view;
50  PixelFormat pixelFormat;
51 };
52 
53 } // namespace
54 
55 #endif // MAC_COCOA
56 #endif // VSTGUI_OPENGL_SUPPORT
57 
58 #endif // __cocoaopenglview__
Definition: customcontrols.cpp:8