comparison dwt/internal/cocoa/NSRulerMarker.d @ 0:380af2bdd8e5

Upload of whole dwt tree
author Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
date Sat, 09 Aug 2008 17:00:02 +0200
parents
children 8b48be5454ce
comparison
equal deleted inserted replaced
-1:000000000000 0:380af2bdd8e5
1 /*******************************************************************************
2 * Copyright (c) 2007 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * IBM Corporation - initial API and implementation
10 *
11 * Port to the D Programming language:
12 * Jacob Carlborg <jacob.carlborg@gmail.com>
13 *******************************************************************************/
14 module dwt.internal.cocoa.NSRulerMarker;
15
16 import dwt.internal.cocoa.CGFloat;
17 import dwt.internal.cocoa.id;
18 import dwt.internal.cocoa.NSEvent;
19 import dwt.internal.cocoa.NSImage;
20 import dwt.internal.cocoa.NSObject;
21 import dwt.internal.cocoa.NSPoint;
22 import dwt.internal.cocoa.NSRect;
23 import dwt.internal.cocoa.NSRulerView;
24 import dwt.internal.cocoa.OS;
25 import objc = dwt.internal.objc.runtime;
26
27 public class NSRulerMarker : NSObject
28 {
29
30 public this ()
31 {
32 super();
33 }
34
35 public this (objc.id id)
36 {
37 super(id);
38 }
39
40 public void drawRect (NSRect rect)
41 {
42 OS.objc_msgSend(this.id, OS.sel_drawRect_1, rect);
43 }
44
45 public NSImage image ()
46 {
47 objc.id result = OS.objc_msgSend(this.id, OS.sel_image);
48 return result !is null ? new NSImage(result) : null;
49 }
50
51 public NSPoint imageOrigin ()
52 {
53 NSPoint result;
54 OS.objc_msgSend_stret(result, this.id, OS.sel_imageOrigin);
55 return result;
56 }
57
58 public NSRect imageRectInRuler ()
59 {
60 NSRect result;
61 OS.objc_msgSend_stret(result, this.id, OS.sel_imageRectInRuler);
62 return result;
63 }
64
65 public id initWithRulerView (NSRulerView ruler, CGFloat location, NSImage image, NSPoint imageOrigin)
66 {
67 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithRulerView_1markerLocation_1image_1imageOrigin_1, ruler !is null ? ruler.id : null,
68 location, image !is null ? image.id : null, imageOrigin);
69 return result !is null ? new id(result) : null;
70 }
71
72 public bool isDragging ()
73 {
74 return OS.objc_msgSend(this.id, OS.sel_isDragging) !is null;
75 }
76
77 public bool isMovable ()
78 {
79 return OS.objc_msgSend(this.id, OS.sel_isMovable) !is null;
80 }
81
82 public bool isRemovable ()
83 {
84 return OS.objc_msgSend(this.id, OS.sel_isRemovable) !is null;
85 }
86
87 public CGFloat markerLocation ()
88 {
89 return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_markerLocation);
90 }
91
92 public id representedObject ()
93 {
94 objc.id result = OS.objc_msgSend(this.id, OS.sel_representedObject);
95 return result !is null ? new id(result) : null;
96 }
97
98 public NSRulerView ruler ()
99 {
100 objc.id result = OS.objc_msgSend(this.id, OS.sel_ruler);
101 return result !is null ? new NSRulerView(result) : null;
102 }
103
104 public void setImage (NSImage image)
105 {
106 OS.objc_msgSend(this.id, OS.sel_setImage_1, image !is null ? image.id : null);
107 }
108
109 public void setImageOrigin (NSPoint imageOrigin)
110 {
111 OS.objc_msgSend(this.id, OS.sel_setImageOrigin_1, imageOrigin);
112 }
113
114 public void setMarkerLocation (CGFloat location)
115 {
116 OS.objc_msgSend(this.id, OS.sel_setMarkerLocation_1, location);
117 }
118
119 public void setMovable (bool flag)
120 {
121 OS.objc_msgSend(this.id, OS.sel_setMovable_1, flag);
122 }
123
124 public void setRemovable (bool flag)
125 {
126 OS.objc_msgSend(this.id, OS.sel_setRemovable_1, flag);
127 }
128
129 public void setRepresentedObject (id representedObject)
130 {
131 OS.objc_msgSend(this.id, OS.sel_setRepresentedObject_1, representedObject !is null ? representedObject.id : null);
132 }
133
134 public CGFloat thicknessRequiredInRuler ()
135 {
136 return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_thicknessRequiredInRuler);
137 }
138
139 public bool trackMouse (NSEvent mouseDownEvent, bool isAdding)
140 {
141 return OS.objc_msgSend(this.id, OS.sel_trackMouse_1adding_1, mouseDownEvent !is null ? mouseDownEvent.id : null, isAdding) !is null;
142 }
143
144 }