comparison dstep/appkit/NSOpenGLView.d @ 16:19885b43130e

Huge update, the bridge actually works now
author Jacob Carlborg <doob@me.com>
date Sun, 03 Jan 2010 22:06:11 +0100
parents
children b9de51448c6b
comparison
equal deleted inserted replaced
15:7ff919f595d5 16:19885b43130e
1 /**
2 * Copyright: Copyright (c) 2009 Jacob Carlborg.
3 * Authors: Jacob Carlborg
4 * Version: Initial created: Sep 24, 2009
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
6 */
7 module dstep.appkit.NSOpenGLView;
8
9 import dstep.appkit.NSOpenGL;
10 import dstep.appkit.NSView;
11 import dstep.foundation.NSGeometry;
12 import dstep.objc.bridge.Bridge;
13 import dstep.objc.objc;
14
15 class NSOpenGLView : NSView
16 {
17 mixin (ObjcWrap);
18
19 static NSOpenGLPixelFormat defaultPixelFormat ()
20 {
21 return invokeObjcSelfClass!(NSOpenGLPixelFormat, "defaultPixelFormat");
22 }
23
24 NSOpenGLView initWithFrame (NSRect frameRect, NSOpenGLPixelFormat format)
25 {
26 id result = invokeObjcSelf!(id, "initWithFrame:pixelFormat:", NSRect, NSOpenGLPixelFormat)(frameRect, format);
27 return result is this.objcObject ? this : (result !is null ? new NSOpenGLView(result) : null);
28 }
29
30 this (NSRect frameRect, NSOpenGLPixelFormat format)
31 {
32 super(NSOpenGLView.alloc.initWithFrame(frameRect, format).objcObject);
33 }
34
35 void setOpenGLContext (NSOpenGLContext context)
36 {
37 return invokeObjcSelf!(void, "setOpenGLContext:", NSOpenGLContext)(context);
38 }
39
40 NSOpenGLContext openGLContext ()
41 {
42 return invokeObjcSelf!(NSOpenGLContext, "openGLContext");
43 }
44
45 void clearGLContext ()
46 {
47 return invokeObjcSelf!(void, "clearGLContext");
48 }
49
50 void update ()
51 {
52 return invokeObjcSelf!(void, "update");
53 }
54
55 void reshape ()
56 {
57 return invokeObjcSelf!(void, "reshape");
58 }
59
60 void setPixelFormat (NSOpenGLPixelFormat pixelFormat)
61 {
62 return invokeObjcSelf!(void, "setPixelFormat:", NSOpenGLPixelFormat)(pixelFormat);
63 }
64
65 NSOpenGLPixelFormat pixelFormat ()
66 {
67 return invokeObjcSelf!(NSOpenGLPixelFormat, "pixelFormat");
68 }
69
70 void prepareOpenGL ()
71 {
72 return invokeObjcSelf!(void, "prepareOpenGL");
73 }
74 }
75