comparison dwt/internal/cocoa/NSActionCell.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.NSActionCell; 14 module dwt.internal.cocoa.NSActionCell;
15 15
16 import dwt.internal.cocoa.id; 16 import dwt.dwthelper.utils;
17
18 import cocoa = dwt.internal.cocoa.id;
17 import dwt.internal.cocoa.NSCell; 19 import dwt.internal.cocoa.NSCell;
18 import dwt.internal.cocoa.NSFont;
19 import dwt.internal.cocoa.NSImage; 20 import dwt.internal.cocoa.NSImage;
20 import dwt.internal.cocoa.NSInteger; 21 import dwt.internal.cocoa.NSText;
21 import dwt.internal.cocoa.NSString;
22 import dwt.internal.cocoa.NSView;
23 import dwt.internal.cocoa.OS; 22 import dwt.internal.cocoa.OS;
24 import objc = dwt.internal.objc.runtime; 23 import objc = dwt.internal.objc.runtime;
25 24
26 public class NSActionCell : NSCell 25 public class NSActionCell : NSCell {
27 {
28 public this ()
29 {
30 super();
31 }
32 26
33 public this (objc.id id) 27 public this() {
34 { 28 super();
35 super(id); 29 }
36 }
37 30
38 public objc.SEL action () 31 public this(objc.id id) {
39 { 32 super(id);
40 return cast(objc.SEL) OS.objc_msgSend(this.id_, OS.sel_action); 33 }
41 }
42 34
43 public NSView controlView () 35 public this(cocoa.id id) {
44 { 36 super(id);
45 objc.id result = OS.objc_msgSend(this.id_, OS.sel_controlView); 37 }
46 return result !is null ? new NSView(result) : null;
47 }
48 38
49 public double doubleValue () 39 public void setAlignment(NSTextAlignment mode) {
50 { 40 OS.objc_msgSend(this.id, OS.sel_setAlignment_, mode);
51 return cast(double) OS.objc_msgSend_fpret(this.id_, OS.sel_doubleValue); 41 }
52 }
53 42
54 public float floatValue () 43 public void setImage(NSImage image) {
55 { 44 OS.objc_msgSend(this.id, OS.sel_setImage_, image !is null ? image.id : null);
56 return cast(float) OS.objc_msgSend_fpret(this.id_, OS.sel_floatValue); 45 }
57 }
58
59 public int intValue ()
60 {
61 return cast(int) OS.objc_msgSend(this.id_, OS.sel_intValue);
62 }
63
64 public NSInteger integerValue ()
65 {
66 return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_integerValue);
67 }
68
69 public void setAction (objc.SEL aSelector)
70 {
71 OS.objc_msgSend(this.id_, OS.sel_setAction_1, aSelector);
72 }
73
74 public void setAlignment (objc.id mode)
75 {
76 OS.objc_msgSend(this.id_, OS.sel_setAlignment_1, mode);
77 }
78
79 public void setBezeled (bool flag)
80 {
81 OS.objc_msgSend(this.id_, OS.sel_setBezeled_1, flag);
82 }
83
84 public void setBordered (bool flag)
85 {
86 OS.objc_msgSend(this.id_, OS.sel_setBordered_1, flag);
87 }
88
89 public void setControlView (NSView view)
90 {
91 OS.objc_msgSend(this.id_, OS.sel_setControlView_1, view !is null ? view.id_ : null);
92 }
93
94 public void setEnabled (bool flag)
95 {
96 OS.objc_msgSend(this.id_, OS.sel_setEnabled_1, flag);
97 }
98
99 public void setFloatingPointFormat (bool autoRange, NSUInteger leftDigits, NSUInteger rightDigits)
100 {
101 OS.objc_msgSend(this.id_, OS.sel_setFloatingPointFormat_1left_1right_1, autoRange, leftDigits, rightDigits);
102 }
103
104 public void setFont (NSFont fontObj)
105 {
106 OS.objc_msgSend(this.id_, OS.sel_setFont_1, fontObj !is null ? fontObj.id_ : null);
107 }
108
109 public void setImage (NSImage image)
110 {
111 OS.objc_msgSend(this.id_, OS.sel_setImage_1, image !is null ? image.id_ : null);
112 }
113
114 public void setObjectValue (id obj)
115 {
116 OS.objc_msgSend(this.id_, OS.sel_setObjectValue_1, obj !is null ? obj.id_ : null);
117 }
118
119 public void setTag (NSInteger anInt)
120 {
121 OS.objc_msgSend(this.id_, OS.sel_setTag_1, anInt);
122 }
123
124 public void setTarget (id anObject)
125 {
126 OS.objc_msgSend(this.id_, OS.sel_setTarget_1, anObject !is null ? anObject.id_ : null);
127 }
128
129 public NSString StringValue ()
130 {
131 objc.id result = OS.objc_msgSend(this.id_, OS.sel_stringValue);
132 return result !is null ? new NSString(result) : null;
133 }
134
135 public NSInteger tag ()
136 {
137 return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_tag);
138 }
139
140 public id target ()
141 {
142 objc.id result = OS.objc_msgSend(this.id_, OS.sel_target);
143 return result !is null ? new id(result) : null;
144 }
145 46
146 } 47 }