# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1300289461 0 # Node ID f3974584417558b8520f89ac08b773d12c5cbf3b # Parent a4f99795ff261186adfd65d45c6d26e90ce92a8f Added tooltips to bitmap buttons... and made a change to the look when the image is present... Not sure what look is best... the borderless buttons look best on the toolbar for my application. diff -r a4f99795ff26 -r f39745844175 mac/dw.m --- a/mac/dw.m Wed Mar 16 15:10:16 2011 +0000 +++ b/mac/dw.m Wed Mar 16 15:31:01 2011 +0000 @@ -2645,9 +2645,13 @@ NSString *filepath = [respath stringByAppendingFormat:@"/%u.png", resid]; NSImage *image = [[NSImage alloc] initWithContentsOfFile:filepath]; DWButton *button = _button_new("", resid); - [button setImage:image]; - [button setButtonType:NSMomentaryLight]; - [button setBordered:NO]; + if(image) + { + [button setImage:image]; + [button setButtonType:NSMomentaryLight]; + [ button setBordered:NO]; + } + [button setToolTip:[NSString stringWithUTF8String:text]]; [image release]; return button; } @@ -2671,7 +2675,13 @@ image = [[NSImage alloc] initWithContentsOfFile:nstr]; } DWButton *button = _button_new("", cid); - [button setImage:image]; + if(image) + { + [button setImage:image]; + [button setButtonType:NSMomentaryLight]; + [button setBordered:NO]; + } + [button setToolTip:[NSString stringWithUTF8String:text]]; [image release]; return button; } @@ -2690,7 +2700,13 @@ NSData *thisdata = [[NSData alloc] dataWithBytes:data length:len]; NSImage *image = [[NSImage alloc] initWithData:thisdata]; DWButton *button = _button_new("", cid); - [button setImage:image]; + if(image) + { + [button setImage:image]; + [button setButtonType:NSMomentaryLight]; + [button setBordered:NO]; + } + [button setToolTip:[NSString stringWithUTF8String:text]]; [image release]; return button; }