Show
Ignore:
Timestamp:
05/17/08 11:34:28 (8 months ago)
Author:
Frank Benoit <benoit@tionex.de>
branch:
default
Message:

Update to SWT 3.4M7

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • dwt/graphics/Color.d

    r212 r213  
    4040 
    4141public final class Color : Resource { 
     42 
     43    alias Resource.init_ init_; 
    4244 
    4345    /** 
     
    5658 * Prevents uninitialized instances from being created outside the package. 
    5759 */ 
    58 this() { 
     60this(Device device) { 
     61    super(device); 
    5962} 
    6063 
     
    8487 */ 
    8588public this (Device device, int red, int green, int blue) { 
    86     if (device is null) device = Device.getDevice(); 
    87     if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
    88     init_(device, red, green, blue); 
    89     if (device.tracking) device.new_Object(this); 
     89    super(device); 
     90    init_(red, green, blue); 
     91    init_(); 
    9092} 
    9193 
     
    113115 */ 
    114116public this (Device device, RGB rgb) { 
    115     if (device is null) device = Device.getDevice(); 
    116     if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
     117    super(device); 
    117118    if (rgb is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
    118     init_(device, rgb.red, rgb.green, rgb.blue); 
    119     if (device.tracking) device.new_Object(this); 
    120 
    121  
    122 /** 
    123  * Disposes of the operating system resources associated with 
    124  * the color. Applications must dispose of all colors which 
    125  * they allocate. 
    126  */ 
    127 override public void dispose() { 
    128     if (handle is -1) return; 
    129     if (device.isDisposed()) return; 
    130  
     119    init_(rgb.red, rgb.green, rgb.blue); 
     120    init_(); 
     121
     122 
     123void destroy() { 
    131124    /* 
    132125     * If this is a palette-based device, 
     
    144137    } 
    145138    handle = -1; 
    146     if (device.tracking) device.dispose_Object(this); 
    147     device = null; 
    148139} 
    149140 
     
    250241 * @see #dispose 
    251242 */ 
    252 void init_(Device device, int red, int green, int blue) { 
     243void init_(int red, int green, int blue) { 
    253244    if (red > 255 || red < 0 || green > 255 || green < 0 || blue > 255 || blue < 0) { 
    254245        DWT.error(DWT.ERROR_INVALID_ARGUMENT); 
    255246    } 
    256     this.device = device; 
    257247    handle = (red & 0xFF) | ((green & 0xFF) << 8) | ((blue & 0xFF) << 16); 
    258248 
     
    339329 */ 
    340330public static Color win32_new(Device device, int handle) { 
    341     if (device is null) device = Device.getDevice(); 
    342     Color color = new Color(); 
     331    Color color = new Color(device); 
    343332    color.handle = handle; 
    344     color.device = device; 
    345333    return color; 
    346334}