mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-29 18:02:03 +00:00
Merge remote-tracking branch 'cappuccino/master'
This commit is contained in:
commit
5a2181c064
4 files changed
+25
-10
No files matched your search
+12
-1
@@ -136,6 +136,8 @@ var CPTabViewDidSelectTabViewItemSelector = 1 << 1,
|
||||
|
||||
- (void)_insertTabViewItems:(CPArray)tabViewItems atIndexes:(CPIndexSet)indexes
|
||||
{
|
||||
var prevItemsCount = [self numberOfTabViewItems];
|
||||
|
||||
[_tabs insertSegments:tabViewItems atIndexes:indexes];
|
||||
[tabViewItems makeObjectsPerformSelector:@selector(_setTabView:) withObject:self];
|
||||
|
||||
@@ -143,6 +145,10 @@ var CPTabViewDidSelectTabViewItemSelector = 1 << 1,
|
||||
[self _reverseSetContent];
|
||||
|
||||
[self _sendDelegateTabViewDidChangeNumberOfTabViewItems];
|
||||
|
||||
// Do not allow empty selection if selection bindings are not enabled.
|
||||
if (prevItemsCount == 0 && [self numberOfTabViewItems] > 0 && ![self _isSelectionBinded])
|
||||
[self _selectTabViewItemAtIndex:0];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -169,7 +175,7 @@ var CPTabViewDidSelectTabViewItemSelector = 1 << 1,
|
||||
- (void)_didRemoveTabViewItem:(CPTabViewItem)aTabViewItem atIndex:(CPInteger)idx
|
||||
{
|
||||
// If the selection is managed by bindings, let the binder do that.
|
||||
if ([self binderForBinding:CPSelectionIndexesBinding] || [self binderForBinding:CPSelectedIndexBinding])
|
||||
if ([self _isSelectionBinded])
|
||||
return;
|
||||
|
||||
if (_selectedTabViewItem == aTabViewItem)
|
||||
@@ -615,6 +621,11 @@ var CPTabViewDidSelectTabViewItemSelector = 1 << 1,
|
||||
return [cls getBinding:aBinding forObject:self];
|
||||
}
|
||||
|
||||
- (BOOL)_isSelectionBinded
|
||||
{
|
||||
return [self binderForBinding:CPSelectionIndexesBinding] || [self binderForBinding:CPSelectedIndexBinding];
|
||||
}
|
||||
|
||||
- (void)setItems:(CPArray)tabViewItems
|
||||
{
|
||||
if ([tabViewItems isEqualToArray:[_tabs segments]])
|
||||
|
||||
@@ -138,4 +138,16 @@
|
||||
[self assert:[_tabView selectedTabViewItem] equals:_tabItem2];
|
||||
}
|
||||
|
||||
- (void)testTabViewItemSelectionNotEmpty
|
||||
{
|
||||
// after insertion from empty and no explicit selection.
|
||||
[self assert:[_tabView numberOfTabViewItems] equals:2];
|
||||
[self assert:[_tabView selectedTabViewItem] equals:_tabItem1];
|
||||
|
||||
// Removes selected Item.
|
||||
[_tabView removeTabViewItem:_tabItem1];
|
||||
[self assert:[_tabView numberOfTabViewItems] equals:1];
|
||||
[self assert:[_tabView selectedTabViewItem] equals:_tabItem2];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -50,12 +50,7 @@
|
||||
_classesKeys = [aCoder decodeObjectForKey:@"NSClassesKeys"];
|
||||
_classesValues = [aCoder decodeObjectForKey:@"NSClassesValues"];
|
||||
|
||||
var connections = [aCoder decodeObjectForKey:@"NSConnections"];
|
||||
// Filter out connections with invalid destinations.
|
||||
_connections = [connections filteredArrayUsingBlock:function(conn, idx, stop)
|
||||
{
|
||||
return [conn destination] !== nil;
|
||||
}];
|
||||
_connections = [aCoder decodeObjectForKey:@"NSConnections"];
|
||||
|
||||
//_fontManager = [aCoder decodeObjectForKey:@"NSFontManager"] retain];
|
||||
_framework = [aCoder decodeObjectForKey:@"NSFramework"];
|
||||
|
||||
@@ -42,9 +42,6 @@ NIB_CONNECTION_EQUIVALENCY_TABLE = {};
|
||||
_destination = [aCoder decodeObjectForKey:@"NSDestination"];
|
||||
_label = [aCoder decodeObjectForKey:@"NSLabel"];
|
||||
|
||||
if (_destination == nil)
|
||||
CPLog.warn(_label);
|
||||
|
||||
var sourceUID = [_source UID],
|
||||
destinationUID = [_destination UID];
|
||||
|
||||
|
||||
Reference in new issue
Block a user