16 #ifndef COCOA_GWEN_BUTTON_MM
17 #define COCOA_GWEN_BUTTON_MM
24 - (id)initWithFrame:(NSRect)frame {
25 self = [
super initWithFrame:frame];
27 [
self setTarget:self];
28 [
self setAction:@selector(clicked:)];
44 NSString *title = [
self title];
45 if (title && [title length]>0) {
46 NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:
47 [NSColor blackColor], NSForegroundColorAttributeName,
48 [
self font], NSFontAttributeName,
50 return [title sizeWithAttributes:attributes];
55 -(void) computeMinWidth {
56 NSSize size = [
self neededTextSize];
59 minWidth += [[self image] size].width;
68 -(void) clicked:(
id) sender {
74 - (void)setTitle:(NSString *)aString {
75 [
super setTitle:aString];
76 [
self computeMinWidth];
79 - (void)setImage:(NSImage *)anImage {
80 [
super setImage:anImage];
81 [
self computeMinWidth];
84 #pragma mark Protocoll Methods