changeset 187:bcdc37794717

Reverted changes from previous wrong reverting changes: See: -r026ce3b05f57, -r4d06074bb1af, -rc4643827733c
author Frank Benoit <benoit@tionex.de>
date Mon, 10 Mar 2008 17:08:22 +0100
parents ee3ee677f5fc
children 03f179597782
files dwt/dwthelper/utils.d dwt/layout/FormAttachment.d dwt/widgets/Label.d
diffstat 3 files changed, 19 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/dwt/dwthelper/utils.d	Mon Mar 10 17:00:00 2008 +0100
+++ b/dwt/dwthelper/utils.d	Mon Mar 10 17:08:22 2008 +0100
@@ -45,6 +45,7 @@
 
 alias ValueWrapperT!(bool)    ValueWrapperBool;
 alias ValueWrapperT!(int)     ValueWrapperInt;
+alias ValueWrapperT!(long)    ValueWrapperLong;
 alias ArrayWrapperT!(byte)    ArrayWrapperByte;
 alias ArrayWrapperT!(int)     ArrayWrapperInt;
 alias ArrayWrapperT!(Object)  ArrayWrapperObject;
@@ -320,6 +321,16 @@
     return typeid(char[]).getHash(&src);
 }
 
+public char* toStringzValidPtr( char[] src ){
+    if( src ){
+        return src.toStringz();
+    }
+    else{
+        static const char[] nullPtr = "\0";
+        return nullPtr.ptr;
+    }
+}
+
 static char[] toHex(uint value, bool prefix = true, int radix = 8){
     return tango.text.convert.Integer.toString(
             value,
--- a/dwt/layout/FormAttachment.d	Mon Mar 10 17:00:00 2008 +0100
+++ b/dwt/layout/FormAttachment.d	Mon Mar 10 17:08:22 2008 +0100
@@ -185,7 +185,7 @@
  * @param offset the offset of the side from the position
  */
 public this (int numerator, int denominator, int offset) {
-    if (denominator == 0) DWT.error (DWT.ERROR_CANNOT_BE_ZERO);
+    if (denominator is 0) DWT.error (DWT.ERROR_CANNOT_BE_ZERO);
     this.numerator = numerator;
     this.denominator = denominator;
     this.offset = offset;
@@ -244,7 +244,7 @@
         m = n;
         n = temp;
     }
-    while (n != 0){
+    while (n !is 0){
         temp = m;
         m = n;
         n = temp % n;
@@ -283,12 +283,12 @@
 }
 
 int solveX (int value) {
-    if (denominator == 0) DWT.error (DWT.ERROR_CANNOT_BE_ZERO);
+    if (denominator is 0) DWT.error (DWT.ERROR_CANNOT_BE_ZERO);
     return ((numerator * value) / denominator) + offset;
 }
 
 int solveY (int value) {
-    if (numerator == 0) DWT.error (DWT.ERROR_CANNOT_BE_ZERO);
+    if (numerator is 0) DWT.error (DWT.ERROR_CANNOT_BE_ZERO);
     return (value - offset) * denominator / numerator;
 }
 
@@ -298,8 +298,8 @@
  *
  * @return a string representation of the FormAttachment
  */
-override public char[] toString () {
-    char[] string = control != null ? control.toString () : Format( "{}/{}", numerator, denominator );
+public override char[] toString () {
+    char[] string = control !is null ? control.toString () : Format( "{}/{}", numerator, denominator );
     return Format("{{y = ({})x + {}}", string, ( offset >= 0 ? Format(")x + {}", offset ) : Format( ")x - {}", -offset)));
 }
 
--- a/dwt/widgets/Label.d	Mon Mar 10 17:00:00 2008 +0100
+++ b/dwt/widgets/Label.d	Mon Mar 10 17:08:22 2008 +0100
@@ -395,7 +395,8 @@
 public void setText (char[] string) {
     checkWidget ();
     if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
-    if ((style & DWT.SEPARATOR) !is 0) return;
+    // DWT extensions allow null argument
+    //if ((style & DWT.SEPARATOR) !is 0) return;
     /*
     * Feature in Windows.  For some reason, SetWindowText() for
     * static controls redraws the control, even when the text has