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/Font.d

    r212 r213  
    4343public final class Font : Resource { 
    4444 
     45    alias Resource.init_ init_; 
    4546    /** 
    4647     * the handle to the OS font resource 
     
    5859 * Prevents uninitialized instances from being created outside the package. 
    5960 */ 
    60 this() { 
     61this(Device device) { 
     62    super(device); 
    6163} 
    6264 
     
    8082 */ 
    8183public this(Device device, FontData fd) { 
    82     if (device is null) device = Device.getDevice(); 
    83     if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
    84     init_(device, fd); 
    85     if (device.tracking) device.new_Object(this); 
     84    super(device); 
     85    init_(fd); 
     86    init_(); 
    8687} 
    8788 
     
    110111 */ 
    111112public this(Device device, FontData[] fds) { 
    112     if (device is null) device = Device.getDevice(); 
    113     if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
     113    super(device); 
    114114    if (fds is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
    115115    if (fds.length is 0) DWT.error(DWT.ERROR_INVALID_ARGUMENT); 
     
    117117        if (fds[i] is null) DWT.error(DWT.ERROR_INVALID_ARGUMENT); 
    118118    } 
    119     init_(device, fds[0]); 
    120     if (device.tracking) device.new_Object(this); 
     119    init_(fds[0]); 
     120    init_(); 
    121121} 
    122122 
     
    144144 */ 
    145145public this(Device device, String name, int height, int style) { 
    146     if (device is null) device = Device.getDevice(); 
    147     if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
     146    super(device); 
    148147    if (name is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
    149     init_(device, new FontData (name, height, style)); 
    150     if (device.tracking) device.new_Object(this); 
     148    init_(new FontData (name, height, style)); 
     149    init_(); 
    151150} 
    152151 
    153152/*public*/ this(Device device, String name, float height, int style) { 
    154     if (device is null) device = Device.getDevice(); 
    155     if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
     153    super(device); 
    156154    if (name is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
    157     init_(device, new FontData (name, height, style)); 
    158     if (device.tracking) device.new_Object(this); 
    159 
    160  
    161 /** 
    162  * Disposes of the operating system resources associated with 
    163  * the font. Applications must dispose of all fonts which 
    164  * they allocate. 
    165  */ 
    166 override public void dispose() { 
    167     if (handle is null) return; 
    168     if (device.isDisposed()) return; 
     155    init_(new FontData (name, height, style)); 
     156    init_(); 
     157
     158void destroy() { 
    169159    OS.DeleteObject(handle); 
    170160    handle = null; 
    171     if (device.tracking) device.dispose_Object(this); 
    172     device = null; 
    173161} 
    174162 
     
    224212} 
    225213 
    226 void init_ (Device device, FontData fd) { 
     214void init_ (FontData fd) { 
    227215    if (fd is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 
    228     this.device = device; 
    229216    LOGFONT* logFont = &fd.data; 
    230217    int lfHeight = logFont.lfHeight; 
     
    275262 */ 
    276263public static Font win32_new(Device device, HFONT handle) { 
    277     if (device is null) device = Device.getDevice(); 
    278     Font font = new Font(); 
     264    Font font = new Font(device); 
    279265    font.handle = handle; 
    280     font.device = device; 
    281266    return font; 
    282267}