mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 03:10:38 +00:00
Merge pull request #73 from gnustep/NSText_branch
NSText* classes remaining in MISSING
This commit is contained in:
commit
31958bf6e5
16 changed files with 1223 additions and 44 deletions
|
@ -263,8 +263,11 @@ NSTextAlternatives.m \
|
|||
NSTextAttachment.m \
|
||||
NSTextBlock.m \
|
||||
NSTextContainer.m \
|
||||
NSTextCheckingController.m \
|
||||
NSTextField.m \
|
||||
NSTextFieldCell.m \
|
||||
NSTextFinder.m \
|
||||
NSTextInputContext.m \
|
||||
NSTextList.m \
|
||||
NSTextStorage.m \
|
||||
NSTextTable.m \
|
||||
|
@ -558,8 +561,13 @@ NSText.h \
|
|||
NSTextAlternatives.h \
|
||||
NSTextAttachment.h \
|
||||
NSTextContainer.h \
|
||||
NSTextCheckingClient.h \
|
||||
NSTextCheckingController.h \
|
||||
NSTextField.h \
|
||||
NSTextFieldCell.h \
|
||||
NSTextFinder.h \
|
||||
NSTextInputClient.h \
|
||||
NSTextInputContext.h \
|
||||
NSTextList.h \
|
||||
NSTextStorage.h \
|
||||
NSTextTable.h \
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
[aCoder encodeObject: _rowTemplates];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -76,6 +77,9 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
NSArray *rowTemplates = [aDecoder decodeObject];
|
||||
|
||||
[self setRowTemplates: rowTemplates];
|
||||
}
|
||||
|
||||
return self;
|
||||
|
|
150
Source/NSTextCheckingController.m
Normal file
150
Source/NSTextCheckingController.m
Normal file
|
@ -0,0 +1,150 @@
|
|||
/* Implementation of class NSTextCheckingController
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory John Casamento
|
||||
Date: 02-08-2020
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
||||
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 USA.
|
||||
*/
|
||||
|
||||
#import "AppKit/NSTextCheckingController.h"
|
||||
#import "AppKit/NSSpellChecker.h"
|
||||
|
||||
/*
|
||||
@interface NSSpellChecker (Private)
|
||||
- (void) _findNext: (id)sender;
|
||||
- (void) _ignore: (id)sender;
|
||||
- (void) _guess: (id)sender;
|
||||
- (void) _correct: (id)sender;
|
||||
- (void) _switchDictionary: (id)sender;
|
||||
- (void) _highlightGuess: (id)sender;
|
||||
@end
|
||||
*/
|
||||
|
||||
@implementation NSTextCheckingController
|
||||
|
||||
// initializer
|
||||
- (instancetype) initWithClient: (id<NSTextCheckingClient>)client
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_client = client;
|
||||
_spellCheckerDocumentTag = 0;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
// properties...
|
||||
- (id<NSTextCheckingClient>) client
|
||||
{
|
||||
return _client;
|
||||
}
|
||||
|
||||
- (NSInteger) spellCheckerDocumentTag
|
||||
{
|
||||
return _spellCheckerDocumentTag;
|
||||
}
|
||||
|
||||
- (void) setSpellCheckerDocumentTag: (NSInteger)tag
|
||||
{
|
||||
_spellCheckerDocumentTag = tag;
|
||||
}
|
||||
|
||||
// instance methods...
|
||||
- (void) changeSpelling: (id)sender
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
- (void) checkSpelling: (id)sender
|
||||
{
|
||||
/*
|
||||
int wordCount = 0;
|
||||
[[NSSpellChecker sharedSpellChecker] checkSpellingOfString: [_client string]
|
||||
startingAt: 0
|
||||
language: nil
|
||||
wrap: NO
|
||||
inSpellDocumentWithTag: _spellCheckerDocumentTag
|
||||
wordCount: &wordCount];*/
|
||||
}
|
||||
|
||||
- (void) checkTextInRange: (NSRange)range
|
||||
types: (NSTextCheckingTypes)checkingTypes
|
||||
options: (NSDictionary *)options
|
||||
{
|
||||
}
|
||||
|
||||
- (void) checkTextInSelection: (id)sender
|
||||
{
|
||||
}
|
||||
|
||||
- (void) checkTextInDocument: (id)sender
|
||||
{
|
||||
}
|
||||
|
||||
- (void) didChangeTextInRange: (NSRange)range
|
||||
{
|
||||
}
|
||||
|
||||
- (void) considerTextCheckingForRange: (NSRange)range
|
||||
{
|
||||
}
|
||||
|
||||
- (void) didChangeSelectedRange
|
||||
{
|
||||
}
|
||||
|
||||
- (void) ignoreSpelling: (id)sender
|
||||
{
|
||||
}
|
||||
|
||||
- (void) insertedTextInRange: (NSRange)range
|
||||
{
|
||||
}
|
||||
|
||||
- (void) invalidate
|
||||
{
|
||||
}
|
||||
|
||||
- (NSMenu *) menuAtIndex: (NSUInteger)location
|
||||
clickedOnSelection: (BOOL)clickedOnSelection
|
||||
effectiveRange: (NSRangePointer)effectiveRange
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void) orderFrontSubstitutionsPanel: (id)sender
|
||||
{
|
||||
}
|
||||
|
||||
- (void) showGuessPanel: (id)sender
|
||||
{
|
||||
}
|
||||
|
||||
- (void) updateCandidates
|
||||
{
|
||||
}
|
||||
|
||||
- (NSArray *) validAnnotations
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
273
Source/NSTextFinder.m
Normal file
273
Source/NSTextFinder.m
Normal file
|
@ -0,0 +1,273 @@
|
|||
/* Implementation of class NSTextFinder
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory John Casamento
|
||||
Date: 02-08-2020
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
||||
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 USA.
|
||||
*/
|
||||
|
||||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSArchiver.h>
|
||||
|
||||
#import "AppKit/NSTextFinder.h"
|
||||
#import "AppKit/NSTextView.h"
|
||||
#import "AppKit/NSUserInterfaceValidation.h"
|
||||
|
||||
#import "GSTextFinder.h"
|
||||
|
||||
@implementation NSTextFinder
|
||||
|
||||
- (instancetype) init
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
// initialize finder...
|
||||
_finder = [[GSTextFinder alloc] init];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
// Validating and performing
|
||||
- (void) performFindPanelAction: (id)sender
|
||||
{
|
||||
[self performAction: [sender tag]];
|
||||
}
|
||||
|
||||
- (void) performTextFinderAction: (id)sender
|
||||
{
|
||||
[self performFindPanelAction: sender];
|
||||
}
|
||||
|
||||
- (NSInteger) tag
|
||||
{
|
||||
return _tag;
|
||||
}
|
||||
|
||||
- (void) _mapOpToTag: (NSTextFinderAction)op
|
||||
{
|
||||
switch (op)
|
||||
{
|
||||
case NSTextFinderActionShowFindInterface:
|
||||
_tag = NSFindPanelActionShowFindPanel;
|
||||
break;
|
||||
case NSTextFinderActionNextMatch:
|
||||
_tag = NSFindPanelActionNext;
|
||||
break;
|
||||
case NSTextFinderActionPreviousMatch:
|
||||
_tag = NSFindPanelActionPrevious;
|
||||
break;
|
||||
case NSTextFinderActionReplaceAll:
|
||||
_tag = NSFindPanelActionReplaceAll;
|
||||
break;
|
||||
case NSTextFinderActionReplace:
|
||||
_tag = NSFindPanelActionReplace;
|
||||
break;
|
||||
case NSTextFinderActionReplaceAndFind:
|
||||
_tag = NSFindPanelActionReplaceAndFind;
|
||||
break;
|
||||
case NSTextFinderActionSetSearchString:
|
||||
_tag = NSFindPanelActionSetFindString;
|
||||
break;
|
||||
case NSTextFinderActionReplaceAllInSelection:
|
||||
_tag = NSFindPanelActionReplaceAllInSelection;
|
||||
break;
|
||||
case NSTextFinderActionSelectAll:
|
||||
_tag = NSFindPanelActionSelectAll;
|
||||
break;
|
||||
case NSTextFinderActionSelectAllInSelection:
|
||||
_tag = NSFindPanelActionSelectAllInSelection;
|
||||
break;
|
||||
case NSTextFinderActionHideFindInterface:
|
||||
// unsupported;
|
||||
break;
|
||||
case NSTextFinderActionShowReplaceInterface:
|
||||
// unsupported;
|
||||
break;
|
||||
case NSTextFinderActionHideReplaceInterface:
|
||||
// unsupported;
|
||||
break;
|
||||
default:
|
||||
NSLog(@"Unknown operation: %ld", op);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
- (void) performAction: (NSTextFinderAction)op
|
||||
{
|
||||
[self _mapOpToTag: op];
|
||||
[_finder performFindPanelAction: self];
|
||||
}
|
||||
|
||||
- (BOOL) validateUserInterfaceAction: (id<NSValidatedUserInterfaceItem>)item
|
||||
{
|
||||
SEL action = [item action];
|
||||
if (sel_isEqual(action, @selector(performTextFinderAction:)) ||
|
||||
sel_isEqual(action, @selector(performFindPanelAction:)))
|
||||
{
|
||||
return [self validateAction: [item tag]];
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL) validateAction: (NSTextFinderAction)op
|
||||
{
|
||||
[self _mapOpToTag: op];
|
||||
return [_finder validateFindPanelAction: self
|
||||
withTextView: nil];
|
||||
}
|
||||
|
||||
- (void)cancelFindIndicator;
|
||||
{
|
||||
}
|
||||
|
||||
// Properties
|
||||
- (id<NSTextFinderClient>) client
|
||||
{
|
||||
return _client;
|
||||
}
|
||||
|
||||
- (void) setClient: (id<NSTextFinderClient>) client
|
||||
{
|
||||
_client = client;
|
||||
}
|
||||
|
||||
- (id<NSTextFinderBarContainer>) findBarContainer
|
||||
{
|
||||
return _findBarContainer;
|
||||
}
|
||||
|
||||
- (void) setFindBarContainer: (id<NSTextFinderBarContainer>) findBarContainer
|
||||
{
|
||||
_findBarContainer = findBarContainer;
|
||||
}
|
||||
|
||||
- (BOOL) findIndicatorNeedsUpdate
|
||||
{
|
||||
return _findIndicatorNeedsUpdate;
|
||||
}
|
||||
|
||||
- (void) setFindIndicatorNeedsUpdate: (BOOL)flag
|
||||
{
|
||||
_findIndicatorNeedsUpdate = flag;
|
||||
}
|
||||
|
||||
- (BOOL) isIncrementalSearchingEnabled
|
||||
{
|
||||
return _incrementalSearchingEnabled;
|
||||
}
|
||||
|
||||
- (void) setIncrementalSearchingEnabled: (BOOL)flag
|
||||
{
|
||||
_incrementalSearchingEnabled = flag;
|
||||
}
|
||||
|
||||
- (BOOL) incrementalSearchingShouldDimContentView
|
||||
{
|
||||
return _incrementalSearchingShouldDimContentView;
|
||||
}
|
||||
|
||||
- (void) setIncrementalSearchingShouldDimContentView: (BOOL)flag
|
||||
{
|
||||
_incrementalSearchingShouldDimContentView = flag;
|
||||
}
|
||||
|
||||
- (NSArray *) incrementalMatchRanges
|
||||
{
|
||||
return _incrementalMatchRanges;
|
||||
}
|
||||
|
||||
+ (void) drawIncrementalMatchHighlightInRect: (NSRect)rect
|
||||
{
|
||||
}
|
||||
|
||||
- (void) noteClientStringWillChange
|
||||
{
|
||||
// nothing...
|
||||
}
|
||||
|
||||
// NSCoding...
|
||||
- (instancetype) initWithCoder: (NSCoder *)coder
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
if ([coder allowsKeyedCoding])
|
||||
{
|
||||
if ([coder containsValueForKey: @"NSFindIndicatorNeedsUpdate"])
|
||||
{
|
||||
_findIndicatorNeedsUpdate = [coder decodeBoolForKey: @"NSFindIndicatorNeedsUpdate"];
|
||||
}
|
||||
if ([coder containsValueForKey: @"NSIncrementalSearchingEnabled"])
|
||||
{
|
||||
_incrementalSearchingEnabled = [coder decodeBoolForKey: @"NSIncrementalSearchingEnabled"];
|
||||
}
|
||||
if ([coder containsValueForKey: @"NSIncrementalSearchingShouldDimContentView"])
|
||||
{
|
||||
_incrementalSearchingShouldDimContentView = [coder decodeBoolForKey: @"NSIncrementalSearchingShouldDimContentView"];
|
||||
}
|
||||
if ([coder containsValueForKey: @"NSIncrementalMatchRanges"])
|
||||
{
|
||||
ASSIGN(_incrementalMatchRanges, [coder decodeObjectForKey: @"NSIncrementalMatchRanges"]);
|
||||
}
|
||||
|
||||
// initialize finder...
|
||||
_finder = [GSTextFinder sharedTextFinder];
|
||||
}
|
||||
else
|
||||
{
|
||||
[coder decodeValueOfObjCType: @encode(BOOL)
|
||||
at: &_findIndicatorNeedsUpdate];
|
||||
[coder decodeValueOfObjCType: @encode(BOOL)
|
||||
at: &_incrementalSearchingEnabled];
|
||||
[coder decodeValueOfObjCType: @encode(BOOL)
|
||||
at: &_incrementalSearchingShouldDimContentView];
|
||||
ASSIGN(_incrementalMatchRanges, [coder decodeObject]);
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) encodeWithCoder: (NSCoder *)coder
|
||||
{
|
||||
if ([coder allowsKeyedCoding])
|
||||
{
|
||||
[coder encodeBool: _findIndicatorNeedsUpdate
|
||||
forKey: @"NSFindIndicatorNeedsUpdate"];
|
||||
[coder encodeBool: _incrementalSearchingEnabled
|
||||
forKey: @"NSIncrementalSearchingEnabled"];
|
||||
[coder encodeBool: _incrementalSearchingShouldDimContentView
|
||||
forKey: @"NSIncrementalSearchingShouldDimContentView"];
|
||||
[coder encodeObject: _incrementalMatchRanges
|
||||
forKey: @"NSIncrementalMatchRanges"];
|
||||
}
|
||||
else
|
||||
{
|
||||
[coder encodeValueOfObjCType: @encode(BOOL)
|
||||
at: &_findIndicatorNeedsUpdate];
|
||||
[coder encodeValueOfObjCType: @encode(BOOL)
|
||||
at: &_incrementalSearchingEnabled];
|
||||
[coder encodeValueOfObjCType: @encode(BOOL)
|
||||
at: &_incrementalSearchingShouldDimContentView];
|
||||
[coder encodeObject: _incrementalMatchRanges];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
110
Source/NSTextInputContext.m
Normal file
110
Source/NSTextInputContext.m
Normal file
|
@ -0,0 +1,110 @@
|
|||
/* Implementation of class NSTextInputContext
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory John Casamento
|
||||
Date: 02-08-2020
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
||||
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 USA.
|
||||
*/
|
||||
|
||||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSString.h>
|
||||
#import "AppKit/NSTextInputContext.h"
|
||||
|
||||
NSTextInputContext *__currentInputContext;
|
||||
|
||||
@implementation NSTextInputContext
|
||||
|
||||
+ (NSTextInputContext *) currentInputContext
|
||||
{
|
||||
return __currentInputContext;
|
||||
}
|
||||
|
||||
- (instancetype) initWithClient: (id<NSTextInputClient>)client
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_client = client;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id<NSTextInputClient>) client
|
||||
{
|
||||
return _client;
|
||||
}
|
||||
|
||||
- (BOOL) acceptsGlyphInfo
|
||||
{
|
||||
return _acceptsGlyphInfo;
|
||||
}
|
||||
|
||||
- (void) setAcceptsGlyphInfo: (BOOL)flag
|
||||
{
|
||||
_acceptsGlyphInfo = flag;
|
||||
}
|
||||
|
||||
- (NSArray *) allowedInputSourceLocales
|
||||
{
|
||||
return _allowedInputSourceLocales;
|
||||
}
|
||||
|
||||
- (void) setAllowedInputSourceLocales: (NSArray *)locales
|
||||
{
|
||||
ASSIGNCOPY(_allowedInputSourceLocales, locales);
|
||||
}
|
||||
|
||||
- (void) activate
|
||||
{
|
||||
}
|
||||
|
||||
- (void) deactivate
|
||||
{
|
||||
}
|
||||
|
||||
- (BOOL) handleEvent: (NSEvent *)event
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void) discardMarkedText
|
||||
{
|
||||
}
|
||||
|
||||
- (void) invalidateCharacterCoordinates
|
||||
{
|
||||
}
|
||||
|
||||
- (NSArray *) keyboardInputSources
|
||||
{
|
||||
return _keyboardInputSources;
|
||||
}
|
||||
|
||||
- (NSTextInputSourceIdentifier) selectedKeyboardInputSource
|
||||
{
|
||||
return _selectedKeyboardInputSource;
|
||||
}
|
||||
|
||||
+ (NSString *) localizedNameForInputSource:(NSTextInputSourceIdentifier)inputSourceIdentifier
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
/** <title>NSTextView</title>
|
||||
|
||||
Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2008 Free Software Foundation, Inc.
|
||||
Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2008, 2020 Free Software Foundation, Inc.
|
||||
|
||||
Much code of this class was originally derived from code which was
|
||||
in NSText.m.
|
||||
|
@ -26,6 +26,9 @@
|
|||
Extensive reworking: Alexander Malmberg <alexander@malmberg.org>
|
||||
Date: December 2002 - February 2003
|
||||
|
||||
Implementing Catalina Extensions: Gregory Casamento <greg.casamento@gmail.com>
|
||||
Date: August 2020
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
|
@ -61,6 +64,7 @@
|
|||
#import <Foundation/NSTimer.h>
|
||||
#import <Foundation/NSUndoManager.h>
|
||||
#import <Foundation/NSValue.h>
|
||||
|
||||
#import "AppKit/NSApplication.h"
|
||||
#import "AppKit/NSAttributedString.h"
|
||||
#import "AppKit/NSClipView.h"
|
||||
|
@ -89,6 +93,7 @@
|
|||
#import "AppKit/NSTextStorage.h"
|
||||
#import "AppKit/NSTextView.h"
|
||||
#import "AppKit/NSWindow.h"
|
||||
|
||||
#import "GSGuiPrivate.h"
|
||||
#import "GSTextFinder.h"
|
||||
#import "GSToolTips.h"
|
||||
|
@ -4016,12 +4021,8 @@ Figure out how the additional layout stuff is supposed to work.
|
|||
* were! */
|
||||
[self drawViewBackgroundInRect: [self bounds]];
|
||||
|
||||
/* Then draw the special background of the new glyphs. */
|
||||
[_layoutManager drawBackgroundForGlyphRange: drawnRange
|
||||
atPoint: _textContainerOrigin];
|
||||
|
||||
[_layoutManager drawGlyphsForGlyphRange: drawnRange
|
||||
atPoint: _textContainerOrigin];
|
||||
[self drawCharactersInRange: drawnRange
|
||||
forContentView: self];
|
||||
|
||||
if ([self shouldDrawInsertionPoint] &&
|
||||
[NSGraphicsContext currentContextDrawingToScreen])
|
||||
|
@ -6078,6 +6079,113 @@ configuation! */
|
|||
withTextView: self];
|
||||
}
|
||||
|
||||
// NSTextFinder methods implementation...
|
||||
// isSelectable, isEditable, string, selectedRanges, setSelectedRanges, replaceCharactersInRange:withString:
|
||||
// implemented by NSTextView already...
|
||||
|
||||
- (BOOL) allowsMultipleSelection
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (NSString *) stringAtIndex: (NSUInteger)characterIndex
|
||||
effectiveRange: (NSRangePointer)outRange
|
||||
endsWithSearchBoundary: (BOOL *)outFlag
|
||||
{
|
||||
return [self string];
|
||||
}
|
||||
|
||||
- (NSUInteger) stringLength
|
||||
{
|
||||
return [[self string] length];
|
||||
}
|
||||
|
||||
- (NSRange) firstSelectedRange
|
||||
{
|
||||
NSValue *r = [[self selectedRanges] objectAtIndex: 0];
|
||||
return [r rangeValue];
|
||||
}
|
||||
|
||||
- (BOOL) shouldReplaceCharactersInRanges: (NSArray *)ranges withStrings: (NSArray *)strings
|
||||
{
|
||||
NSUInteger idx = 0;
|
||||
FOR_IN(NSValue*, rv, ranges)
|
||||
{
|
||||
NSRange r = [rv rangeValue];
|
||||
NSString *str = [strings objectAtIndex: idx];
|
||||
if (![self shouldChangeTextInRange: r replacementString: str])
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
END_FOR_IN(ranges);
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void) didReplaceCharacters
|
||||
{
|
||||
[self didChangeText];
|
||||
}
|
||||
|
||||
- (NSView *) contentViewAtIndex: (NSUInteger)index effectiveCharacterRange: (NSRangePointer)outRange
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSArray *) rectsForCharacterRange: (NSRange)range
|
||||
{
|
||||
NSUInteger rectCount = 0;
|
||||
NSRect *rects;
|
||||
NSMutableArray *result = [NSMutableArray array];
|
||||
NSUInteger idx = 0;
|
||||
|
||||
rects = [_layoutManager rectArrayForCharacterRange: range
|
||||
withinSelectedCharacterRange: NSMakeRange(NSNotFound, 0)
|
||||
inTextContainer: _textContainer
|
||||
rectCount: &rectCount];
|
||||
|
||||
for (idx = 0; idx < rectCount; idx++)
|
||||
{
|
||||
NSRect r = rects[idx];
|
||||
NSValue *v = [NSValue valueWithRect: r];
|
||||
[result addObject: v];
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
- (NSArray *) visibleCharacterRanges
|
||||
{
|
||||
NSArray *result = nil;
|
||||
|
||||
if (_layoutManager)
|
||||
{
|
||||
const NSRect visibleRect = [self visibleRect];
|
||||
|
||||
NSRange visibleGlyphRange = [_layoutManager glyphRangeForBoundingRect: visibleRect
|
||||
inTextContainer: _textContainer];
|
||||
|
||||
NSRange visibleRange = [_layoutManager characterRangeForGlyphRange: visibleGlyphRange
|
||||
actualGlyphRange: NULL];
|
||||
|
||||
NSValue *value = [NSValue valueWithRange: visibleRange];
|
||||
result = [NSArray arrayWithObject: value];
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
- (void) drawCharactersInRange: (NSRange)range forContentView: (NSView *)view
|
||||
{
|
||||
/* Then draw the special background of the new glyphs. */
|
||||
[_layoutManager drawBackgroundForGlyphRange: range
|
||||
atPoint: _textContainerOrigin];
|
||||
|
||||
[_layoutManager drawGlyphsForGlyphRange: range
|
||||
atPoint: _textContainerOrigin];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#import "AppKit/NSEvent.h"
|
||||
#import "AppKit/NSAppearance.h"
|
||||
#import "AppKit/NSFontCollection.h"
|
||||
#import "AppKit/NSTextFinder.h"
|
||||
|
||||
// Global strings
|
||||
NSString *NSModalPanelRunLoopMode = @"NSModalPanelRunLoopMode";
|
||||
|
@ -834,6 +835,13 @@ NSFontCollectionMatchingOptionKey const NSFontCollectionDisallowAutoActivationOp
|
|||
// Speech recognition...
|
||||
const NSString *GSSpeechRecognizerDidRecognizeWordNotification = @"GSSpeechRecognizerDidRecognizeWordNotification";
|
||||
|
||||
// NSTextInputContext notifications
|
||||
NSString *NSTextInputContextKeyboardSelectionDidChangeNotification =
|
||||
@"NSTextInputContextKeyboardSelectionDidChangeNotification";
|
||||
|
||||
NSPasteboardTypeTextFinderOptionKey const NSTextFinderCaseInsensitiveKey = @"NSTextFinderCaseInsensitiveKey";
|
||||
NSPasteboardTypeTextFinderOptionKey const NSTextFinderMatchingTypeKey = @"NSTextFinderMatchingTypeKey";
|
||||
|
||||
extern void __objc_gui_force_linking (void);
|
||||
|
||||
void
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue