Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSTextField.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.NSTextField; | |
15 | |
16 import dwt.internal.cocoa.id; | |
17 import dwt.internal.cocoa.NSColor; | |
18 import dwt.internal.cocoa.NSControl; | |
19 import dwt.internal.cocoa.NSNotification; | |
20 import dwt.internal.cocoa.NSString; | |
21 import dwt.internal.cocoa.NSText; | |
22 import dwt.internal.cocoa.NSTextFieldCell : NSTextFieldBezelStyle; | |
23 import dwt.internal.cocoa.OS; | |
24 import objc = dwt.internal.objc.runtime; | |
25 | |
26 public class NSTextField : NSControl | |
27 { | |
28 | |
29 public this () | |
30 { | |
31 super(); | |
32 } | |
33 | |
34 public this (objc.id id) | |
35 { | |
36 super(id); | |
37 } | |
38 | |
39 public bool acceptsFirstResponder () | |
40 { | |
41 return OS.objc_msgSend(this.id, OS.sel_acceptsFirstResponder) !is null; | |
42 } | |
43 | |
44 public bool allowsEditingTextAttributes () | |
45 { | |
46 return OS.objc_msgSend(this.id, OS.sel_allowsEditingTextAttributes) !is null; | |
47 } | |
48 | |
49 public NSColor backgroundColor () | |
50 { | |
51 objc.id result = OS.objc_msgSend(this.id, OS.sel_backgroundColor); | |
52 return result !is null ? new NSColor(result) : null; | |
53 } | |
54 | |
55 public NSTextFieldBezelStyl bezelStyle () | |
56 { | |
57 return cast(NSTextFieldBezelStyle) OS.objc_msgSend(this.id, OS.sel_bezelStyle); | |
58 } | |
59 | |
60 public id delegatee () | |
61 { | |
62 objc.id result = OS.objc_msgSend(this.id, OS.sel_delegate); | |
63 return result !is null ? new id(result) : null; | |
64 } | |
65 | |
66 public bool drawsBackground () | |
67 { | |
68 return OS.objc_msgSend(this.id, OS.sel_drawsBackground) !is null; | |
69 } | |
70 | |
71 public bool importsGraphics () | |
72 { | |
73 return OS.objc_msgSend(this.id, OS.sel_importsGraphics) !is null; | |
74 } | |
75 | |
76 public bool isBezeled () | |
77 { | |
78 return OS.objc_msgSend(this.id, OS.sel_isBezeled) !is null; | |
79 } | |
80 | |
81 public bool isBordered () | |
82 { | |
83 return OS.objc_msgSend(this.id, OS.sel_isBordered) !is null; | |
84 } | |
85 | |
86 public bool isEditable () | |
87 { | |
88 return OS.objc_msgSend(this.id, OS.sel_isEditable) !is null; | |
89 } | |
90 | |
91 public bool isSelectable () | |
92 { | |
93 return OS.objc_msgSend(this.id, OS.sel_isSelectable) !is null; | |
94 } | |
95 | |
96 public void selectText (id sender) | |
97 { | |
98 OS.objc_msgSend(this.id, OS.sel_selectText_1, sender !is null ? sender.id : null); | |
99 } | |
100 | |
101 public void setAllowsEditingTextAttributes (bool flag) | |
102 { | |
103 OS.objc_msgSend(this.id, OS.sel_setAllowsEditingTextAttributes_1, flag); | |
104 } | |
105 | |
106 public void setBackgroundColor (NSColor color) | |
107 { | |
108 OS.objc_msgSend(this.id, OS.sel_setBackgroundColor_1, color !is null ? color.id : null); | |
109 } | |
110 | |
111 public void setBezelStyle (NSTextFieldBezelStyle style) | |
112 { | |
113 OS.objc_msgSend(this.id, OS.sel_setBezelStyle_1, style); | |
114 } | |
115 | |
116 public void setBezeled (bool flag) | |
117 { | |
118 OS.objc_msgSend(this.id, OS.sel_setBezeled_1, flag); | |
119 } | |
120 | |
121 public void setBordered (bool flag) | |
122 { | |
123 OS.objc_msgSend(this.id, OS.sel_setBordered_1, flag); | |
124 } | |
125 | |
126 public void setDelegate (id anObject) | |
127 { | |
128 OS.objc_msgSend(this.id, OS.sel_setDelegate_1, anObject !is null ? anObject.id : null); | |
129 } | |
130 | |
131 public void setDrawsBackground (bool flag) | |
132 { | |
133 OS.objc_msgSend(this.id, OS.sel_setDrawsBackground_1, flag); | |
134 } | |
135 | |
136 public void setEditable (bool flag) | |
137 { | |
138 OS.objc_msgSend(this.id, OS.sel_setEditable_1, flag); | |
139 } | |
140 | |
141 public void setImportsGraphics (bool flag) | |
142 { | |
143 OS.objc_msgSend(this.id, OS.sel_setImportsGraphics_1, flag); | |
144 } | |
145 | |
146 public void setSelectable (bool flag) | |
147 { | |
148 OS.objc_msgSend(this.id, OS.sel_setSelectable_1, flag); | |
149 } | |
150 | |
151 public void setTextColor (NSColor color) | |
152 { | |
153 OS.objc_msgSend(this.id, OS.sel_setTextColor_1, color !is null ? color.id : null); | |
154 } | |
155 | |
156 public void setTitleWithMnemonic (NSString stringWithAmpersand) | |
157 { | |
158 OS.objc_msgSend(this.id, OS.sel_setTitleWithMnemonic_1, stringWithAmpersand !is null ? stringWithAmpersand.id : null); | |
159 } | |
160 | |
161 public NSColor textColor () | |
162 { | |
163 objc.id result = OS.objc_msgSend(this.id, OS.sel_textColor); | |
164 return result !is null ? new NSColor(result) : null; | |
165 } | |
166 | |
167 public void textDidBeginEditing (NSNotification notification) | |
168 { | |
169 OS.objc_msgSend(this.id, OS.sel_textDidBeginEditing_1, notification !is null ? notification.id : null); | |
170 } | |
171 | |
172 public void textDidChange (NSNotification notification) | |
173 { | |
174 OS.objc_msgSend(this.id, OS.sel_textDidChange_1, notification !is null ? notification.id : null); | |
175 } | |
176 | |
177 public void textDidEndEditing (NSNotification notification) | |
178 { | |
179 OS.objc_msgSend(this.id, OS.sel_textDidEndEditing_1, notification !is null ? notification.id : null); | |
180 } | |
181 | |
182 public bool textShouldBeginEditing (NSText textObject) | |
183 { | |
184 return OS.objc_msgSend(this.id, OS.sel_textShouldBeginEditing_1, textObject !is null ? textObject.id : null) !is null; | |
185 } | |
186 | |
187 public bool textShouldEndEditing (NSText textObject) | |
188 { | |
189 return OS.objc_msgSend(this.id, OS.sel_textShouldEndEditing_1, textObject !is null ? textObject.id : null) !is null; | |
190 } | |
191 | |
192 } |