comparison org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/custom/CTabItem.d @ 113:fb3aa8075988

D2 support for the linux port.
author Jacob Carlborg <doob@me.com>
date Wed, 06 Apr 2011 21:57:23 +0200
parents c01d033c633a
children 536e43f63c81
comparison
equal deleted inserted replaced
112:9f4c18c268b2 113:fb3aa8075988
30 import org.eclipse.swt.widgets.Display; 30 import org.eclipse.swt.widgets.Display;
31 import org.eclipse.swt.widgets.Item; 31 import org.eclipse.swt.widgets.Item;
32 import org.eclipse.swt.widgets.Widget; 32 import org.eclipse.swt.widgets.Widget;
33 import org.eclipse.swt.custom.CTabFolder; 33 import org.eclipse.swt.custom.CTabFolder;
34 34
35
36 version (Tango)
37 import tango.text.convert.Utf;
38
39 else
40 {
41 import std.conv;
42
43 alias to!(string) toString;
44 alias to!(dstring) toString32;
45 }
46
35 /** 47 /**
36 * Instances of this class represent a selectable user interface object 48 * Instances of this class represent a selectable user interface object
37 * that represent a page in a notebook widget. 49 * that represent a page in a notebook widget.
38 * 50 *
39 * <dl> 51 * <dl>
171 break; 183 break;
172 } 184 }
173 end = layout.getPreviousOffset(end, SWT.MOVEMENT_CLUSTER); 185 end = layout.getPreviousOffset(end, SWT.MOVEMENT_CLUSTER);
174 } 186 }
175 layout.dispose(); 187 layout.dispose();
176 return end is 0 ? text.substring(0, 1) : text ~ ellipses; 188 return end is 0 ? .toString(toString32(text)[0 .. 1]) : text ~ ellipses;
177 } 189 }
178 190
179 public override void dispose() { 191 public override void dispose() {
180 if (isDisposed ()) return; 192 if (isDisposed ()) return;
181 //if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS); 193 //if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
857 } 869 }
858 String text = null; 870 String text = null;
859 if (minimum) { 871 if (minimum) {
860 int minChars = parent.minChars; 872 int minChars = parent.minChars;
861 text = minChars is 0 ? null : getText(); 873 text = minChars is 0 ? null : getText();
862 if (text !is null && text.length > minChars) { 874 if (text !is null && toString32(text).length > minChars) {
863 if (useEllipses()) { 875 if (useEllipses()) {
864 int end = minChars < ELLIPSIS.length + 1 ? minChars : minChars - ELLIPSIS.length; 876 int end = minChars < ELLIPSIS.length + 1 ? minChars : minChars - ELLIPSIS.length;
865 text = text[ 0 .. end ]; 877 text = .toString(toString32(text)[ 0 .. end ]);
866 if (minChars > ELLIPSIS.length + 1) text ~= ELLIPSIS; 878 if (minChars > ELLIPSIS.length + 1) text ~= ELLIPSIS;
867 } else { 879 } else {
868 int end = minChars; 880 int end = minChars;
869 text = text[ 0 .. end ]; 881 text = .toString(toString32(text)[ 0 .. end ]);
870 } 882 }
871 } 883 }
872 } else { 884 } else {
873 text = getText(); 885 text = getText();
874 } 886 }