Added missing Cocoa methods and a Cocoa header file.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@19269 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2004-05-08 13:40:40 +00:00
parent c35f6f8821
commit 6b78af5ade
4 changed files with 249 additions and 11 deletions

View file

@ -308,8 +308,6 @@
if (delegate != nil && shouldCloseSelector != NULL)
{
// FIXME: This is the only way I know to call a callback with
// irregular arguments
void (*meth)(id, SEL, id, BOOL, void*);
meth = (void (*)(id, SEL, id, BOOL, void*))[delegate methodForSelector:
shouldCloseSelector];
@ -342,8 +340,6 @@
if (delegate != nil && callback != NULL)
{
// FIXME: This is the only way I know to call a callback with
// irregular argumetns
void (*meth)(id, SEL, id, BOOL, void*);
meth = (void (*)(id, SEL, id, BOOL, void*))[delegate methodForSelector:
callback];
@ -515,7 +511,6 @@
}
[savePanel setTitle: title];
if ([self fileName])
directory = [[self fileName] stringByDeletingLastPathComponent];
@ -523,6 +518,11 @@
directory = [controller currentDirectory];
[savePanel setDirectory: directory];
if (![self prepareSavePanel: savePanel])
{
return nil;
}
if ([self runModalSavePanel: savePanel withAccessoryView: accessory])
{
return [savePanel filename];
@ -662,7 +662,9 @@
[self setFileType: fileType];
[self updateChangeCount: NSChangeCleared];
}
// FIXME: Should set the file attributes
if (backupFilename && ![self keepBackupFile])
{
[fileManager removeFileAtPath: backupFilename handler: nil];
@ -716,7 +718,10 @@
didSaveSelector: (SEL)didSaveSelector
contextInfo: (void *)contextInfo
{
// FIXME
[self runModalSavePanelForSaveOperation: NSSaveOperation
delegate: delegate
didSaveSelector: didSaveSelector
contextInfo: contextInfo];
}
- (void)saveToFile: (NSString *)fileName
@ -725,7 +730,23 @@
didSaveSelector: (SEL)didSaveSelector
contextInfo: (void *)contextInfo
{
// FIXME
BOOL saved = NO;
if (fileName != nil)
{
saved = [self writeWithBackupToFile: fileName
ofType: [self fileTypeFromLastRunSavePanel]
saveOperation: saveOperation];
}
if (delegate != nil && didSaveSelector != NULL)
{
void (*meth)(id, SEL, id, BOOL, void*);
meth = (void (*)(id, SEL, id, BOOL, void*))[delegate methodForSelector:
didSaveSelector];
if (meth)
meth(delegate, didSaveSelector, self, saved, contextInfo);
}
}
- (BOOL)prepareSavePanel: (NSSavePanel *)savePanel
@ -738,7 +759,15 @@
didSaveSelector: (SEL)didSaveSelector
contextInfo: (void *)contextInfo
{
// FIXME
NSString *fileName;
// FIXME: Setting of the delegate of the save panel is missing
fileName = [self fileNameFromRunningSavePanelForSaveOperation: saveOperation];
[self saveToFile: fileName
saveOperation: saveOperation
delegate: delegate
didSaveSelector: didSaveSelector
contextInfo: contextInfo];
}
- (IBAction)revertDocumentToSaved: (id)sender

View file

@ -2682,12 +2682,163 @@ byExtendingSelection: (BOOL)flag
- (void) selectColumnIndexes: (NSIndexSet *)indexes byExtendingSelection: (BOOL)extend
{
// FIXME
BOOL empty = ([indexes firstIndex] == NSNotFound);
BOOL changed = NO;
unsigned int col;
if (!_selectingColumns)
{
_selectingColumns = YES;
if (_headerView)
{
[_headerView setNeedsDisplay: YES];
}
}
/* Stop editing if any */
if (_textObject != nil)
{
[self validateEditing];
[self abortEditing];
}
if (extend == NO)
{
/* If the current selection is the one we want, just ends editing
* This is not just a speed up, it prevents us from sending
* a NSTableViewSelectionDidChangeNotification.
* This behaviour is required by the specifications */
if ([_selectedColumns isEqualToIndexSet: indexes])
{
if (!empty)
{
_selectedColumn = [indexes lastIndex];
}
return;
}
[self _unselectAllColumns];
changed = YES;
}
if (!empty)
{
if ([indexes lastIndex] >= _numberOfColumns)
{
[NSException raise: NSInvalidArgumentException
format: @"Column index out of table in selectColumn"];
}
/* This check is not fully correct, as both sets may contain just
the same entry, but works according to the old specification. */
if (_allowsMultipleSelection == NO &&
[_selectedColumns count] + [indexes count] > 1)
{
[NSException raise: NSInternalInconsistencyException
format: @"Can not set multiple selection in table view when multiple selection is disabled"];
}
col = [indexes firstIndex];
while (col != NSNotFound)
{
if (![_selectedColumns containsIndex: col])
{
[self setNeedsDisplayInRect: [self rectOfColumn: col]];
if (_headerView)
{
[_headerView setNeedsDisplayInRect:
[_headerView headerRectOfColumn: col]];
}
changed = YES;
}
col = [indexes indexGreaterThanIndex: col];
}
[_selectedColumns addIndexes: indexes];
_selectedColumn = [indexes lastIndex];
}
if (changed)
{
[self _postSelectionDidChangeNotification];
}
}
- (void) selectRowIndexes: (NSIndexSet *)indexes byExtendingSelection: (BOOL)extend
{
// FIXME
BOOL empty = ([indexes firstIndex] == NSNotFound);
BOOL changed = NO;
unsigned int row;
if (_selectingColumns)
{
_selectingColumns = NO;
if (_headerView)
{
[_headerView setNeedsDisplay: YES];
}
}
/* Stop editing if any */
if (_textObject != nil)
{
[self validateEditing];
[self abortEditing];
}
if (extend == NO)
{
/* If the current selection is the one we want, just ends editing
* This is not just a speed up, it prevents us from sending
* a NSTableViewSelectionDidChangeNotification.
* This behaviour is required by the specifications */
if ([_selectedRows isEqualToIndexSet: indexes])
{
if (!empty)
{
_selectedRow = [indexes lastIndex];
}
return;
}
[self _unselectAllRows];
changed = YES;
}
if (!empty)
{
if ([indexes lastIndex] >= _numberOfRows)
{
[NSException raise: NSInvalidArgumentException
format: @"Row index out of table in selectRow"];
}
/* This check is not fully correct, as both sets may contain just
the same entry, but works according to the old specification. */
if (_allowsMultipleSelection == NO &&
[_selectedRows count] + [indexes count] > 1)
{
[NSException raise: NSInternalInconsistencyException
format: @"Can not set multiple selection in table view when multiple selection is disabled"];
}
row = [indexes firstIndex];
while (row != NSNotFound)
{
if (![_selectedRows containsIndex: row])
{
[self setNeedsDisplayInRect: [self rectOfRow: row]];
}
row = [indexes indexGreaterThanIndex: row];
}
[_selectedRows addIndexes: indexes];
_selectedRow = [indexes lastIndex];
changed = YES;
}
if (changed)
{
[self _postSelectionDidChangeNotification];
}
}
- (NSIndexSet *) selectedColumnIndexes;