Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSImageView.d @ 45:d8635bb48c7c
Merge with SWT 3.5
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Mon, 01 Dec 2008 17:07:00 +0100 |
parents | f565d3a95c0a |
children | 62202ce0039f |
comparison
equal
deleted
inserted
replaced
44:ca5e494f2bbf | 45:d8635bb48c7c |
---|---|
1 /******************************************************************************* | 1 /******************************************************************************* |
2 * Copyright (c) 2007 IBM Corporation and others. | 2 * Copyright (c) 2000, 2008 IBM Corporation and others. |
3 * All rights reserved. This program and the accompanying materials | 3 * All rights reserved. This program and the accompanying materials |
4 * are made available under the terms of the Eclipse Public License v1.0 | 4 * are made available under the terms of the Eclipse Public License v1.0 |
5 * which accompanies this distribution, and is available at | 5 * which accompanies this distribution, and is available at |
6 * http://www.eclipse.org/legal/epl-v10.html | 6 * http://www.eclipse.org/legal/epl-v10.html |
7 * | 7 * |
8 * Contributors: | 8 * Contributors: |
9 * IBM Corporation - initial API and implementation | 9 * IBM Corporation - initial API and implementation |
10 * | 10 * |
11 * Port to the D programming language: | 11 * Port to the D programming language: |
12 * Jacob Carlborg <jacob.carlborg@gmail.com> | 12 * Jacob Carlborg <doob@me.com> |
13 *******************************************************************************/ | 13 *******************************************************************************/ |
14 module dwt.internal.cocoa.NSImageView; | 14 module dwt.internal.cocoa.NSImageView; |
15 | 15 |
16 import dwt.dwthelper.utils; | |
17 import cocoa = dwt.internal.cocoa.id; | |
18 import dwt.internal.cocoa.NSCell; | |
16 import dwt.internal.cocoa.NSControl; | 19 import dwt.internal.cocoa.NSControl; |
17 import dwt.internal.cocoa.NSImage; | 20 import dwt.internal.cocoa.NSImage; |
18 import dwt.internal.cocoa.NSImageCell : NSImageAlignment, NSImageFrameStyle, NSImageScaling; | 21 import dwt.internal.cocoa.NSImageCell; |
19 import dwt.internal.cocoa.OS; | 22 import dwt.internal.cocoa.OS; |
20 import objc = dwt.internal.objc.runtime; | 23 import objc = dwt.internal.objc.runtime; |
21 | 24 |
22 public class NSImageView : NSControl | 25 public class NSImageView : NSControl { |
23 { | |
24 | 26 |
25 public this () | 27 public this() { |
26 { | 28 super(); |
27 super(); | 29 } |
28 } | |
29 | 30 |
30 public this (objc.id id) | 31 public this(objc.id id) { |
31 { | 32 super(id); |
32 super(id); | 33 } |
33 } | |
34 | 34 |
35 public bool allowsCutCopyPaste () | 35 public this(cocoa.id id) { |
36 { | 36 super(id); |
37 return OS.objc_msgSend(this.id_, OS.sel_allowsCutCopyPaste) !is null; | 37 } |
38 } | |
39 | 38 |
40 public bool animates () | 39 public void setImage(NSImage newImage) { |
41 { | 40 OS.objc_msgSend(this.id, OS.sel_setImage_, newImage !is null ? newImage.id : null); |
42 return OS.objc_msgSend(this.id_, OS.sel_animates) !is null; | 41 } |
43 } | |
44 | 42 |
45 public NSImage image () | 43 public void setImageAlignment(NSImageAlignment newAlign) { |
46 { | 44 OS.objc_msgSend(this.id, OS.sel_setImageAlignment_, newAlign); |
47 objc.id result = OS.objc_msgSend(this.id_, OS.sel_image); | 45 } |
48 return result !is null ? new NSImage(result) : null; | |
49 } | |
50 | 46 |
51 public NSImageAlignment imageAlignment () | 47 public void setImageScaling(NSImageScaling newScaling) { |
52 { | 48 OS.objc_msgSend(this.id, OS.sel_setImageScaling_, newScaling); |
53 return cast(NSImageAlignment) OS.objc_msgSend(this.id_, OS.sel_imageAlignment); | 49 } |
54 } | |
55 | 50 |
56 public NSImageFrameStyle imageFrameStyle () | 51 public static objc.Class cellClass() { |
57 { | 52 return OS.objc_msgSend(OS.class_NSImageView, OS.sel_cellClass); |
58 return cast(NSImageFrameStyle) OS.objc_msgSend(this.id_, OS.sel_imageFrameStyle); | 53 } |
59 } | |
60 | 54 |
61 public NSImageScaling imageScaling () | 55 public static void setCellClass(objc.Class factoryId) { |
62 { | 56 OS.objc_msgSend(OS.class_NSImageView, OS.sel_setCellClass_, factoryId); |
63 return cast(NSImageScaling) OS.objc_msgSend(this.id_, OS.sel_imageScaling); | 57 } |
64 } | |
65 | |
66 public bool isEditable () | |
67 { | |
68 return OS.objc_msgSend(this.id_, OS.sel_isEditable) !is null; | |
69 } | |
70 | |
71 public void setAllowsCutCopyPaste (bool allow) | |
72 { | |
73 OS.objc_msgSend(this.id_, OS.sel_setAllowsCutCopyPaste_1, allow); | |
74 } | |
75 | |
76 public void setAnimates (bool flag) | |
77 { | |
78 OS.objc_msgSend(this.id_, OS.sel_setAnimates_1, flag); | |
79 } | |
80 | |
81 public void setEditable (bool yn) | |
82 { | |
83 OS.objc_msgSend(this.id_, OS.sel_setEditable_1, yn); | |
84 } | |
85 | |
86 public void setImage (NSImage newImage) | |
87 { | |
88 OS.objc_msgSend(this.id_, OS.sel_setImage_1, newImage !is null ? newImage.id_ : null); | |
89 } | |
90 | |
91 public void setImageAlignment (NSImageAlignment newAlign) | |
92 { | |
93 OS.objc_msgSend(this.id_, OS.sel_setImageAlignment_1, newAlign); | |
94 } | |
95 | |
96 public void setImageFrameStyle (NSImageFrameStyle newStyle) | |
97 { | |
98 OS.objc_msgSend(this.id_, OS.sel_setImageFrameStyle_1, newStyle); | |
99 } | |
100 | |
101 public void setImageScaling (NSImageScaling newScaling) | |
102 { | |
103 OS.objc_msgSend(this.id_, OS.sel_setImageScaling_1, newScaling); | |
104 } | |
105 | 58 |
106 } | 59 } |