From a5b32e8ee85f7c861d25d69ebb92c825914df1e4 Mon Sep 17 00:00:00 2001 From: Fred Kiefer Date: Tue, 26 Dec 2000 21:42:57 +0000 Subject: [PATCH] Delegate all the new methods to the cell. Replaced all calls to [display] with [setNeedsDisplay:] excuding those in [setState:] and [setNextState:]. Removed the initXXX methods, as they were doublicated code from super. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@8443 72102866-910b-0410-8b05-ffd578937521 --- Source/NSButton.m | 108 +++++++++++++++++++++++++++++----------------- 1 file changed, 69 insertions(+), 39 deletions(-) diff --git a/Source/NSButton.m b/Source/NSButton.m index 0d98fda23..a9c016130 100644 --- a/Source/NSButton.m +++ b/Source/NSButton.m @@ -72,27 +72,6 @@ id _nsbuttonCellClass = nil; // // Instance methods // -// -// Initialization -// -- (id) init -{ - return [self initWithFrame: NSZeroRect]; -} - -- (id) initWithFrame: (NSRect)frameRect -{ - NSCell *aCell; - - [super initWithFrame: frameRect]; - - // set our cell - aCell = [[[self class] cellClass] new]; - [self setCell: aCell]; - RELEASE(aCell); - - return self; -} - (BOOL) acceptsFirstMouse: (NSEvent *)theEvent { @@ -105,7 +84,7 @@ id _nsbuttonCellClass = nil; - (void) setButtonType: (NSButtonType)aType { [_cell setButtonType: aType]; - [self display]; + [self setNeedsDisplay: YES]; } // @@ -150,6 +129,7 @@ id _nsbuttonCellClass = nil; - (void)setNextState { [_cell setNextState]; + [self display]; } // @@ -178,13 +158,13 @@ id _nsbuttonCellClass = nil; - (void) setAlternateTitle: (NSString *)aString { [_cell setAlternateTitle: aString]; - [self display]; + [self setNeedsDisplay: YES]; } - (void) setTitle: (NSString *)aString { [_cell setTitle: aString]; - [self display]; + [self setNeedsDisplay: YES]; } - (NSString *) title @@ -192,6 +172,34 @@ id _nsbuttonCellClass = nil; return [_cell title]; } +- (NSAttributedString *)attributedAlternateTitle +{ + return [_cell attributedAlternateTitle]; +} + +- (NSAttributedString *)attributedTitle +{ + return [_cell attributedTitle]; +} + +- (void)setAttributedAlternateTitle:(NSAttributedString *)aString +{ + [_cell setAttributedAlternateTitle: aString]; + [self setNeedsDisplay: YES]; +} + +- (void)setAttributedTitle:(NSAttributedString *)aString +{ + [_cell setAttributedTitle: aString]; + [self setNeedsDisplay: YES]; +} + +- (void)setTitleWithMnemonic:(NSString *)aString +{ + [_cell setTitleWithMnemonic: aString]; + [self setNeedsDisplay: YES]; +} + // // Setting the Images // @@ -213,29 +221,19 @@ id _nsbuttonCellClass = nil; - (void) setAlternateImage: (NSImage *)anImage { [_cell setAlternateImage: anImage]; - [self display]; + [self setNeedsDisplay: YES]; } - (void) setImage: (NSImage *)anImage { [_cell setImage: anImage]; - [self display]; + [self setNeedsDisplay: YES]; } - (void) setImagePosition: (NSCellImagePosition)aPosition { [_cell setImagePosition: aPosition]; - [self display]; -} - -- (void) setAlignment: (NSTextAlignment)mode -{ - [_cell setAlignment: mode]; -} - -- (NSTextAlignment) alignment -{ - return [_cell alignment]; + [self setNeedsDisplay: YES]; } // @@ -254,13 +252,35 @@ id _nsbuttonCellClass = nil; - (void) setBordered: (BOOL)flag { [_cell setBordered: flag]; - [self display]; + [self setNeedsDisplay: YES]; } - (void) setTransparent: (BOOL)flag { [_cell setTransparent: flag]; - [self display]; + [self setNeedsDisplay: YES]; +} + +- (NSBezelStyle)bezelStyle +{ + return [_cell bezelStyle]; +} + +- (void)setBezelStyle:(NSBezelStyle)bezelStyle +{ + [_cell setBezelStyle: bezelStyle]; + [self setNeedsDisplay: YES]; +} + +- (BOOL)showsBorderOnlyWhileMouseInside +{ + return [_cell showsBorderOnlyWhileMouseInside]; +} + +- (void)setShowsBorderOnlyWhileMouseInside:(BOOL)show +{ + [_cell setShowsBorderOnlyWhileMouseInside: show]; + [self setNeedsDisplay: YES]; } // @@ -358,6 +378,16 @@ id _nsbuttonCellClass = nil; return NO; } +- (void)setSound:(NSSound *)aSound +{ + [_cell setSound: aSound]; +} + +- (NSSound *)sound +{ + return [_cell sound]; +} + // // NSCoding protocol //