comparison dwt/widgets/Display.d @ 238:380bad9f6852

reverted char[] to String
author Frank Benoit <benoit@tionex.de>
date Mon, 05 May 2008 00:42:55 +0200
parents dc5328912f3d
children ce446666f5a2
comparison
equal deleted inserted replaced
237:98b80b00af79 238:380bad9f6852
142 142
143 CallbackData*[int] windowProcCallbackDatas; // to prevent GC from collect 143 CallbackData*[int] windowProcCallbackDatas; // to prevent GC from collect
144 144
145 CallbackData filterProcCallbackData; 145 CallbackData filterProcCallbackData;
146 EventTable eventTable, filterTable; 146 EventTable eventTable, filterTable;
147 static char[] APP_NAME = "DWT"; 147 static String APP_NAME = "DWT";
148 static const char[] DISPATCH_EVENT_KEY = "dwt.internal.gtk.dispatchEvent"; 148 static const String DISPATCH_EVENT_KEY = "dwt.internal.gtk.dispatchEvent";
149 static const char[] ADD_WIDGET_KEY = "dwt.internal.addWidget"; 149 static const String ADD_WIDGET_KEY = "dwt.internal.addWidget";
150 GClosure*[] closures; 150 GClosure*[] closures;
151 int [] signalIds; 151 int [] signalIds;
152 152
153 /* Widget Table */ 153 /* Widget Table */
154 int [] indexTable; 154 int [] indexTable;
210 GClosure* shellMapProcClosure; 210 GClosure* shellMapProcClosure;
211 211
212 /* Idle proc callback */ 212 /* Idle proc callback */
213 CallbackData idleProcCallbackData; 213 CallbackData idleProcCallbackData;
214 int idleHandle; 214 int idleHandle;
215 static const char[] ADD_IDLE_PROC_KEY = "dwt.internal.gtk2.addIdleProc"; 215 static const String ADD_IDLE_PROC_KEY = "dwt.internal.gtk2.addIdleProc";
216 static const char[] REMOVE_IDLE_PROC_KEY = "dwt.internal.gtk2.removeIdleProc"; 216 static const String REMOVE_IDLE_PROC_KEY = "dwt.internal.gtk2.removeIdleProc";
217 217
218 Object idleLock; 218 Object idleLock;
219 bool idleNeeded; 219 bool idleNeeded;
220 220
221 /* GtkTreeView callbacks */ 221 /* GtkTreeView callbacks */
379 /* Multiple Displays. */ 379 /* Multiple Displays. */
380 static Display Default; 380 static Display Default;
381 static Display [] Displays; 381 static Display [] Displays;
382 382
383 /* Package name */ 383 /* Package name */
384 static const char[] PACKAGE_PREFIX = "dwt.widgets."; 384 static const String PACKAGE_PREFIX = "dwt.widgets.";
385 /* This code is intentionally commented. 385 /* This code is intentionally commented.
386 * ".class" can not be used on CLDC. 386 * ".class" can not be used on CLDC.
387 */ 387 */
388 // static { 388 // static {
389 // char[] name = Display.class.getName (); 389 // String name = Display.class.getName ();
390 // int index = name.lastIndexOf ('.'); 390 // int index = name.lastIndexOf ('.');
391 // PACKAGE_NAME = name.substring (0, index + 1); 391 // PACKAGE_NAME = name.substring (0, index + 1);
392 // } 392 // }
393 393
394 /* 394 /*
410 static const int MINOR = 0; 410 static const int MINOR = 0;
411 static const int MICRO = 6; 411 static const int MICRO = 6;
412 412
413 /* Display Data */ 413 /* Display Data */
414 Object data; 414 Object data;
415 char[] [] keys; 415 String [] keys;
416 Object [] values; 416 Object [] values;
417 417
418 /* Initial Guesses for Shell Trimmings. */ 418 /* Initial Guesses for Shell Trimmings. */
419 int borderTrimWidth = 4, borderTrimHeight = 4; 419 int borderTrimWidth = 4, borderTrimHeight = 4;
420 int resizeTrimWidth = 6, resizeTrimHeight = 6; 420 int resizeTrimWidth = 6, resizeTrimHeight = 6;
422 int titleResizeTrimWidth = 6, titleResizeTrimHeight = 29; 422 int titleResizeTrimWidth = 6, titleResizeTrimHeight = 29;
423 int titleTrimWidth = 0, titleTrimHeight = 23; 423 int titleTrimWidth = 0, titleTrimHeight = 23;
424 bool ignoreTrim; 424 bool ignoreTrim;
425 425
426 /* Window Manager */ 426 /* Window Manager */
427 char[] windowManager; 427 String windowManager;
428 428
429 /* 429 /*
430 * TEMPORARY CODE. Install the runnable that 430 * TEMPORARY CODE. Install the runnable that
431 * gets the current display. This code will 431 * gets the current display. This code will
432 * be removed in the future. 432 * be removed in the future.
981 cbdata.display = this; 981 cbdata.display = this;
982 cbdata.data = widget; 982 cbdata.data = widget;
983 OS.gdk_window_remove_filter(window, &filterProcFunc, cbdata ); 983 OS.gdk_window_remove_filter(window, &filterProcFunc, cbdata );
984 } 984 }
985 985
986 Image createImage (char[] name) { 986 Image createImage (String name) {
987 auto style = OS.gtk_widget_get_default_style (); 987 auto style = OS.gtk_widget_get_default_style ();
988 char[] buffer = name; 988 String buffer = name;
989 auto pixbuf = OS.gtk_icon_set_render_icon ( 989 auto pixbuf = OS.gtk_icon_set_render_icon (
990 OS.gtk_icon_factory_lookup_default (buffer.ptr), style, 990 OS.gtk_icon_factory_lookup_default (buffer.ptr), style,
991 OS.GTK_TEXT_DIR_NONE, 991 OS.GTK_TEXT_DIR_NONE,
992 OS.GTK_STATE_NORMAL, 992 OS.GTK_STATE_NORMAL,
993 OS.GTK_ICON_SIZE_DIALOG, null, null ); 993 OS.GTK_ICON_SIZE_DIALOG, null, null );
1582 * </ul> 1582 * </ul>
1583 * 1583 *
1584 * @see #setData(String, Object) 1584 * @see #setData(String, Object)
1585 * @see #disposeExec(Runnable) 1585 * @see #disposeExec(Runnable)
1586 */ 1586 */
1587 public Object getData (char[] key) { 1587 public Object getData (String key) {
1588 checkDevice (); 1588 checkDevice ();
1589 if (key is null) error (DWT.ERROR_NULL_ARGUMENT); 1589 if (key is null) error (DWT.ERROR_NULL_ARGUMENT);
1590 if (key ==/*eq*/ DISPATCH_EVENT_KEY) { 1590 if (key ==/*eq*/ DISPATCH_EVENT_KEY) {
1591 return new ArrayWrapperInt(dispatchEvents); 1591 return new ArrayWrapperInt(dispatchEvents);
1592 } 1592 }
1671 if (Default is null) Default = new Display (); 1671 if (Default is null) Default = new Display ();
1672 return Default; 1672 return Default;
1673 } 1673 }
1674 1674
1675 // /+static bool isValidClass (Class clazz) { 1675 // /+static bool isValidClass (Class clazz) {
1676 // //PORTING_TODO char[] name = clazz.getName (); 1676 // //PORTING_TODO String name = clazz.getName ();
1677 // //PORTING_TODO int index = name.lastIndexOf ('.'); 1677 // //PORTING_TODO int index = name.lastIndexOf ('.');
1678 // //PORTING_TODO return name.substring (0, index + 1)==/*eq*/ PACKAGE_PREFIX; 1678 // //PORTING_TODO return name.substring (0, index + 1)==/*eq*/ PACKAGE_PREFIX;
1679 // return true; 1679 // return true;
1680 // }+/ 1680 // }+/
1681 1681
3367 * to set the name used for resource lookup. Specifying 3367 * to set the name used for resource lookup. Specifying
3368 * <code>null</code> for the name clears it. 3368 * <code>null</code> for the name clears it.
3369 * 3369 *
3370 * @param name the new app name or <code>null</code> 3370 * @param name the new app name or <code>null</code>
3371 */ 3371 */
3372 public static void setAppName (char[] name) { 3372 public static void setAppName (String name) {
3373 APP_NAME = name; 3373 APP_NAME = name;
3374 } 3374 }
3375 3375
3376 /** 3376 /**
3377 * Sets the location of the on-screen pointer relative to the top left corner 3377 * Sets the location of the on-screen pointer relative to the top left corner
3441 * </ul> 3441 * </ul>
3442 * 3442 *
3443 * @see #getData(String) 3443 * @see #getData(String)
3444 * @see #disposeExec(Runnable) 3444 * @see #disposeExec(Runnable)
3445 */ 3445 */
3446 public void setData (char[] key, Object value) { 3446 public void setData (String key, Object value) {
3447 checkDevice (); 3447 checkDevice ();
3448 if (key is null) error (DWT.ERROR_NULL_ARGUMENT); 3448 if (key is null) error (DWT.ERROR_NULL_ARGUMENT);
3449 3449
3450 if (key==/*eq*/ DISPATCH_EVENT_KEY) { 3450 if (key==/*eq*/ DISPATCH_EVENT_KEY) {
3451 ArrayWrapperInt wrappedValue; 3451 ArrayWrapperInt wrappedValue;
3486 if (index is keys.length) return; 3486 if (index is keys.length) return;
3487 if (keys.length is 1) { 3487 if (keys.length is 1) {
3488 keys = null; 3488 keys = null;
3489 values = null; 3489 values = null;
3490 } else { 3490 } else {
3491 char[] [] newKeys = new char[] [keys.length - 1]; 3491 String [] newKeys = new String [keys.length - 1];
3492 Object [] newValues = new Object [values.length - 1]; 3492 Object [] newValues = new Object [values.length - 1];
3493 System.arraycopy (keys, 0, newKeys, 0, index); 3493 System.arraycopy (keys, 0, newKeys, 0, index);
3494 System.arraycopy (keys, index + 1, newKeys, index, newKeys.length - index); 3494 System.arraycopy (keys, index + 1, newKeys, index, newKeys.length - index);
3495 System.arraycopy (values, 0, newValues, 0, index); 3495 System.arraycopy (values, 0, newValues, 0, index);
3496 System.arraycopy (values, index + 1, newValues, index, newValues.length - index); 3496 System.arraycopy (values, index + 1, newValues, index, newValues.length - index);
3510 if (keys [i]==/*eq*/ key) { 3510 if (keys [i]==/*eq*/ key) {
3511 values [i] = value; 3511 values [i] = value;
3512 return; 3512 return;
3513 } 3513 }
3514 } 3514 }
3515 char[] [] newKeys = new char[] [keys.length + 1]; 3515 String [] newKeys = new String [keys.length + 1];
3516 Object [] newValues = new Object [values.length + 1]; 3516 Object [] newValues = new Object [values.length + 1];
3517 System.arraycopy (keys, 0, newKeys, 0, keys.length); 3517 System.arraycopy (keys, 0, newKeys, 0, keys.length);
3518 System.arraycopy (values, 0, newValues, 0, values.length); 3518 System.arraycopy (values, 0, newValues, 0, values.length);
3519 newKeys [keys.length] = key; 3519 newKeys [keys.length] = key;
3520 newValues [values.length] = value; 3520 newValues [values.length] = value;