comparison dwt/layout/RowLayout.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 9a64a7781bab
children 36f5cb12e1a2
comparison
equal deleted inserted replaced
211:ff59aeb96cac 212:ab60f3309436
17 import dwt.graphics.Rectangle; 17 import dwt.graphics.Rectangle;
18 import dwt.widgets.Control; 18 import dwt.widgets.Control;
19 import dwt.widgets.Layout; 19 import dwt.widgets.Layout;
20 import dwt.widgets.Composite; 20 import dwt.widgets.Composite;
21 import dwt.layout.RowData; 21 import dwt.layout.RowData;
22 import tango.text.Util;
23 import tango.util.Convert; 22 import tango.util.Convert;
24 import Math = tango.math.Math; 23 import Math = tango.math.Math;
24 import dwt.dwthelper.utils;
25 25
26 26
27 /** 27 /**
28 * Instances of this class determine the size and position of the 28 * Instances of this class determine the size and position of the
29 * children of a <code>Composite</code> by placing them either in 29 * children of a <code>Composite</code> by placing them either in
218 218
219 override protected bool flushCache (Control control) { 219 override protected bool flushCache (Control control) {
220 return true; 220 return true;
221 } 221 }
222 222
223 char[] getName () { 223 String getName () {
224 char[] string = this.classinfo.name; 224 String string = this.classinfo.name;
225 int index = locatePrior( string, '.'); 225 int index = string.lastIndexOf('.');
226 if (index is string.length ) return string; 226 if (index is -1 ) return string;
227 return string[ index + 1 .. string.length ]; 227 return string[ index + 1 .. string.length ];
228 } 228 }
229 229
230 override protected void layout (Composite composite, bool flushCache_) { 230 override protected void layout (Composite composite, bool flushCache_) {
231 Rectangle clientArea = composite.getClientArea (); 231 Rectangle clientArea = composite.getClientArea ();
454 * Returns a string containing a concise, human-readable 454 * Returns a string containing a concise, human-readable
455 * description of the receiver. 455 * description of the receiver.
456 * 456 *
457 * @return a string representation of the layout 457 * @return a string representation of the layout
458 */ 458 */
459 override public char[] toString () { 459 override public String toString () {
460 char[] string = getName ()~" {"; 460 String string = getName ()~" {";
461 string ~= "type="~((type !is DWT.HORIZONTAL) ? "DWT.VERTICAL" : "DWT.HORIZONTAL")~" "; 461 string ~= "type="~((type !is DWT.HORIZONTAL) ? "DWT.VERTICAL" : "DWT.HORIZONTAL")~" ";
462 if (marginWidth !is 0) string ~= "marginWidth="~to!(char[])(marginWidth)~" "; 462 if (marginWidth !is 0) string ~= "marginWidth="~to!(String)(marginWidth)~" ";
463 if (marginHeight !is 0) string ~= "marginHeight="~to!(char[])(marginHeight)~" "; 463 if (marginHeight !is 0) string ~= "marginHeight="~to!(String)(marginHeight)~" ";
464 if (marginLeft !is 0) string ~= "marginLeft="~to!(char[])(marginLeft)~" "; 464 if (marginLeft !is 0) string ~= "marginLeft="~to!(String)(marginLeft)~" ";
465 if (marginTop !is 0) string ~= "marginTop="~to!(char[])(marginTop)~" "; 465 if (marginTop !is 0) string ~= "marginTop="~to!(String)(marginTop)~" ";
466 if (marginRight !is 0) string ~= "marginRight="~to!(char[])(marginRight)~" "; 466 if (marginRight !is 0) string ~= "marginRight="~to!(String)(marginRight)~" ";
467 if (marginBottom !is 0) string ~= "marginBottom="~to!(char[])(marginBottom)~" "; 467 if (marginBottom !is 0) string ~= "marginBottom="~to!(String)(marginBottom)~" ";
468 if (spacing !is 0) string ~= "spacing="~to!(char[])(spacing)~" "; 468 if (spacing !is 0) string ~= "spacing="~to!(String)(spacing)~" ";
469 string ~= "wrap="~to!(char[])(wrap)~" "; 469 string ~= "wrap="~to!(String)(wrap)~" ";
470 string ~= "pack="~to!(char[])(pack)~" "; 470 string ~= "pack="~to!(String)(pack)~" ";
471 string ~= "fill="~to!(char[])(fill)~" "; 471 string ~= "fill="~to!(String)(fill)~" ";
472 string ~= "justify="~to!(char[])(justify)~" "; 472 string ~= "justify="~to!(String)(justify)~" ";
473 string = trim( string ); 473 string = string.trim();
474 string ~= "}"; 474 string ~= "}";
475 return string; 475 return string;
476 } 476 }
477 } 477 }