Changeset 238:380bad9f6852 for dwt/widgets/Text.d
- Timestamp:
- 05/04/08 18:42:55 (4 years ago)
- Files:
-
- dwt/widgets/Text.d (modified) (20 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
dwt/widgets/Text.d
r158 r238 12 12 *******************************************************************************/ 13 13 module dwt.widgets.Text; 14 15 import dwt.dwthelper.utils; 14 16 15 17 … … 61 63 int fixStart = -1, fixEnd = -1; 62 64 bool doubleClick; 63 char[]message = "";65 String message = ""; 64 66 65 67 static const int INNER_BORDER = 2; … … 80 82 * this delimiter. 81 83 */ 82 public const static char[]DELIMITER = "\n";84 public const static String DELIMITER = "\n"; 83 85 /* 84 86 * These values can be different on different platforms. … … 298 300 * </ul> 299 301 */ 300 public void append ( char[]string) {302 public void append (String string) { 301 303 checkWidget (); 302 304 if (string is null) error (DWT.ERROR_NULL_ARGUMENT); … … 756 758 * @see #DELIMITER 757 759 */ 758 public char[]getLineDelimiter () {760 public String getLineDelimiter () { 759 761 checkWidget (); 760 762 return "\n"; … … 795 797 * @since 3.3 796 798 */ 797 public char[]getMessage () {799 public String getMessage () { 798 800 checkWidget (); 799 801 return message; … … 895 897 * </ul> 896 898 */ 897 public char[]getSelectionText () {899 public String getSelectionText () { 898 900 checkWidget (); 899 901 Point selection = getSelection (); … … 944 946 * </ul> 945 947 */ 946 public char[]getText () {948 public String getText () { 947 949 checkWidget (); 948 950 char* address; … … 956 958 } 957 959 if (address is null) return ""; 958 char[]res = fromStringz( address ).dup;960 String res = fromStringz( address ).dup; 959 961 if ((style & DWT.MULTI) !is 0) OS.g_free (address); 960 962 return res; … … 979 981 * </ul> 980 982 */ 981 public char[]getText (int start, int end) {983 public String getText (int start, int end) { 982 984 checkWidget (); 983 985 if (!(start <= end && 0 <= end)) return ""; … … 996 998 } 997 999 if (address is null) error (DWT.ERROR_CANNOT_GET_TEXT); 998 char[]res = fromStringz( address ).dup;1000 String res = fromStringz( address ).dup; 999 1001 OS.g_free (address); 1000 1002 return res; … … 1171 1173 int start = OS.gtk_text_iter_get_offset (&startIter); 1172 1174 int end = OS.gtk_text_iter_get_offset (&endIter); 1173 char[]newText = verifyText ("", start, end);1175 String newText = verifyText ("", start, end); 1174 1176 if (newText is null) { 1175 1177 /* Remember the selection when the text was deleted */ … … 1200 1202 override int /*long*/ gtk_delete_text (GtkWidget* widget, int /*long*/ start_pos, int /*long*/ end_pos) { 1201 1203 if (!hooks (DWT.Verify) && !filters (DWT.Verify)) return 0; 1202 char[]newText = verifyText ("", cast(int)/*64*/start_pos, cast(int)/*64*/end_pos);1204 String newText = verifyText ("", cast(int)/*64*/start_pos, cast(int)/*64*/end_pos); 1203 1205 if (newText is null) { 1204 1206 /* Remember the selection when the text was deleted */ … … 1272 1274 if (!hooks (DWT.Verify) && !filters (DWT.Verify)) return 0; 1273 1275 if (new_text is null || new_text_length is 0) return 0; 1274 char[]oldText = (cast(char*)new_text)[ 0 .. new_text_length ].dup;1276 String oldText = (cast(char*)new_text)[ 0 .. new_text_length ].dup; 1275 1277 int pos; 1276 1278 pos = *cast(int*)position; … … 1286 1288 fixStart = fixEnd = -1; 1287 1289 } 1288 char[]newText = verifyText (oldText, start, end);1290 String newText = verifyText (oldText, start, end); 1289 1291 if (newText !is oldText) { 1290 1292 int newStart, newEnd; … … 1332 1334 fixStart = fixEnd = -1; 1333 1335 } 1334 char[]oldText = text[ 0 .. len ];1335 char[]newText = verifyText (oldText, start, end);1336 String oldText = text[ 0 .. len ]; 1337 String newText = verifyText (oldText, start, end); 1336 1338 if (newText is null) { 1337 1339 OS.g_signal_stop_emission_by_name (bufferHandle, OS.insert_text.ptr); … … 1389 1391 * </ul> 1390 1392 */ 1391 public void insert ( char[]string) {1393 public void insert (String string) { 1392 1394 checkWidget (); 1393 1395 if (string is null) error (DWT.ERROR_NULL_ARGUMENT); … … 1679 1681 * @since 3.3 1680 1682 */ 1681 public void setMessage ( char[]message) {1683 public void setMessage (String message) { 1682 1684 checkWidget (); 1683 1685 if (message is null) error (DWT.ERROR_NULL_ARGUMENT); … … 1865 1867 * </ul> 1866 1868 */ 1867 public void setText ( char[]string) {1869 public void setText (String string) { 1868 1870 checkWidget (); 1869 1871 if (string is null) error (DWT.ERROR_NULL_ARGUMENT); … … 2010 2012 } 2011 2013 2012 char[] verifyText (char[]string, int start, int end) {2014 String verifyText (String string, int start, int end) { 2013 2015 if (string.length is 0 && start is end) return null; 2014 2016 Event event = new Event ();
