mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 20:10:37 +00:00
* configure.ac: Try to improve the ICU detection.
* configure: regenerate * Headers/AppKit/NSTrackingArea.h * Source/NSTrackingArea.m: Remove compiler warnings. * Headers/AppKit/NSBrowser.h, * Source/NSBrowser.m: Add a few new Cocoa methods. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@37399 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
26a36530a1
commit
dddd3f5e3b
7 changed files with 2254 additions and 4772 deletions
|
@ -39,6 +39,7 @@
|
|||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSDebug.h>
|
||||
#import <Foundation/NSException.h>
|
||||
#import <Foundation/NSIndexPath.h>
|
||||
#import <Foundation/NSNotification.h>
|
||||
#import <Foundation/NSUserDefaults.h>
|
||||
#import "AppKit/NSBrowser.h"
|
||||
|
@ -457,6 +458,136 @@ static BOOL browserUseBezels;
|
|||
}
|
||||
}
|
||||
|
||||
/** <p>Returns the index path of the selected item, or nil if there is
|
||||
no selection.
|
||||
*/
|
||||
- (NSIndexPath *) selectionIndexPath
|
||||
{
|
||||
NSInteger columnNumber = 0;
|
||||
NSInteger selectedColumn = [self selectedColumn];
|
||||
|
||||
if (selectedColumn > -1)
|
||||
{
|
||||
NSUInteger rowIndexes[selectedColumn + 1];
|
||||
|
||||
for (columnNumber = 0; columnNumber <= selectedColumn; columnNumber++)
|
||||
{
|
||||
rowIndexes[columnNumber] = [self selectedRowInColumn: columnNumber];
|
||||
}
|
||||
|
||||
return [[NSIndexPath alloc] initWithIndexes: rowIndexes
|
||||
length: selectedColumn + 1];
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSArray *) selectionIndexPaths
|
||||
{
|
||||
NSInteger selectedColumn = [self selectedColumn];
|
||||
|
||||
if (selectedColumn == -1)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
else
|
||||
{
|
||||
NSMutableArray *paths = AUTORELEASE([[NSMutableArray alloc] init]);
|
||||
NSMatrix *matrix;
|
||||
NSArray *selectedCells;
|
||||
NSUInteger count;
|
||||
|
||||
// FIXME: There should be a more efficent way to the the selected row numbers
|
||||
if (!(matrix = [self matrixInColumn: selectedColumn]))
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
selectedCells = [matrix selectedCells];
|
||||
if (selectedCells == nil)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
count = [selectedCells count];
|
||||
NSInteger seletedRows[count];
|
||||
NSEnumerator *enumerator = [selectedCells objectEnumerator];
|
||||
NSCell *cell;
|
||||
int i = 0;
|
||||
|
||||
while ((cell = [enumerator nextObject]) != nil)
|
||||
{
|
||||
NSInteger row;
|
||||
NSInteger column;
|
||||
|
||||
[matrix getRow: &row
|
||||
column: &column
|
||||
ofCell: cell];
|
||||
seletedRows[i++] = row;
|
||||
}
|
||||
|
||||
if (selectedColumn > 0)
|
||||
{
|
||||
NSIndexPath *indexPath;
|
||||
NSUInteger rowIndexes[selectedColumn + 1];
|
||||
NSInteger columnNumber = 0;
|
||||
|
||||
for (columnNumber = 0; columnNumber <= selectedColumn; columnNumber++)
|
||||
{
|
||||
rowIndexes[columnNumber] = [self selectedRowInColumn: columnNumber];
|
||||
}
|
||||
|
||||
indexPath = [[NSIndexPath alloc] initWithIndexes: rowIndexes
|
||||
length: selectedColumn + 1];
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
[paths addObject: [indexPath indexPathByAddingIndex: seletedRows[i]]];
|
||||
}
|
||||
}
|
||||
if (selectedColumn == 0)
|
||||
{
|
||||
NSIndexPath *indexPath;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
indexPath = [[NSIndexPath alloc] initWithIndex: seletedRows[i]];
|
||||
[paths addObject: indexPath];
|
||||
RELEASE(indexPath);
|
||||
}
|
||||
}
|
||||
return paths;
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void) setSelectionIndexPath: (NSIndexPath *)path
|
||||
{
|
||||
NSInteger column;
|
||||
NSUInteger length;
|
||||
|
||||
length = [path length];
|
||||
for (column = 0; column < length; column++)
|
||||
{
|
||||
NSInteger row = [path indexAtPosition: column];
|
||||
|
||||
[self selectRow: row inColumn: column];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) setSelectionIndexPaths: (NSArray *)paths
|
||||
{
|
||||
NSEnumerator *enumerator = [paths objectEnumerator];
|
||||
NSIndexPath *path;
|
||||
|
||||
while ((path = [enumerator nextObject]) != nil)
|
||||
{
|
||||
// FIXME
|
||||
[self setSelectionIndexPath: path];
|
||||
}
|
||||
}
|
||||
|
||||
/** Loads if necessary and returns the NSCell at row in column.
|
||||
if you change this code, you may want to look at the __performLoadOfColumn:
|
||||
method in which the following code is integrated (for speed)
|
||||
|
@ -1372,6 +1503,46 @@ static BOOL browserUseBezels;
|
|||
}
|
||||
}
|
||||
|
||||
- (BOOL) autohidesScroller
|
||||
{
|
||||
// FIXME
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void) setAutohidesScroller: (BOOL)flag
|
||||
{
|
||||
// FIXME
|
||||
}
|
||||
|
||||
- (NSColor *) backgroundColor
|
||||
{
|
||||
// FIXME
|
||||
return [NSColor controlColor];
|
||||
}
|
||||
|
||||
- (void) setBackgroundColor: (NSColor *)backgroundColor
|
||||
{
|
||||
// FIXME
|
||||
}
|
||||
|
||||
- (BOOL) canDragRowsWithIndexes: (NSIndexSet *)rowIndexes
|
||||
inColumn: (NSInteger)columnIndex
|
||||
withEvent: (NSEvent *)dragEvent
|
||||
{
|
||||
if ([_browserDelegate respondsToSelector:
|
||||
@selector(browser:canDragRowsWithIndexes:inColumn:withEvent:)])
|
||||
{
|
||||
return [_browserDelegate browser: self
|
||||
canDragRowsWithIndexes: rowIndexes
|
||||
inColumn: columnIndex
|
||||
withEvent: dragEvent];
|
||||
}
|
||||
else
|
||||
{
|
||||
// FIXME
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Manipulating column titles
|
||||
|
@ -1747,6 +1918,17 @@ static BOOL browserUseBezels;
|
|||
_sendsActionOnArrowKeys = flag;
|
||||
}
|
||||
|
||||
- (BOOL) allowsTypeSelect
|
||||
{
|
||||
// FIXME
|
||||
return [self acceptsArrowKeys];
|
||||
}
|
||||
|
||||
- (void) setAllowsTypeSelect: (BOOL)allowsTypeSelection
|
||||
{
|
||||
// FIXME
|
||||
[self setAcceptsArrowKeys: allowsTypeSelection];
|
||||
}
|
||||
|
||||
/*
|
||||
* Getting column frames
|
||||
|
@ -2228,6 +2410,18 @@ static BOOL browserUseBezels;
|
|||
[self sendAction: _doubleAction to: [self target]];
|
||||
}
|
||||
|
||||
- (NSInteger) clickedColumn
|
||||
{
|
||||
// FIXME: Return column number from doClick:
|
||||
return -1;
|
||||
}
|
||||
|
||||
- (NSInteger) clickedRow
|
||||
{
|
||||
// FIXME: Return row number from doClick:
|
||||
return -1;
|
||||
}
|
||||
|
||||
+ (void) _themeDidActivate: (NSNotification*)n
|
||||
{
|
||||
GSTheme *theme = [GSTheme theme];
|
||||
|
@ -3099,7 +3293,7 @@ static BOOL browserUseBezels;
|
|||
[matrix setAutoscroll: YES];
|
||||
|
||||
// Set up background colors.
|
||||
[matrix setBackgroundColor: [NSColor controlColor]];
|
||||
[matrix setBackgroundColor: [self backgroundColor]];
|
||||
[matrix setDrawsBackground: YES];
|
||||
|
||||
if (!_allowsMultipleSelection)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue