comparison dwt/graphics/TextLayout.d @ 212:ab60f3309436

reverted the char[] to String and use the an alias.
author Frank Benoit <benoit@tionex.de>
date Mon, 05 May 2008 00:12:38 +0200
parents f8001bf383d2
children 36f5cb12e1a2
comparison
equal deleted inserted replaced
211:ff59aeb96cac 212:ab60f3309436
50 * 50 *
51 * @since 3.0 51 * @since 3.0
52 */ 52 */
53 public final class TextLayout : Resource { 53 public final class TextLayout : Resource {
54 Font font; 54 Font font;
55 char[] text, segmentsText; 55 String text, segmentsText;
56 int lineSpacing; 56 int lineSpacing;
57 int ascent, descent; 57 int ascent, descent;
58 int alignment; 58 int alignment;
59 int wrapWidth; 59 int wrapWidth;
60 int orientation; 60 int orientation;
168 ascent = 0; 168 ascent = 0;
169 descent = 0; 169 descent = 0;
170 x = 0; 170 x = 0;
171 lineBreak = softBreak = false; 171 lineBreak = softBreak = false;
172 } 172 }
173 override public char[] toString () { 173 override public String toString () {
174 return Format( "StyleItem {{{}, {}}", start, style ); 174 return Format( "StyleItem {{{}, {}}", start, style );
175 } 175 }
176 } 176 }
177 177
178 /** 178 /**
1734 public int[] getSegments () { 1734 public int[] getSegments () {
1735 checkLayout(); 1735 checkLayout();
1736 return segments; 1736 return segments;
1737 } 1737 }
1738 1738
1739 char[] getSegmentsText() { 1739 String getSegmentsText() {
1740 if (segments is null) return text; 1740 if (segments is null) return text;
1741 int nSegments = segments.length; 1741 int nSegments = segments.length;
1742 if (nSegments <= 1) return text; 1742 if (nSegments <= 1) return text;
1743 int length = text.length; 1743 int length = text.length;
1744 if (length is 0) return text; 1744 if (length is 0) return text;
1855 * 1855 *
1856 * @exception DWTException <ul> 1856 * @exception DWTException <ul>
1857 * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> 1857 * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
1858 * </ul> 1858 * </ul>
1859 */ 1859 */
1860 public char[] getText () { 1860 public String getText () {
1861 checkLayout(); 1861 checkLayout();
1862 return text; 1862 return text;
1863 } 1863 }
1864 1864
1865 /** 1865 /**
2356 * </ul> 2356 * </ul>
2357 * @exception DWTException <ul> 2357 * @exception DWTException <ul>
2358 * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> 2358 * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
2359 * </ul> 2359 * </ul>
2360 */ 2360 */
2361 public void setText (char[] text) { 2361 public void setText (String text) {
2362 checkLayout(); 2362 checkLayout();
2363 //PORTING_CHANGE: allow null argument 2363 //PORTING_CHANGE: allow null argument
2364 //if (text is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 2364 //if (text is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
2365 if (text==/*eq*/this.text) return; 2365 if (text==/*eq*/this.text) return;
2366 freeRuns(); 2366 freeRuns();
2512 * Returns a string containing a concise, human-readable 2512 * Returns a string containing a concise, human-readable
2513 * description of the receiver. 2513 * description of the receiver.
2514 * 2514 *
2515 * @return a string representation of the receiver 2515 * @return a string representation of the receiver
2516 */ 2516 */
2517 override public char[] toString () { 2517 override public String toString () {
2518 if (isDisposed()) return "TextLayout {*DISPOSED*}"; 2518 if (isDisposed()) return "TextLayout {*DISPOSED*}";
2519 return "TextLayout {}"; 2519 return "TextLayout {}";
2520 } 2520 }
2521 2521
2522 int translateOffset(int offset) { 2522 int translateOffset(int offset) {