Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSTextFieldCell.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 |
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.NSTextFieldCell; | 14 module dwt.internal.cocoa.NSTextFieldCell; |
15 | 15 |
16 import dwt.dwthelper.utils; | |
17 import cocoa = dwt.internal.cocoa.id; | |
16 import dwt.internal.cocoa.NSActionCell; | 18 import dwt.internal.cocoa.NSActionCell; |
17 import dwt.internal.cocoa.NSArray; | |
18 import dwt.internal.cocoa.NSAttributedString; | |
19 import dwt.internal.cocoa.NSColor; | 19 import dwt.internal.cocoa.NSColor; |
20 import dwt.internal.cocoa.NSString; | |
21 import dwt.internal.cocoa.NSText; | |
22 import dwt.internal.cocoa.OS; | 20 import dwt.internal.cocoa.OS; |
23 import objc = dwt.internal.objc.runtime; | 21 import objc = dwt.internal.objc.runtime; |
24 | 22 |
25 enum NSTextFieldBezelStyle | 23 public class NSTextFieldCell : NSActionCell { |
26 { | 24 |
27 NSTextFieldSquareBezel = 0, | 25 public this() { |
28 NSTextFieldRoundedBezel = 1 | 26 super(); |
29 } | 27 } |
30 | 28 |
31 alias NSTextFieldBezelStyle.NSTextFieldSquareBezel NSTextFieldSquareBezel; | 29 public this(objc.id id) { |
32 alias NSTextFieldBezelStyle.NSTextFieldRoundedBezel NSTextFieldRoundedBezel; | 30 super(id); |
31 } | |
33 | 32 |
34 public class NSTextFieldCell : NSActionCell | 33 public this(cocoa.id id) { |
35 { | 34 super(id); |
35 } | |
36 | 36 |
37 public this () | 37 public void setTextColor(NSColor color) { |
38 { | 38 OS.objc_msgSend(this.id, OS.sel_setTextColor_, color !is null ? color.id : null); |
39 super(); | 39 } |
40 } | |
41 | 40 |
42 public this (objc.id id) | 41 public NSColor textColor() { |
43 { | 42 objc.id result = OS.objc_msgSend(this.id, OS.sel_textColor); |
44 super(id); | 43 return result !is null ? new NSColor(result) : null; |
45 } | 44 } |
46 | |
47 public NSArray allowedInputSourceLocales () | |
48 { | |
49 objc.id result = OS.objc_msgSend(this.id_, OS.sel_allowedInputSourceLocales); | |
50 return result !is null ? new NSArray(result) : null; | |
51 } | |
52 | |
53 public NSColor backgroundColor () | |
54 { | |
55 objc.id result = OS.objc_msgSend(this.id_, OS.sel_backgroundColor); | |
56 return result !is null ? new NSColor(result) : null; | |
57 } | |
58 | |
59 public NSTextFieldBezelStyle bezelStyle () | |
60 { | |
61 return cast(NSTextFieldBezelStyle) OS.objc_msgSend(this.id_, OS.sel_bezelStyle); | |
62 } | |
63 | |
64 public bool drawsBackground () | |
65 { | |
66 return OS.objc_msgSend(this.id_, OS.sel_drawsBackground) !is null; | |
67 } | |
68 | |
69 public NSAttributedString placeholderAttributedString () | |
70 { | |
71 objc.id result = OS.objc_msgSend(this.id_, OS.sel_placeholderAttributedString); | |
72 return result !is null ? new NSAttributedString(result) : null; | |
73 } | |
74 | |
75 public NSString placeholderString () | |
76 { | |
77 objc.id result = OS.objc_msgSend(this.id_, OS.sel_placeholderString); | |
78 return result !is null ? new NSString(result) : null; | |
79 } | |
80 | |
81 public void setAllowedInputSourceLocales (NSArray localeIdentifiers) | |
82 { | |
83 OS.objc_msgSend(this.id_, OS.sel_setAllowedInputSourceLocales_1, localeIdentifiers !is null ? localeIdentifiers.id_ : null); | |
84 } | |
85 | |
86 public void setBackgroundColor (NSColor color) | |
87 { | |
88 OS.objc_msgSend(this.id_, OS.sel_setBackgroundColor_1, color !is null ? color.id_ : null); | |
89 } | |
90 | |
91 public void setBezelStyle (NSTextFieldBezelStyle style) | |
92 { | |
93 OS.objc_msgSend(this.id_, OS.sel_setBezelStyle_1, style); | |
94 } | |
95 | |
96 public void setDrawsBackground (bool flag) | |
97 { | |
98 OS.objc_msgSend(this.id_, OS.sel_setDrawsBackground_1, flag); | |
99 } | |
100 | |
101 public void setPlaceholderAttributedString (NSAttributedString string) | |
102 { | |
103 OS.objc_msgSend(this.id_, OS.sel_setPlaceholderAttributedString_1, string !is null ? string.id_ : null); | |
104 } | |
105 | |
106 public void setPlaceholderString (NSString string) | |
107 { | |
108 OS.objc_msgSend(this.id_, OS.sel_setPlaceholderString_1, string !is null ? string.id_ : null); | |
109 } | |
110 | |
111 public void setTextColor (NSColor color) | |
112 { | |
113 OS.objc_msgSend(this.id_, OS.sel_setTextColor_1, color !is null ? color.id_ : null); | |
114 } | |
115 | |
116 public NSText setUpFieldEditorAttributes (NSText textObj) | |
117 { | |
118 objc.id result = OS.objc_msgSend(this.id_, OS.sel_setUpFieldEditorAttributes_1, textObj !is null ? textObj.id_ : null); | |
119 return result !is null ? new NSText(result) : null; | |
120 } | |
121 | |
122 public void setWantsNotificationForMarkedText (bool flag) | |
123 { | |
124 OS.objc_msgSend(this.id_, OS.sel_setWantsNotificationForMarkedText_1, flag); | |
125 } | |
126 | |
127 public NSColor textColor () | |
128 { | |
129 objc.id result = OS.objc_msgSend(this.id_, OS.sel_textColor); | |
130 return result !is null ? new NSColor(result) : null; | |
131 } | |
132 | 45 |
133 } | 46 } |