comparison mac/dw.m @ 1719:032c3388dda6

Fix dw_window_set_bitmap_from_data() not using the resource ID if data is NULL. Also updated the readme file with recent changes and note an OS/2 bug.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 08 May 2012 18:53:03 +0000
parents c836c6c33d8e
children 2d44ca344863
comparison
equal deleted inserted replaced
1718:fae374a0055b 1719:032c3388dda6
8858 void API dw_window_set_bitmap_from_data(HWND handle, unsigned long cid, char *data, int len) 8858 void API dw_window_set_bitmap_from_data(HWND handle, unsigned long cid, char *data, int len)
8859 { 8859 {
8860 NSObject *object = handle; 8860 NSObject *object = handle;
8861 if([ object isKindOfClass:[ NSImageView class ] ]) 8861 if([ object isKindOfClass:[ NSImageView class ] ])
8862 { 8862 {
8863 NSImageView *iv = handle; 8863 if(data)
8864 NSData *thisdata = [NSData dataWithBytes:data length:len]; 8864 {
8865 NSImage *pixmap = [[NSImage alloc] initWithData:thisdata]; 8865 DW_LOCAL_POOL_IN;
8866 8866 NSImageView *iv = handle;
8867 if(pixmap) 8867 NSData *thisdata = [NSData dataWithBytes:data length:len];
8868 { 8868 NSImage *pixmap = [[NSImage alloc] initWithData:thisdata];
8869 [iv setImage:pixmap]; 8869
8870 } 8870 if(pixmap)
8871 [pixmap release]; 8871 {
8872 /* If we changed the text... */ 8872 [iv setImage:pixmap];
8873 Item *item = _box_item(handle); 8873 }
8874 8874 [pixmap release];
8875 /* Check to see if any of the sizes need to be recalculated */ 8875 /* If we changed the text... */
8876 if(item && (item->origwidth == -1 || item->origheight == -1)) 8876 Item *item = _box_item(handle);
8877 { 8877
8878 _control_size(handle, item->origwidth == -1 ? &item->width : NULL, item->origheight == -1 ? &item->height : NULL); 8878 /* Check to see if any of the sizes need to be recalculated */
8879 /* Queue a redraw on the top-level window */ 8879 if(item && (item->origwidth == -1 || item->origheight == -1))
8880 _dw_redraw([iv window], TRUE); 8880 {
8881 } 8881 _control_size(handle, item->origwidth == -1 ? &item->width : NULL, item->origheight == -1 ? &item->height : NULL);
8882 /* Queue a redraw on the top-level window */
8883 _dw_redraw([iv window], TRUE);
8884 }
8885 DW_LOCAL_POOL_OUT;
8886 }
8887 else
8888 dw_window_set_bitmap(handle, cid, NULL);
8882 } 8889 }
8883 } 8890 }
8884 8891
8885 /* 8892 /*
8886 * Sets the bitmap used for a given static window. 8893 * Sets the bitmap used for a given static window.