comparison dwt/widgets/Widget.d @ 318:827aebee255f

String version for Widget getData,setData
author Frank Benoit <benoit@tionex.de>
date Tue, 16 Sep 2008 15:51:48 +0200
parents c0d810de7093
children 57e961636f92
comparison
equal deleted inserted replaced
317:6f57d3b9947c 318:827aebee255f
560 */ 560 */
561 public Object getData () { 561 public Object getData () {
562 checkWidget(); 562 checkWidget();
563 return (state & KEYED_DATA) !is 0 ? (cast(ArrayWrapperObject)data).array[0] : data; 563 return (state & KEYED_DATA) !is 0 ? (cast(ArrayWrapperObject)data).array[0] : data;
564 } 564 }
565 public String getDataStr () {
566 return stringcast( getData() );
567 }
568
565 /** 569 /**
566 * Returns the application defined property of the receiver 570 * Returns the application defined property of the receiver
567 * with the specified name, or null if it has not been set. 571 * with the specified name, or null if it has not been set.
568 * <p> 572 * <p>
569 * Applications may have associated arbitrary objects with the 573 * Applications may have associated arbitrary objects with the
593 String tablekey = (cast(ArrayWrapperString) table[i]).array; 597 String tablekey = (cast(ArrayWrapperString) table[i]).array;
594 if (key ==/*eq*/ tablekey ) return table [i+1]; 598 if (key ==/*eq*/ tablekey ) return table [i+1];
595 } 599 }
596 } 600 }
597 return null; 601 return null;
602 }
603 public Object getDataStr (String key) {
604 return stringcast( getData(key) );
598 } 605 }
599 606
600 /** 607 /**
601 * Returns the <code>Display</code> that is associated with 608 * Returns the <code>Display</code> that is associated with
602 * the receiver. 609 * the receiver.
1406 if ((state & KEYED_DATA) !is 0) { 1413 if ((state & KEYED_DATA) !is 0) {
1407 (cast(ArrayWrapperObject) this.data).array[0] = data; 1414 (cast(ArrayWrapperObject) this.data).array[0] = data;
1408 } else { 1415 } else {
1409 this.data = data; 1416 this.data = data;
1410 } 1417 }
1418 }
1419 public void setDataStr (String data) {
1420 setData( stringcast(data));
1411 } 1421 }
1412 1422
1413 /** 1423 /**
1414 * Sets the application defined property of the receiver 1424 * Sets the application defined property of the receiver
1415 * with the specified name to the given value. 1425 * with the specified name to the given value.
1475 data = new ArrayWrapperObject( newTable ); 1485 data = new ArrayWrapperObject( newTable );
1476 } 1486 }
1477 } 1487 }
1478 } 1488 }
1479 } 1489 }
1490 }
1491 public void setDataStr (String key, Object value) {
1492 setData(key, stringcast(value));
1480 } 1493 }
1481 1494
1482 void setForegroundColor (GtkWidget* handle, GdkColor* color) { 1495 void setForegroundColor (GtkWidget* handle, GdkColor* color) {
1483 auto style = OS.gtk_widget_get_modifier_style (handle); 1496 auto style = OS.gtk_widget_get_modifier_style (handle);
1484 OS.gtk_rc_style_set_fg (style, OS.GTK_STATE_NORMAL, color); 1497 OS.gtk_rc_style_set_fg (style, OS.GTK_STATE_NORMAL, color);