Merge branch 'master' of git@github.com:280north/cappuccino

This commit is contained in:
Francisco Ryan Tolmasky I
2008-12-10 23:41:56 -08:00
5 changed files with 216 additions and 1 deletions
+50 -1
View File
@@ -78,7 +78,7 @@ var CPTabViewDidSelectTabViewItemSelector = 1,
THe currently selected CPTabViewItem is the view that is displayed.
*/
@implementation CPTabView : CPView
{
{
CPView _labelsView;
CPView _backgroundView;
CPView _separatorView;
@@ -524,6 +524,55 @@ var CPTabViewDidSelectTabViewItemSelector = 1,
@end
var CPTabViewItemsKey = "CPTabViewItemsKey",
CPTabViewSelectedItemKey = "CPTabViewSelectedItemKey",
CPTabViewTypeKey = "CPTabViewTypeKey",
CPTabViewDelegateKey = "CPTabViewDelegateKey";
@implementation CPTabView (CPCoding)
- (id)initWithCoder:(CPCoder)aCoder
{
if (self = [super initWithCoder:aCoder])
{
_tabViewType = [aCoder decodeIntForKey:CPTabViewTypeKey];
_tabViewItems = [];
// FIXME: this is somewhat hacky
[self _createBezelBorder];
var items = [aCoder decodeObjectForKey:CPTabViewItemsKey];
for (var i = 0; items && i < items.length; i++)
[self insertTabViewItem:items[i] atIndex:i];
var selected = [aCoder decodeObjectForKey:CPTabViewSelectedItemKey];
if (selected)
[self selectTabViewItem:selected];
[self setDelegate:[aCoder decodeObjectForKey:CPTabViewDelegateKey]];
}
return self;
}
- (void)encodeWithCoder:(CPCoder)aCoder
{
var actualSubviews = _subviews;
_subviews = [];
[super encodeWithCoder:aCoder];
_subviews = actualSubviews;
[aCoder encodeObject:_tabViewItems forKey:CPTabViewItemsKey];;
[aCoder encodeObject:_selectedTabViewItem forKey:CPTabViewSelectedItemKey];
[aCoder encodeInt:_tabViewType forKey:CPTabViewTypeKey];
[aCoder encodeConditionalObject:_delegate forKey:CPTabViewDelegateKey];
}
@end
var _CPTabLabelsViewBackgroundColor = nil,
_CPTabLabelsViewInsideMargin = 10.0,
_CPTabLabelsViewOutsideMargin = 15.0;
+37
View File
@@ -162,3 +162,40 @@ CPPressedTab = 2;
}
@end
var CPTabViewItemIdentifierKey = "CPTabViewItemIdentifierKey",
CPTabViewItemLabelKey = "CPTabViewItemLabelKey",
CPTabViewItemViewKey = "CPTabViewItemViewKey",
CPTabViewItemAuxViewKey = "CPTabViewItemAuxViewKey";
@implementation CPTabViewItem (CPCoding)
- (id)initWithCoder:(CPCoder)aCoder
{
self = [super init];
if (self)
{
_identifier = [aCoder decodeObjectForKey:CPTabViewItemIdentifierKey];
_label = [aCoder decodeObjectForKey:CPTabViewItemLabelKey];
_view = [aCoder decodeObjectForKey:CPTabViewItemViewKey];
_auxiliaryView = [aCoder decodeObjectForKey:CPTabViewItemAuxViewKey];
CPLog.warn("_identifier="+_identifier+" _label="+_label+" _view="+_view+" _auxiliaryView="+_auxiliaryView);
}
return self;
}
- (void)encodeWithCoder:(CPCoder)aCoder
{
[aCoder encodeObject:_identifier forKey:CPTabViewItemIdentifierKey];
[aCoder encodeObject:_label forKey:CPTabViewItemLabelKey];
[aCoder encodeObject:_view forKey:CPTabViewItemViewKey];
[aCoder encodeObject:_auxiliaryView forKey:CPTabViewItemAuxViewKey];
}
@end
+2
View File
@@ -36,6 +36,8 @@
@import "NSResponder.j"
@import "NSSlider.j"
@import "NSSplitView.j"
@import "NSTabView.j"
@import "NSTabViewItem.j"
@import "NSTextField.j"
@import "NSToolbar.j"
@import "NSView.j"
+67
View File
@@ -0,0 +1,67 @@
/*
* NSTabView.j
* nib2cib
*
* Created by Thomas Robinson.
* Copyright 2008, 280 North, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@import <AppKit/CPTabView.j>
@import "NSTabViewItem.j"
@implementation CPTabView (CPCoding)
- (id)NS_initWithCoder:(CPCoder)aCoder
{
if (self = [super NS_initWithCoder:aCoder])
{
var flags = [aCoder decodeObjectForKey:@"NSTvFlags"];
_tabViewType = flags & 0x7;
_tabViewItems = [aCoder decodeObjectForKey:@"NSTabViewItems"];
_selectedTabViewItem = [aCoder decodeObjectForKey:@"NSSelectedTabViewItem"];
//_delegate = [aCoder decodeObjectForKey:@""];
// not yet supported:
//_allowsTruncatedLabels = [aCoder decodeBoolForKey:@"NSAllowTruncatedLabels"];
//_drawsBackground = [aCoder decodeBoolForKey:@"NSDrawsBackground"];
}
return self;
}
@end
@implementation NSTabView : CPTabView
{
}
- (id)initWithCoder:(CPCoder)aCoder
{
return [self NS_initWithCoder:aCoder];
}
- (Class)classForKeyedArchiver
{
return [CPTabView class];
}
@end
+60
View File
@@ -0,0 +1,60 @@
/*
* NSTabViewItem.j
* nib2cib
*
* Created by Thomas Robinson.
* Copyright 2008, 280 North, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@import <AppKit/CPTabViewItem.j>
@implementation CPTabViewItem (CPCoding)
- (id)NS_initWithCoder:(CPCoder)aCoder
{
if (self = [super init])
{
_identifier = [aCoder decodeObjectForKey:"NSIdentifier"];
_label = [aCoder decodeObjectForKey:"NSLabel"];
_view = [aCoder decodeObjectForKey:"NSView"];
// doesn't exist in Cocoa
//_auxiliaryView = [aCoder decodeObjectForKey:CPTabViewItemAuxViewKey]
}
return self;
}
@end
@implementation NSTabViewItem : CPTabViewItem
{
}
- (id)initWithCoder:(CPCoder)aCoder
{
return [self NS_initWithCoder:aCoder];
}
- (Class)classForKeyedArchiver
{
return [CPTabViewItem class];
}
@end