mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-12-03 03:24:22 +00:00
Added basic suppport for CPOutlineView in the nib2cib tool
Conflicts: AppKit/CPOutlineView.j
This commit is contained in:
1 parent
44fb4a9b83
commit
da0af13142
3 files changed
+116
No files matched your search
@@ -1275,6 +1275,56 @@ var _loadItemInfoForItem = function(/*CPOutlineView*/ anOutlineView, /*id*/ anIt
|
||||
|
||||
@end
|
||||
|
||||
|
||||
var CPOutlineViewIndentationPerLevelKey = @"CPOutlineViewIndentationPerLevelKey",
|
||||
CPOutlineViewOutlineTableColumnKey = @"CPOutlineViewOutlineTableColumnKey",
|
||||
CPOutlineViewDataSourceKey = @"CPOutlineViewDataSourceKey",
|
||||
CPOutlineViewDelegateKey = @"CPOutlineViewDelegateKey";
|
||||
|
||||
@implementation CPOutlineView (CPCoding)
|
||||
|
||||
- (id)initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
self = [super initWithCoder:aCoder];
|
||||
|
||||
if (self)
|
||||
{
|
||||
// The root item has weight "0", thus represents the weight solely of its descendants.
|
||||
_rootItemInfo = { isExpanded:YES, isExpandable:NO, level:-1, row:-1, children:[], weight:0 };
|
||||
|
||||
_itemsForRows = [];
|
||||
_itemInfosForItems = { };
|
||||
_disclosureControlsForRows = [];
|
||||
|
||||
[self setIndentationMarkerFollowsDataView:YES];
|
||||
[self setDisclosureControlPrototype:[[CPDisclosureButton alloc] initWithFrame:CGRectMake(0.0, 0.0, 10.0, 10.0)]];
|
||||
|
||||
_outlineTableColumn = [aCoder decodeObjectForKey:CPOutlineViewOutlineTableColumnKey];
|
||||
_indentationPerLevel = [aCoder decodeFloatForKey:CPOutlineViewIndentationPerLevelKey];
|
||||
|
||||
_outlineViewDataSource = [aCoder decodeObjectForKey:CPOutlineViewDataSourceKey];
|
||||
_outlineViewDelegate = [aCoder decodeObjectForKey:CPOutlineViewDelegateKey];
|
||||
|
||||
[super setDataSource:[[_CPOutlineViewTableViewDataSource alloc] initWithOutlineView:self]];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)encodeWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
[super encodeWithCoder:aCoder];
|
||||
|
||||
[aCoder encodeObject:_outlineTableColumn forKey:CPOutlineViewOutlineTableColumnKey];
|
||||
[aCoder encodeFloat:_indentationPerLevel forKey:CPOutlineViewIndentationPerLevelKey];
|
||||
|
||||
[aCoder encodeObject:_outlineViewDataSource forKey:CPOutlineViewDataSourceKey];
|
||||
[aCoder encodeObject:_outlineViewDelegate forKey:CPOutlineViewDelegateKey];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
var colorForDisclosureTriangle = function(isSelected, isHighlighted) {
|
||||
return isSelected
|
||||
? (isHighlighted
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
@import "NSMenu.j"
|
||||
@import "NSMenuItem.j"
|
||||
@import "NSNibConnector.j"
|
||||
@import "NSOutlineView.j"
|
||||
@import "NSPopUpButton.j"
|
||||
@import "NSResponder.j"
|
||||
@import "NSScrollView.j"
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* NSOutlineView.j
|
||||
* nib2cib
|
||||
*
|
||||
* Created by Andreas Falk.
|
||||
* Copyright 2009, Andreas Falk.
|
||||
*
|
||||
* 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/CPOutlineView.j>
|
||||
|
||||
|
||||
@implementation CPOutlineView (NSCoding)
|
||||
|
||||
- (id)NS_initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
self = [super NS_initWithCoder:aCoder];
|
||||
|
||||
if (self)
|
||||
{
|
||||
if([aCoder containsValueForKey:"NSOutlineViewOutlineTableColumnKey"])
|
||||
_outlineTableColumn = [aCoder decodeObjectForKey:@"NSOutlineViewOutlineTableColumnKey"];
|
||||
else
|
||||
_outlineTableColumn = [[self tableColumns] objectAtIndex:0];
|
||||
|
||||
_indentationPerLevel = [aCoder decodeFloatForKey:@"NSOutlineViewIndentationPerLevelKey"];
|
||||
|
||||
_outlineViewDataSource = [aCoder decodeObjectForKey:@"NSDataSource"];
|
||||
_outlineViewDelegate = [aCoder decodeObjectForKey:@"NSDelegate"];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation NSOutlineView : CPOutlineView
|
||||
{
|
||||
}
|
||||
|
||||
- (id)initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
return [self NS_initWithCoder:aCoder];
|
||||
}
|
||||
|
||||
- (Class)classForKeyedArchiver
|
||||
{
|
||||
return [CPOutlineView class];
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in new issue
Block a user