Mercurial > projects > dwt-addons
comparison dwtx/jface/fieldassist/ComboContentAdapter.d @ 72:5df4896124c7
JFace and its examples do compile
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Thu, 22 May 2008 17:56:17 +0200 |
parents | 46a6e0e6ccd4 |
children | 7ffeace6c47f |
comparison
equal
deleted
inserted
replaced
71:4878bef4a38e | 72:5df4896124c7 |
---|---|
12 *******************************************************************************/ | 12 *******************************************************************************/ |
13 module dwtx.jface.fieldassist.ComboContentAdapter; | 13 module dwtx.jface.fieldassist.ComboContentAdapter; |
14 | 14 |
15 import dwt.DWT; | 15 import dwt.DWT; |
16 import dwtx.jface.fieldassist.IControlContentAdapter; | 16 import dwtx.jface.fieldassist.IControlContentAdapter; |
17 import dwtx.jface.fieldassist.IControlContentAdapter2; | |
17 | 18 |
18 import dwt.graphics.GC; | 19 import dwt.graphics.GC; |
19 import dwt.graphics.Point; | 20 import dwt.graphics.Point; |
20 import dwt.graphics.Rectangle; | 21 import dwt.graphics.Rectangle; |
21 import dwt.widgets.Combo; | 22 import dwt.widgets.Combo; |
31 * | 32 * |
32 * @since 3.2 | 33 * @since 3.2 |
33 */ | 34 */ |
34 public class ComboContentAdapter : IControlContentAdapter, | 35 public class ComboContentAdapter : IControlContentAdapter, |
35 IControlContentAdapter2 { | 36 IControlContentAdapter2 { |
36 | 37 |
37 /* | 38 /* |
38 * Set to <code>true</code> if we should compute the text | 39 * Set to <code>true</code> if we should compute the text |
39 * vertical bounds rather than just use the field size. | 40 * vertical bounds rather than just use the field size. |
40 * Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=164748 | 41 * Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=164748 |
41 * The corresponding DWT bug is | 42 * The corresponding DWT bug is |
102 * (non-Javadoc) | 103 * (non-Javadoc) |
103 * | 104 * |
104 * @see dwtx.jface.fieldassist.IControlContentAdapter#getInsertionBounds(dwt.widgets.Control) | 105 * @see dwtx.jface.fieldassist.IControlContentAdapter#getInsertionBounds(dwt.widgets.Control) |
105 */ | 106 */ |
106 public Rectangle getInsertionBounds(Control control) { | 107 public Rectangle getInsertionBounds(Control control) { |
107 // This doesn't take horizontal scrolling into affect. | 108 // This doesn't take horizontal scrolling into affect. |
108 // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=204599 | 109 // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=204599 |
109 Combo combo = cast(Combo) control; | 110 Combo combo = cast(Combo) control; |
110 int position = combo.getSelection().y; | 111 int position = combo.getSelection().y; |
111 String contents = combo.getText(); | 112 String contents = combo.getText(); |
112 GC gc = new GC(combo); | 113 GC gc = new GC(combo); |
131 (cast(Combo) control).setSelection(new Point(index, index)); | 132 (cast(Combo) control).setSelection(new Point(index, index)); |
132 } | 133 } |
133 | 134 |
134 /* | 135 /* |
135 * (non-Javadoc) | 136 * (non-Javadoc) |
136 * | 137 * |
137 * @see dwtx.jface.fieldassist.IControlContentAdapter2#getSelection(dwt.widgets.Control) | 138 * @see dwtx.jface.fieldassist.IControlContentAdapter2#getSelection(dwt.widgets.Control) |
138 * | 139 * |
139 * @since 3.4 | 140 * @since 3.4 |
140 */ | 141 */ |
141 public Point getSelection(Control control) { | 142 public Point getSelection(Control control) { |
142 return ((Combo) control).getSelection(); | 143 return (cast(Combo) control).getSelection(); |
143 } | 144 } |
144 | 145 |
145 /* | 146 /* |
146 * (non-Javadoc) | 147 * (non-Javadoc) |
147 * | 148 * |
148 * @see dwtx.jface.fieldassist.IControlContentAdapter2#setSelection(dwt.widgets.Control, | 149 * @see dwtx.jface.fieldassist.IControlContentAdapter2#setSelection(dwt.widgets.Control, |
149 * dwt.graphics.Point) | 150 * dwt.graphics.Point) |
150 * | 151 * |
151 * @since 3.4 | 152 * @since 3.4 |
152 */ | 153 */ |
153 public void setSelection(Control control, Point range) { | 154 public void setSelection(Control control, Point range) { |
154 ((Combo) control).setSelection(range); | 155 (cast(Combo) control).setSelection(range); |
155 } | 156 } |
156 | 157 |
157 } | 158 } |