Mercurial > projects > dwt-mac
view dwt/internal/cocoa/NSRulerMarker.d @ 1:8b48be5454ce
The internal cocoa classes compile now
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Tue, 19 Aug 2008 17:35:17 +0200 |
parents | 380af2bdd8e5 |
children | f565d3a95c0a |
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.NSRulerMarker; import dwt.internal.cocoa.CGFloat; import dwt.internal.cocoa.id; import dwt.internal.cocoa.NSEvent; import dwt.internal.cocoa.NSImage; import dwt.internal.cocoa.NSObject; import dwt.internal.cocoa.NSPoint; import dwt.internal.cocoa.NSRect; import dwt.internal.cocoa.NSRulerView; import dwt.internal.cocoa.OS; import objc = dwt.internal.objc.runtime; public class NSRulerMarker : NSObject { public this () { super(); } public this (objc.id id) { super(id); } public void drawRect (NSRect rect) { OS.objc_msgSend(this.id_, OS.sel_drawRect_1, rect); } public NSImage image () { objc.id result = OS.objc_msgSend(this.id_, OS.sel_image); return result !is null ? new NSImage(result) : null; } public NSPoint imageOrigin () { NSPoint result; OS.objc_msgSend_stret(&result, this.id_, OS.sel_imageOrigin); return result; } public NSRect imageRectInRuler () { NSRect result; OS.objc_msgSend_stret(&result, this.id_, OS.sel_imageRectInRuler); return result; } public id initWithRulerView (NSRulerView ruler, CGFloat location, NSImage image, NSPoint imageOrigin) { objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithRulerView_1markerLocation_1image_1imageOrigin_1, ruler !is null ? ruler.id_ : null, location, image !is null ? image.id_ : null, imageOrigin); return result !is null ? new id(result) : null; } public bool isDragging () { return OS.objc_msgSend(this.id_, OS.sel_isDragging) !is null; } public bool isMovable () { return OS.objc_msgSend(this.id_, OS.sel_isMovable) !is null; } public bool isRemovable () { return OS.objc_msgSend(this.id_, OS.sel_isRemovable) !is null; } public CGFloat markerLocation () { return cast(CGFloat) OS.objc_msgSend_fpret(this.id_, OS.sel_markerLocation); } public id representedObject () { objc.id result = OS.objc_msgSend(this.id_, OS.sel_representedObject); return result !is null ? new id(result) : null; } public NSRulerView ruler () { objc.id result = OS.objc_msgSend(this.id_, OS.sel_ruler); return result !is null ? new NSRulerView(result) : null; } public void setImage (NSImage image) { OS.objc_msgSend(this.id_, OS.sel_setImage_1, image !is null ? image.id_ : null); } public void setImageOrigin (NSPoint imageOrigin) { OS.objc_msgSend(this.id_, OS.sel_setImageOrigin_1, imageOrigin); } public void setMarkerLocation (CGFloat location) { OS.objc_msgSend(this.id_, OS.sel_setMarkerLocation_1, location); } public void setMovable (bool flag) { OS.objc_msgSend(this.id_, OS.sel_setMovable_1, flag); } public void setRemovable (bool flag) { OS.objc_msgSend(this.id_, OS.sel_setRemovable_1, flag); } public void setRepresentedObject (id representedObject) { OS.objc_msgSend(this.id_, OS.sel_setRepresentedObject_1, representedObject !is null ? representedObject.id_ : null); } public CGFloat thicknessRequiredInRuler () { return cast(CGFloat) OS.objc_msgSend_fpret(this.id_, OS.sel_thicknessRequiredInRuler); } public bool trackMouse (NSEvent mouseDownEvent, bool isAdding) { return OS.objc_msgSend(this.id_, OS.sel_trackMouse_1adding_1, mouseDownEvent !is null ? mouseDownEvent.id_ : null, isAdding) !is null; } }