Mercurial > dwindows
changeset 1708:cc10082567ed
Similar code for Mac to keep HICNs from getting too big.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sat, 05 May 2012 21:32:50 +0000 |
parents | 0b1be0a99f59 |
children | de49c1f284b2 |
files | mac/dw.m |
diffstat | 1 files changed, 17 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mac/dw.m Sat May 05 21:21:49 2012 +0000 +++ b/mac/dw.m Sat May 05 21:32:50 2012 +0000 @@ -6816,6 +6816,20 @@ DW_LOCAL_POOL_OUT; } +/* Internal function to keep HICNs from getting too big */ +void _icon_resize(NSImage *image) +{ + NSSize size = [image size]; + if(size.width > 24 || size.height > 24) + { + if(size.width > 24) + size.width = 24; + if(size.height > 24) + size.height = 24; + [image setSize:size]; + } +} + /* * Obtains an icon from a module (or header in GTK). * Parameters: @@ -6830,6 +6844,7 @@ NSString *respath = [bundle resourcePath]; NSString *filepath = [respath stringByAppendingFormat:@"/%u.png", resid]; NSImage *image = [[NSImage alloc] initWithContentsOfFile:filepath]; + _icon_resize(image); return image; } @@ -6851,6 +6866,7 @@ nstr = [nstr stringByAppendingString: [NSString stringWithUTF8String:ext]]; image = [[NSImage alloc] initWithContentsOfFile:nstr]; } + _icon_resize(image); return image; } @@ -6865,6 +6881,7 @@ { NSData *thisdata = [NSData dataWithBytes:data length:len]; NSImage *image = [[NSImage alloc] initWithData:thisdata]; + _icon_resize(image); return image; }