diff --git a/AppKit/CPTabViewItem.j b/AppKit/CPTabViewItem.j index 671d5bc78..922a1b51f 100644 --- a/AppKit/CPTabViewItem.j +++ b/AppKit/CPTabViewItem.j @@ -61,6 +61,14 @@ CPPressedTab = 2; CPTabView _tabView; unsigned _tabState; // Looks like it is not yet implemented + + CPImage _image @accessors(property=image); + CPViewController _viewController @accessors(getter=viewController); + + BOOL _enabled @accessors(property=enabled); + BOOL _selected @accessors(property=selected); + CGRect _tabRect @accessors(property=frame); + float _width @accessors(property=width); } - (id)init @@ -68,6 +76,19 @@ CPPressedTab = 2; return [self initWithIdentifier:@""]; } +- (void)_init +{ + _tag = 0; + _viewController = nil; + _image = nil; + _tabState = 0; + _tabView = nil; + _enabled = YES; + _selected = NO; + _tabRect = CGRectMakeZero(); + _width = 0; +} + /*! Initializes the tab view item with the specified identifier. @return the initialized CPTabViewItem @@ -76,8 +97,12 @@ CPPressedTab = 2; { self = [super init]; - if (self) - _identifier = anIdentifier; + [self _init]; + + _identifier = anIdentifier; + _label = nil; + _view = nil; + //_auxiliaryView = nil; return self; } @@ -101,6 +126,28 @@ CPPressedTab = 2; return _label; } +// Working With Images +/*! + Sets the CPTabViewItem's image. + @param anImage the image for the item +*/ +- (void)setImage:(CPImage)anImage +{ + if ([anImage isEqual:_image]) + return; + + _image = anImage; + [_tabView tileWithChangedItem:self]; +} + +/*! + Returns the CPTabViewItem's image +*/ +- (CPImage)image +{ + return _image; +} + // Checking the Tab Display State /*! Returns the tab's current state. @@ -190,6 +237,7 @@ CPPressedTab = 2; var CPTabViewItemIdentifierKey = "CPTabViewItemIdentifierKey", CPTabViewItemLabelKey = "CPTabViewItemLabelKey", + CPTabViewItemImageKey = "CPTabViewItemImageKey", CPTabViewItemViewKey = "CPTabViewItemViewKey", CPTabViewItemAuxViewKey = "CPTabViewItemAuxViewKey"; @@ -202,8 +250,11 @@ var CPTabViewItemIdentifierKey = "CPTabViewItemIdentifierKey", if (self) { + [self _init]; + _identifier = [aCoder decodeObjectForKey:CPTabViewItemIdentifierKey]; _label = [aCoder decodeObjectForKey:CPTabViewItemLabelKey]; + _image = [aCoder decodeObjectForKey:CPTabViewItemImageKey]; _view = [aCoder decodeObjectForKey:CPTabViewItemViewKey]; _auxiliaryView = [aCoder decodeObjectForKey:CPTabViewItemAuxViewKey]; @@ -216,6 +267,7 @@ var CPTabViewItemIdentifierKey = "CPTabViewItemIdentifierKey", { [aCoder encodeObject:_identifier forKey:CPTabViewItemIdentifierKey]; [aCoder encodeObject:_label forKey:CPTabViewItemLabelKey]; + [aCoder encodeObject:_image forKey:CPTabViewItemImageKey]; [aCoder encodeObject:_view forKey:CPTabViewItemViewKey]; [aCoder encodeObject:_auxiliaryView forKey:CPTabViewItemAuxViewKey]; diff --git a/Tools/nib2cib/NSTabViewItem.j b/Tools/nib2cib/NSTabViewItem.j index 07a34237c..eec92cb26 100644 --- a/Tools/nib2cib/NSTabViewItem.j +++ b/Tools/nib2cib/NSTabViewItem.j @@ -31,6 +31,7 @@ { _identifier = [aCoder decodeObjectForKey:"NSIdentifier"]; _label = [aCoder decodeObjectForKey:"NSLabel"]; + _image = [aCoder decodeObjectForKey:"NSImage"]; _view = [aCoder decodeObjectForKey:"NSView"];