changeset 748:f39745844175

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.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Wed, 16 Mar 2011 15:31:01 +0000
parents a4f99795ff26
children 9e147366147b
files mac/dw.m
diffstat 1 files changed, 21 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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;
 }