Mercurial > projects > dwt-mac
view dwt/internal/cocoa/NSOpenGLView.d @ 13:f565d3a95c0a
Ported dwt.internal
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Fri, 22 Aug 2008 16:46:34 +0200 |
parents | 8b48be5454ce |
children | d8635bb48c7c |
line wrap: on
line source
/******************************************************************************* * Copyright (c) 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation * * Port to the D programming language: * Jacob Carlborg <jacob.carlborg@gmail.com> *******************************************************************************/ module dwt.internal.cocoa.NSOpenGLView; import dwt.internal.cocoa.NSOpenGLContext; import dwt.internal.cocoa.NSOpenGLPixelFormat; import dwt.internal.cocoa.NSRect; import dwt.internal.cocoa.NSView; import dwt.internal.cocoa.OS; import objc = dwt.internal.objc.runtime; public class NSOpenGLView : NSView { public this () { super(); } public this (objc.id id) { super(id); } public void clearGLContext () { OS.objc_msgSend(this.id_, OS.sel_clearGLContext); } public static NSOpenGLPixelFormat defaultPixelFormat () { objc.id result = OS.objc_msgSend(OS.class_NSOpenGLView, OS.sel_defaultPixelFormat); return result !is null ? new NSOpenGLPixelFormat(result) : null; } public NSOpenGLView initWithFrame (NSRect frameRect, NSOpenGLPixelFormat format) { objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithFrame_1pixelFormat_1, frameRect, format !is null ? format.id_ : null); return result !is null ? this : null; } public NSOpenGLContext openGLContext () { objc.id result = OS.objc_msgSend(this.id_, OS.sel_openGLContext); return result !is null ? new NSOpenGLContext(result) : null; } public NSOpenGLPixelFormat pixelFormat () { objc.id result = OS.objc_msgSend(this.id_, OS.sel_pixelFormat); return result !is null ? new NSOpenGLPixelFormat(result) : null; } public void prepareOpenGL () { OS.objc_msgSend(this.id_, OS.sel_prepareOpenGL); } public void reshape () { OS.objc_msgSend(this.id_, OS.sel_reshape); } public void setOpenGLContext (NSOpenGLContext context) { OS.objc_msgSend(this.id_, OS.sel_setOpenGLContext_1, context !is null ? context.id_ : null); } public void setPixelFormat (NSOpenGLPixelFormat pixelFormat) { OS.objc_msgSend(this.id_, OS.sel_setPixelFormat_1, pixelFormat !is null ? pixelFormat.id_ : null); } public void update () { OS.objc_msgSend(this.id_, OS.sel_update); } }