mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-26 04:10:42 +00:00
fix CPArrayController selectPrevious: and selectNext:
Also added unit-tests for canSelectPrevious, canSelectNext, selectPrevious: and selectNext:
This commit is contained in:
+12
-12
@@ -358,29 +358,29 @@
|
||||
|
||||
//Moving selection
|
||||
|
||||
-(BOOL)canSelectPrevious
|
||||
- (BOOL)canSelectPrevious
|
||||
{
|
||||
return [[self selectionIndexes] firstIndex] > 0
|
||||
}
|
||||
|
||||
-(BOOL)canSelectNext
|
||||
-(void)selectPrevious:(id)sender
|
||||
{
|
||||
return [[self selectionIndexes] firstIndex] < [[self arrangedObjects] count] -1;
|
||||
}
|
||||
var index = [[self selectionIndexes] firstIndex] - 1;
|
||||
|
||||
-(void)selectNext:(id)sender
|
||||
{
|
||||
var index = [[self selectionIndexes] firstIndex] + 1 || 0;
|
||||
|
||||
if (index < [[self arrangedObjects] count])
|
||||
if (index >= 0)
|
||||
[self setSelectionIndexes:[CPIndexSet indexSetWithIndex:index]];
|
||||
}
|
||||
|
||||
-(void)selectPrevious:(id)sender
|
||||
- (BOOL)canSelectNext
|
||||
{
|
||||
var index = [[self selectionIndexes] firstIndex] - 1 || [[self arrangedObjects] count] - 1;
|
||||
return [[self selectionIndexes] firstIndex] < [[self arrangedObjects] count] - 1;
|
||||
}
|
||||
|
||||
if (index >= 0)
|
||||
- (void)selectNext:(id)sender
|
||||
{
|
||||
var index = [[self selectionIndexes] firstIndex] + 1;
|
||||
|
||||
if (index < [[self arrangedObjects] count])
|
||||
[self setSelectionIndexes:[CPIndexSet indexSetWithIndex:index]];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user