mirror of
https://github.com/darlinghq/darling-cocotron.git
synced 2025-02-17 01:58:20 +00:00
Add missing methods and stubs for TextEdit
This commit is contained in:
parent
e348862349
commit
bb0c134428
@ -129,6 +129,8 @@ NSString *const NSCharacterShapeAttributeName = @"NSCharacterShape";
|
||||
NSString *const NSUsesScreenFontsDocumentAttribute = @"UsesScreenFonts";
|
||||
|
||||
NSString *const NSTextEffectAttributeName = @"NSTextEffect";
|
||||
NSAttributedStringKey NSWritingDirectionAttributeName = @"NSWritingDirectionAttribute";
|
||||
NSString *const NSCocoaVersionDocumentAttribute = @"NSCocoaVersionDocumentAttribute";
|
||||
|
||||
NSUInteger NSUnderlineStrikethroughMask = 0x4000;
|
||||
NSUInteger NSUnderlineByWordMask = 0x8000;
|
||||
@ -157,6 +159,53 @@ NSUInteger NSUnderlineByWordMask = 0x8000;
|
||||
error: (NSError **) error
|
||||
{
|
||||
NSUnimplementedMethod();
|
||||
NSString *docType = [options objectForKey:NSDocumentTypeDocumentAttribute];
|
||||
|
||||
if(docType == nil){
|
||||
NSLog(@"NSAttributedString initFromData - inferring document type");
|
||||
//TODO: infer document type (assume RTF for now)
|
||||
docType = NSRTFTextDocumentType;
|
||||
}
|
||||
|
||||
//Read the document based on its type
|
||||
if([docType isEqual: NSDocFormatTextDocumentType]){
|
||||
return nil;
|
||||
}
|
||||
else if([docType isEqual: NSHTMLTextDocumentType]){
|
||||
NSLog(@"NSAttributedString initFromData - dont know how to parse %@", docType);
|
||||
return nil;
|
||||
}
|
||||
else if([docType isEqual: NSMacSimpleTextDocumentType]){
|
||||
NSLog(@"NSAttributedString initFromData - dont know how to parse %@", docType);
|
||||
return nil;
|
||||
}
|
||||
else if([docType isEqual: NSOfficeOpenXMLTextDocumentType]){
|
||||
NSLog(@"NSAttributedString initFromData - dont know how to parse %@", docType);
|
||||
return nil;
|
||||
}
|
||||
else if([docType isEqual: NSOpenDocumentTextDocumentType]){
|
||||
NSLog(@"NSAttributedString initFromData - dont know how to parse %@", docType);
|
||||
return nil;
|
||||
}
|
||||
else if([docType isEqual: NSPlainTextDocumentType]){
|
||||
NSLog(@"NSAttributedString initFromData - dont know how to parse %@", docType);
|
||||
return nil;
|
||||
}
|
||||
else if([docType isEqual: NSRTFTextDocumentType]){
|
||||
return [self initWithRTF:data documentAttributes:attributes];
|
||||
}
|
||||
else if([docType isEqual: NSRTFDTextDocumentType]){
|
||||
return [self initWithRTFD:data documentAttributes:attributes];
|
||||
}
|
||||
else if([docType isEqual: NSWebArchiveTextDocumentType]){
|
||||
NSLog(@"NSAttributedString initFromData - dont know how to parse %@", docType);
|
||||
return nil;
|
||||
}
|
||||
else if([docType isEqual: NSWordMLTextDocumentType]){
|
||||
NSLog(@"NSAttributedString initFromData - dont know how to parse %@", docType);
|
||||
return nil;
|
||||
}
|
||||
else {
|
||||
return nil;
|
||||
}
|
||||
|
||||
@ -237,7 +286,9 @@ NSUInteger NSUnderlineByWordMask = 0x8000;
|
||||
error: (NSError **) error
|
||||
{
|
||||
NSUnimplementedMethod();
|
||||
return nil;
|
||||
NSLog(@"NSAttributedString - initializing from URL");
|
||||
NSData *data = [NSData dataWithContentsOfURL: url];
|
||||
return [self initWithData:data options:options documentAttributes:attributes error:error];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
@ -426,6 +426,10 @@ static int untitled_document_number = 0;
|
||||
case NSChangeAutosaved:
|
||||
NSUnimplementedMethod();
|
||||
break;
|
||||
|
||||
case NSChangeRedone:
|
||||
_changeCount++; //Opposite of Undo - this may be wrong
|
||||
break;
|
||||
}
|
||||
|
||||
BOOL edited = [self isDocumentEdited];
|
||||
@ -467,6 +471,7 @@ static int untitled_document_number = 0;
|
||||
if ([self _isSelectorOverridden: @selector(readFromFile:ofType:)]) {
|
||||
return [self readFromFile: [url path] ofType: type];
|
||||
} else {
|
||||
|
||||
NSFileWrapper *fileWrapper = [[[NSFileWrapper alloc]
|
||||
initWithPath: [url path]] autorelease];
|
||||
|
||||
@ -695,8 +700,8 @@ static int untitled_document_number = 0;
|
||||
|
||||
#if 0
|
||||
// setAllowedFileTypes: is unimplemented - so don't call it.
|
||||
NSArray* writableTypes = [self writableTypesForSaveOperation: operation];
|
||||
[savePanel setAllowedFileTypes: writableTypes];
|
||||
NSArray* writableTypes = [self writableTypesForSaveOperation: operation];
|
||||
[savePanel setAllowedFileTypes: writableTypes];
|
||||
#endif
|
||||
|
||||
if ([self prepareSavePanel: savePanel] == NO) {
|
||||
@ -1197,9 +1202,8 @@ static int untitled_document_number = 0;
|
||||
return self;
|
||||
}
|
||||
|
||||
- initWithContentsOfURL: (NSURL *) url ofType: (NSString *) type {
|
||||
- (id) initWithContentsOfURL: (NSURL *) url ofType: (NSString *) type {
|
||||
NSError *error;
|
||||
|
||||
[self init];
|
||||
|
||||
error = nil;
|
||||
@ -1223,6 +1227,7 @@ static int untitled_document_number = 0;
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
- (BOOL) loadDataRepresentation: (NSData *) data ofType: (NSString *) type {
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"-[%@ %s]", [self class], sel_getName(_cmd)];
|
||||
@ -1507,4 +1512,18 @@ static int untitled_document_number = 0;
|
||||
block();
|
||||
}
|
||||
|
||||
- (void) saveToURL: (NSURL *) url
|
||||
ofType: (NSString *) typeName
|
||||
forSaveOperation: (NSSaveOperationType) saveOperation
|
||||
completionHandler: (void (^)(NSError *errorOrNil)) completionHandler
|
||||
{
|
||||
NSUnimplementedMethod();
|
||||
}
|
||||
|
||||
- (void) autosaveWithImplicitCancellability: (BOOL) autosavingIsImplicitlyCancellable
|
||||
completionHandler: (void (^)(NSError *errorOrNil)) completionHandler
|
||||
{
|
||||
NSUnimplementedMethod();
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -30,14 +30,47 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
@interface _NSUnsupportedDocument : NSObject
|
||||
|
||||
- initWithType: (NSString *) type error: (NSError **) error;
|
||||
- (instancetype) initWithType: (NSString *) type error: (NSError **) error;
|
||||
- (instancetype) initWithContentsOfURL:(NSURL *)url
|
||||
ofType:(NSString *)typeName
|
||||
error:(NSError * _Nullable *)outError;
|
||||
- (id) initWithContentsOfURL:(NSURL *)url
|
||||
ofType:(NSString *)typeName;
|
||||
- (id) initWithContentsOfFile:(NSString *)absolutePath
|
||||
ofType:(NSString *)typeName;
|
||||
|
||||
@end
|
||||
|
||||
@implementation _NSUnsupportedDocument
|
||||
|
||||
- initWithType: (NSString *) type error: (NSError **) error {
|
||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code: NSFeatureUnsupportedError userInfo: nil];
|
||||
- (instancetype) initWithType: (NSString *) type error: (NSError **) error {
|
||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain
|
||||
code: NSFeatureUnsupportedError
|
||||
userInfo: nil];
|
||||
[self release];
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (instancetype) initWithContentsOfURL:(NSURL *)url
|
||||
ofType:(NSString *)typeName
|
||||
error:(NSError * _Nullable *)outError{
|
||||
|
||||
*outError = [NSError errorWithDomain:NSCocoaErrorDomain
|
||||
code: NSFeatureUnsupportedError
|
||||
userInfo: nil];
|
||||
[self release];
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (id) initWithContentsOfURL:(NSURL *)url
|
||||
ofType:(NSString *)typeName{
|
||||
[self release];
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (id) initWithContentsOfFile:(NSString *)absolutePath
|
||||
ofType:(NSString *)typeName{
|
||||
[self release];
|
||||
return nil;
|
||||
}
|
||||
|
||||
@ -141,9 +174,13 @@ static NSDocumentController *shared = nil;
|
||||
}
|
||||
|
||||
- (Class) documentClassForType: (NSString *) type {
|
||||
NSDictionary *info = [self _infoForType: type];
|
||||
NSString *result = [info objectForKey: @"NSDocumentClass"];
|
||||
NSString *result = nil;
|
||||
for(NSDictionary *fileType in _fileTypes){
|
||||
if ([[fileType objectForKey: @"LSItemContentTypes"] containsObject: type])
|
||||
result = [fileType objectForKey: @"NSDocumentClass"];
|
||||
}
|
||||
|
||||
NSLog(@"NSDocController - docClassForType found class %@ for type %@", result, type);
|
||||
return (result == nil) ? [_NSUnsupportedDocument class] : NSClassFromString(result);
|
||||
}
|
||||
|
||||
@ -168,13 +205,13 @@ static NSDocumentController *shared = nil;
|
||||
|
||||
- (NSString *) typeFromFileExtension: (NSString *) extension {
|
||||
extension = [extension lowercaseString];
|
||||
|
||||
for (NSDictionary *fileType in _fileTypes)
|
||||
for (NSString *name in
|
||||
[fileType objectForKey: @"CFBundleTypeExtensions"])
|
||||
[fileType objectForKey: @"CFBundleTypeExtensions"]){
|
||||
if ([[name lowercaseString] isEqual: extension] ||
|
||||
[name isEqual: @"*"])
|
||||
return [fileType objectForKey: @"CFBundleTypeName"];
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
@ -259,7 +296,23 @@ static NSDocumentController *shared = nil;
|
||||
if (extension == nil)
|
||||
return nil;
|
||||
|
||||
return [self typeFromFileExtension: extension];
|
||||
NSString *UTI;
|
||||
|
||||
BOOL success = [url getResourceValue:&UTI forKey:NSURLTypeIdentifierKey error:error];
|
||||
if(success){
|
||||
NSLog(@"NSDocumentController - found type: %@", UTI);
|
||||
return UTI;
|
||||
//TODO: move below code to documentClassForType
|
||||
for(NSDictionary *type in _fileTypes){
|
||||
for(NSString *contentType in [type objectForKey:@"LSItemContentTypes"]){
|
||||
return [type objectForKey:@"CFBundleTypeName"];
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
//TODO:Handle Error Here
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
- makeDocumentWithContentsOfFile: (NSString *) path ofType: (NSString *) type {
|
||||
@ -277,11 +330,13 @@ static NSDocumentController *shared = nil;
|
||||
error: (NSError **) error
|
||||
{
|
||||
id result;
|
||||
NSLog(@"DocController - making %@ from URL", type);
|
||||
Class class = [self documentClassForType: type];
|
||||
|
||||
NSLog(@"DocController - initializing Document");
|
||||
result = [[[class alloc] initWithContentsOfURL: url
|
||||
ofType: type] autorelease];
|
||||
|
||||
ofType: type ] autorelease];
|
||||
NSLog(@"NSDocController - made from URL");
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -430,13 +485,18 @@ static NSDocumentController *shared = nil;
|
||||
NSDocument *result = [self documentForURL: url];
|
||||
|
||||
if (result == nil) {
|
||||
NSString *extension = [[url path] pathExtension];
|
||||
NSString *type = [self typeFromFileExtension: extension];
|
||||
NSError *type_error;
|
||||
NSString *type = [self typeForContentsOfURL:url error:&type_error];
|
||||
|
||||
if(type_error != nil){
|
||||
*error = type_error;
|
||||
return result;
|
||||
}
|
||||
|
||||
result = [self makeDocumentWithContentsOfURL: url
|
||||
ofType: type
|
||||
error: error];
|
||||
|
||||
NSLog(@"NSDocCtrl openDocWithContsURL - made Document");
|
||||
if (result != nil) {
|
||||
[self addDocument: result];
|
||||
[result makeWindowControllers];
|
||||
|
@ -203,4 +203,15 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
[self endEditing];
|
||||
}
|
||||
|
||||
- (BOOL) readFromURL:(NSURL *)url
|
||||
options:(NSDictionary<NSAttributedStringDocumentReadingOptionKey, id> *)opts
|
||||
documentAttributes:(NSDictionary<NSAttributedStringDocumentAttributeKey, id> * _Nullable *)dict
|
||||
error:(NSError * _Nullable *)error {
|
||||
NSAttributedString *str = [NSAttributedString alloc];
|
||||
[str initWithURL:url options:opts documentAttributes:dict error:error];
|
||||
//[self setAttributedString:str];
|
||||
NSLog(@"NSMutableAttributedString readFromURL: - hopefully finished reading!");
|
||||
return true;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -133,6 +133,14 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
_tabStops = tabStops;
|
||||
}
|
||||
|
||||
- (void) addTabStop:(NSTextTab *) tabStop {
|
||||
//NSUnimplementedMethod();
|
||||
}
|
||||
|
||||
- (void) removeTabStop:(NSTextTab *) tabStop {
|
||||
//NSUnimplementedMethod();
|
||||
}
|
||||
|
||||
- (void) setHyphenationFactor: (float) factor {
|
||||
_hyphenationFactor = factor;
|
||||
}
|
||||
|
@ -34,6 +34,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
return shared;
|
||||
}
|
||||
|
||||
+ (NSWritingDirection)defaultWritingDirectionForLanguage:(NSString *)languageName {
|
||||
NSUnimplementedMethod();
|
||||
return NSWritingDirectionNatural;
|
||||
}
|
||||
|
||||
+ (NSArray *) _defaultTabStops {
|
||||
static NSArray *shared = nil;
|
||||
|
||||
|
@ -86,6 +86,16 @@ static Class _rulerViewClass = nil;
|
||||
return contentSize;
|
||||
}
|
||||
|
||||
+ (NSSize)frameSizeForContentSize:(NSSize)cSize
|
||||
horizontalScrollerClass:(Class)horizontalScrollerClass
|
||||
verticalScrollerClass:(Class)verticalScrollerClass
|
||||
borderType:(NSBorderType)type
|
||||
controlSize:(NSControlSize)controlSize
|
||||
scrollerStyle:(NSScrollerStyle)scrollerStyle
|
||||
{
|
||||
NSUnimplementedMethod();
|
||||
}
|
||||
|
||||
+ (NSSize) contentSizeForFrameSize: (NSSize) frameSize
|
||||
hasHorizontalScroller: (BOOL) hasHorizontalScroller
|
||||
hasVerticalScroller: (BOOL) hasVerticalScroller
|
||||
@ -120,6 +130,16 @@ static Class _rulerViewClass = nil;
|
||||
return frameSize;
|
||||
}
|
||||
|
||||
+ (NSSize)contentSizeForFrameSize:(NSSize)fSize
|
||||
horizontalScrollerClass:(Class)horizontalScrollerClass
|
||||
verticalScrollerClass:(Class)verticalScrollerClass
|
||||
borderType:(NSBorderType)type
|
||||
controlSize:(NSControlSize)controlSize
|
||||
scrollerStyle:(NSScrollerStyle)scrollerStyle
|
||||
{
|
||||
NSUnimplementedMethod();
|
||||
}
|
||||
|
||||
+ (void) setRulerViewClass: (Class) class {
|
||||
_rulerViewClass = class;
|
||||
}
|
||||
@ -614,6 +634,22 @@ static Class _rulerViewClass = nil;
|
||||
return _documentCursor;
|
||||
}
|
||||
|
||||
- (CGFloat) magnification {
|
||||
return _magnification;
|
||||
}
|
||||
|
||||
- (CGFloat) minMagnification {
|
||||
return _minMagnification;
|
||||
}
|
||||
|
||||
- (CGFloat) maxMagnification {
|
||||
return _maxMagnification;
|
||||
}
|
||||
|
||||
- (BOOL) allowsMagnification {
|
||||
return _allowsMagnification;
|
||||
}
|
||||
|
||||
- (void) setDocumentView: (NSView *) view {
|
||||
[_clipView setDocumentView: view];
|
||||
[self reflectScrolledClipView: _clipView];
|
||||
@ -779,6 +815,26 @@ static Class _rulerViewClass = nil;
|
||||
// FIXME: tile or hide/show scrollers?
|
||||
}
|
||||
|
||||
- (void) setMagnification: (CGFloat) value {
|
||||
_magnification = value;
|
||||
NSUnimplementedMethod();
|
||||
}
|
||||
|
||||
- (void) setMinMagnification: (CGFloat) value {
|
||||
_minMagnification = value;
|
||||
NSUnimplementedMethod();
|
||||
}
|
||||
|
||||
- (void) setMaxMagnification: (CGFloat) value {
|
||||
_maxMagnification = value;
|
||||
NSUnimplementedMethod();
|
||||
}
|
||||
|
||||
- (void) setAllowsMagnification: (BOOL) value {
|
||||
_allowsMagnification = value;
|
||||
NSUnimplementedMethod();
|
||||
}
|
||||
|
||||
- (void) tile {
|
||||
NSRect frame;
|
||||
|
||||
|
@ -34,6 +34,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
return [[NSDisplay currentDisplay] scrollerWidth];
|
||||
}
|
||||
|
||||
+ (NSScrollerStyle) preferredScrollerStyle {
|
||||
NSUnimplementedMethod();
|
||||
}
|
||||
/* OS X has a global default "AppleScrollBarVariant" with the values: Single,
|
||||
DoubleMin, DoubleMax, and DoubleBoth This controls the default position of the
|
||||
scroller. This should be controlling the positioning.
|
||||
@ -141,6 +144,11 @@ static NSAppleScrollBarVariant appleScrollBarVariant(NSScroller *self) {
|
||||
return _controlSize;
|
||||
}
|
||||
|
||||
- (NSScrollerStyle) scrollerStyle {
|
||||
return _scrollerStyle;
|
||||
}
|
||||
|
||||
|
||||
- (void) setFloatValue: (float) zeroToOneValue
|
||||
knobProportion: (CGFloat) zeroToOneKnob
|
||||
{
|
||||
@ -185,6 +193,10 @@ static NSAppleScrollBarVariant appleScrollBarVariant(NSScroller *self) {
|
||||
[self setNeedsDisplay: YES];
|
||||
}
|
||||
|
||||
- (void) setScrollerStyle: (NSScrollerStyle) style {
|
||||
_scrollerStyle = style;
|
||||
}
|
||||
|
||||
- (NSRect) frameOfDecrementPage {
|
||||
NSRect knobSlot = [self rectForPart: NSScrollerKnobSlot];
|
||||
NSRect knob = [self rectForPart: NSScrollerKnob];
|
||||
|
@ -177,6 +177,8 @@ static inline NSGlyphFragment *fragmentAtGlyphIndex(NSLayoutManager *self,
|
||||
}
|
||||
|
||||
- (NSTextView *) firstTextView {
|
||||
if([_textContainers count] < 1)
|
||||
return nil;
|
||||
return [[_textContainers objectAtIndex: 0] textView];
|
||||
}
|
||||
|
||||
@ -726,6 +728,11 @@ static inline NSGlyphFragment *fragmentAtGlyphIndex(NSLayoutManager *self,
|
||||
return _extraLineFragmentTextContainer;
|
||||
}
|
||||
|
||||
- (BOOL) allowsNonContiguousLayout {
|
||||
NSUnimplementedMethod();
|
||||
return _allowsNonContiguousLayout;
|
||||
}
|
||||
|
||||
- (void) setTextContainer: (NSTextContainer *) container
|
||||
forGlyphRange: (NSRange) glyphRange
|
||||
{
|
||||
@ -2909,4 +2916,9 @@ static inline void _appendRectToCache(NSLayoutManager *self, NSRect rect) {
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void) setAllowsNonContiguousLayout: (BOOL) value {
|
||||
_allowsNonContiguousLayout = value;
|
||||
NSUnimplementedMethod();
|
||||
}
|
||||
@end
|
||||
|
@ -3630,6 +3630,22 @@ NSString *const NSAllRomanInputSourcesLocaleIdentifier =
|
||||
NSUnimplementedMethod();
|
||||
}
|
||||
|
||||
- (BOOL) smartInsertDeleteEnabled {
|
||||
return _smartInsertDeleteEnabled;
|
||||
}
|
||||
|
||||
- (void) setSmartInsertDeleteEnabled: (BOOL) boolForKey {
|
||||
_smartInsertDeleteEnabled = boolForKey;
|
||||
}
|
||||
|
||||
- (BOOL) allowsDocumentBackgroundColorChange {
|
||||
return _allowsDocumentBackgroundColorChange;
|
||||
}
|
||||
|
||||
- (void) setAllowsDocumentBackgroundColorChange: (BOOL) value {
|
||||
_allowsDocumentBackgroundColorChange = value;
|
||||
}
|
||||
|
||||
- (void) setSpellingState: (NSInteger) value range: (NSRange) characterRange {
|
||||
[[self layoutManager]
|
||||
addTemporaryAttribute: NSSpellingStateAttributeName
|
||||
@ -3956,6 +3972,35 @@ NSString *const NSAllRomanInputSourcesLocaleIdentifier =
|
||||
- (id) replacementObjectForKeyedArchiver {
|
||||
NSUnimplementedMethod();
|
||||
return self;
|
||||
|
||||
- (NSTextLayoutOrientation) layoutOrientation {
|
||||
NSUnimplementedMethod();
|
||||
return _layoutOrientation;
|
||||
}
|
||||
|
||||
- (void)setLayoutOrientation:(NSTextLayoutOrientation)orientation {
|
||||
_layoutOrientation = orientation;
|
||||
NSUnimplementedMethod();
|
||||
}
|
||||
|
||||
- (BOOL) usesFindBar {
|
||||
NSUnimplementedMethod();
|
||||
return _usesFindBar;
|
||||
}
|
||||
|
||||
- (void) setUsesFindBar: (BOOL) value {
|
||||
NSUnimplementedMethod();
|
||||
_usesFindBar = value;
|
||||
}
|
||||
|
||||
- (BOOL) isIncrementalSearchingEnabled {
|
||||
NSUnimplementedMethod();
|
||||
return _incrementalSearchingEnabled;
|
||||
}
|
||||
|
||||
- (void) setIncrementalSearchingEnabled: (BOOL) value {
|
||||
NSUnimplementedMethod();
|
||||
_incrementalSearchingEnabled = value;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -887,6 +887,10 @@ static inline void buildTransformsIfNeeded(NSView *self) {
|
||||
return toolTip;
|
||||
}
|
||||
|
||||
- (BOOL) translatesAutoresizingMaskIntoConstraints {
|
||||
return _translatesAutoresizingMaskIntoConstraints;
|
||||
}
|
||||
|
||||
- viewWithTag: (NSInteger) tag {
|
||||
int i, count = [_subviews count];
|
||||
|
||||
@ -1126,6 +1130,11 @@ static inline void buildTransformsIfNeeded(NSView *self) {
|
||||
NSUnimplementedMethod();
|
||||
}
|
||||
|
||||
- (void) settranslatesAutoresizingMaskIntoConstraints: (BOOL) value {
|
||||
_translatesAutoresizingMaskIntoConstraints = value;
|
||||
NSUnimplementedMethod();
|
||||
}
|
||||
|
||||
- (void) setPostsFrameChangedNotifications: (BOOL) flag {
|
||||
_postsNotificationOnFrameChange = flag;
|
||||
}
|
||||
|
@ -24,6 +24,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
@class NSFont, NSColor, NSParagraphStyle, NSTextAttachment, NSFileWrapper,
|
||||
NSTextList, NSTextBlock, NSTextTable;
|
||||
|
||||
typedef NSString *NSAttributedStringDocumentReadingOptionKey;
|
||||
typedef NSString *NSAttributedStringDocumentAttributeKey;
|
||||
typedef NSString *NSAttributedStringKey;
|
||||
|
||||
APPKIT_EXPORT NSString *const NSFontAttributeName;
|
||||
APPKIT_EXPORT NSString *const NSParagraphStyleAttributeName;
|
||||
APPKIT_EXPORT NSString *const NSForegroundColorAttributeName;
|
||||
@ -112,10 +116,13 @@ APPKIT_EXPORT NSString *const NSCharacterShapeAttributeName;
|
||||
APPKIT_EXPORT NSString *const NSUsesScreenFontsDocumentAttribute;
|
||||
|
||||
APPKIT_EXPORT NSString *const NSTextEffectAttributeName;
|
||||
APPKIT_EXPORT NSAttributedStringKey NSWritingDirectionAttributeName;
|
||||
APPKIT_EXPORT NSString *const NSCocoaVersionDocumentAttribute;
|
||||
|
||||
APPKIT_EXPORT NSUInteger NSUnderlineStrikethroughMask;
|
||||
APPKIT_EXPORT NSUInteger NSUnderlineByWordMask;
|
||||
|
||||
|
||||
enum {
|
||||
NSSpellingStateSpellingFlag = 0x01,
|
||||
NSSpellingStateGrammarFlag = 0x02,
|
||||
@ -239,6 +246,13 @@ enum {
|
||||
- (NSRect) boundingRectWithSize: (NSSize) size
|
||||
options: (NSStringDrawingOptions) options;
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Getting Attribute Data
|
||||
- (void)enumerateAttribute:(NSAttributedStringKey)attrName
|
||||
inRange:(NSRange)enumerationRange
|
||||
options:(NSAttributedStringEnumerationOptions)opts
|
||||
usingBlock:(void (^)(id value, NSRange range, BOOL *stop))block;
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Testing String Data Sources
|
||||
|
||||
|
@ -23,18 +23,23 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
@class NSWindow, NSWindowController, NSSavePanel, NSMenuItem, NSFileWrapper,
|
||||
NSPrintOperation, NSPrintInfo, NSPageLayout, NSView;
|
||||
|
||||
typedef enum {
|
||||
typedef enum NSDocumentChangeType : NSUInteger {
|
||||
NSChangeDone,
|
||||
NSChangeUndone,
|
||||
NSChangeCleared,
|
||||
NSChangeReadOtherContents,
|
||||
NSChangeAutosaved,
|
||||
NSChangeRedone,
|
||||
NSChangeDiscardable = 256,
|
||||
} NSDocumentChangeType;
|
||||
|
||||
typedef enum {
|
||||
NSSaveOperation,
|
||||
NSSaveAsOperation,
|
||||
NSSaveToOperation,
|
||||
NSAutosaveElsewhereOperation,
|
||||
NSAutosaveInPlaceOperation,
|
||||
NSAutosaveAsOperation,
|
||||
NSAutosaveOperation,
|
||||
} NSSaveOperationType;
|
||||
|
||||
@ -230,7 +235,7 @@ typedef enum {
|
||||
(NSSaveOperationType) operation;
|
||||
- (NSFileWrapper *) fileWrapperRepresentationOfType: (NSString *) type;
|
||||
- initWithContentsOfFile: (NSString *) path ofType: (NSString *) type;
|
||||
- initWithContentsOfURL: (NSURL *) url ofType: (NSString *) type;
|
||||
- (id) initWithContentsOfURL: (NSURL *) url ofType: (NSString *) type;
|
||||
- (BOOL) loadDataRepresentation: (NSData *) data ofType: (NSString *) type;
|
||||
- (BOOL) loadFileWrapperRepresentation: (NSFileWrapper *) wrapper
|
||||
ofType: (NSString *) type;
|
||||
@ -259,4 +264,12 @@ typedef enum {
|
||||
ofType: (NSString *) type
|
||||
saveOperation: (NSSaveOperationType) operation;
|
||||
|
||||
- (void)saveToURL: (NSURL *) url
|
||||
ofType: (NSString *) typeName
|
||||
forSaveOperation: (NSSaveOperationType) saveOperation
|
||||
completionHandler: (void (^)(NSError *errorOrNil)) completionHandler;
|
||||
|
||||
- (void)autosaveWithImplicitCancellability: (BOOL) autosavingIsImplicitlyCancellable
|
||||
completionHandler: (void (^)(NSError *errorOrNil)) completionHandler;
|
||||
|
||||
@end
|
||||
|
@ -32,6 +32,11 @@ typedef enum {
|
||||
NSGlyphInscribeOverBelow,
|
||||
} NSGlyphInscription;
|
||||
|
||||
typedef NS_ENUM(NSInteger, NSTextLayoutOrientation) {
|
||||
NSTextLayoutOrientationHorizontal,
|
||||
NSTextLayoutOrientationVertical,
|
||||
};
|
||||
|
||||
@interface NSLayoutManager : NSObject {
|
||||
NSTextStorage *_textStorage;
|
||||
NSGlyphGenerator *_glyphGenerator;
|
||||
@ -47,6 +52,7 @@ typedef enum {
|
||||
struct NSRangeEntries *_rangeToTemporaryAttributes;
|
||||
|
||||
BOOL _layoutInvalid;
|
||||
BOOL _allowsNonContiguousLayout;
|
||||
|
||||
NSRect _extraLineFragmentRect;
|
||||
NSRect _extraLineFragmentUsedRect;
|
||||
@ -126,6 +132,8 @@ typedef enum {
|
||||
- (NSRect) extraLineFragmentUsedRect;
|
||||
- (NSTextContainer *) extraLineFragmentTextContainer;
|
||||
|
||||
- (BOOL) allowsNonContiguousLayout;
|
||||
|
||||
- (void) setTextContainer: (NSTextContainer *) container
|
||||
forGlyphRange: (NSRange) glyphRange;
|
||||
- (void) setLineFragmentRect: (NSRect) fragmentRect
|
||||
@ -268,6 +276,8 @@ typedef enum {
|
||||
paragraphStyle: (NSParagraphStyle *) style
|
||||
ruler: (NSRulerView *) ruler
|
||||
enabled: (BOOL) isEnabled;
|
||||
|
||||
- (void) setAllowsNonContiguousLayout: (BOOL) value;
|
||||
@end
|
||||
|
||||
@protocol NSLayoutManagerDelegate <NSObject>
|
||||
@ -284,4 +294,6 @@ typedef enum {
|
||||
|
||||
@protocol NSTextLayoutOrientationProvider
|
||||
|
||||
- (NSTextLayoutOrientation) layoutOrientation;
|
||||
|
||||
@end
|
||||
|
@ -25,4 +25,14 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
- (void) fixParagraphStyleAttributeInRange: (NSRange) range;
|
||||
- (void) fixAttributesInRange: (NSRange) range;
|
||||
- (void) applyFontTraits: (NSFontTraitMask) traits range: (NSRange) range;
|
||||
|
||||
- (BOOL) readFromURL:(NSURL *)url
|
||||
options:(NSDictionary<NSAttributedStringDocumentReadingOptionKey, id> *)opts
|
||||
documentAttributes:(NSDictionary<NSAttributedStringDocumentAttributeKey, id> * _Nullable *)dict
|
||||
error:(NSError * _Nullable *)error;
|
||||
|
||||
- (void)addAttribute:(NSAttributedStringKey)name
|
||||
value:(id)value
|
||||
range:(NSRange)range;
|
||||
|
||||
@end
|
||||
|
@ -18,6 +18,7 @@ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import <AppKit/NSParagraphStyle.h>
|
||||
#import <AppKit/NSTextTab.h>
|
||||
|
||||
@interface NSMutableParagraphStyle : NSParagraphStyle
|
||||
|
||||
@ -47,6 +48,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
- (void) setDefaultTabInterval: (CGFloat) interval;
|
||||
- (void) setTabStops: (NSArray *) tabStops;
|
||||
- (void) addTabStop:(NSTextTab *) tabStop;
|
||||
- (void) removeTabStop:(NSTextTab *) tabStop;
|
||||
|
||||
|
||||
- (void) setHyphenationFactor: (float) factor;
|
||||
- (void) setTighteningFactorForTruncation: (float) factor;
|
||||
|
@ -52,6 +52,8 @@ typedef enum {
|
||||
|
||||
+ (NSParagraphStyle *) defaultParagraphStyle;
|
||||
|
||||
+ (NSWritingDirection)defaultWritingDirectionForLanguage:(NSString *)languageName;
|
||||
|
||||
- (NSWritingDirection) baseWritingDirection;
|
||||
|
||||
- (CGFloat) paragraphSpacing;
|
||||
|
@ -19,6 +19,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import <AppKit/AppKitExport.h>
|
||||
#import <AppKit/NSView.h>
|
||||
#import <AppKit/NSControl.h>
|
||||
#import <AppKit/NSScroller.h>
|
||||
#import <Foundation/NSString.h>
|
||||
|
||||
@class NSClipView, NSScroller, NSColor, NSRulerView;
|
||||
@ -50,16 +52,32 @@ APPKIT_EXPORT NSString *const NSScrollViewDidLiveScrollNotification;
|
||||
BOOL _scrollsDynamically;
|
||||
BOOL _autohidesScrollers;
|
||||
NSCursor *_documentCursor;
|
||||
BOOL _allowsMagnification;
|
||||
CGFloat _magnification;
|
||||
CGFloat _minMagnification;
|
||||
CGFloat _maxMagnification;
|
||||
}
|
||||
|
||||
+ (NSSize) frameSizeForContentSize: (NSSize) contentSize
|
||||
hasHorizontalScroller: (BOOL) hasHorizontalScroller
|
||||
hasVerticalScroller: (BOOL) hasVerticalScroller
|
||||
borderType: (NSBorderType) borderType;
|
||||
+ (NSSize)frameSizeForContentSize:(NSSize)cSize
|
||||
horizontalScrollerClass:(Class)horizontalScrollerClass
|
||||
verticalScrollerClass:(Class)verticalScrollerClass
|
||||
borderType:(NSBorderType)type
|
||||
controlSize:(NSControlSize)controlSize
|
||||
scrollerStyle:(NSScrollerStyle)scrollerStyle;
|
||||
+ (NSSize) contentSizeForFrameSize: (NSSize) fSize
|
||||
hasHorizontalScroller: (BOOL) hasHorizontalScroller
|
||||
hasVerticalScroller: (BOOL) hasVerticalScroller
|
||||
borderType: (NSBorderType) borderType;
|
||||
+ (NSSize)contentSizeForFrameSize:(NSSize)fSize
|
||||
horizontalScrollerClass:(Class)horizontalScrollerClass
|
||||
verticalScrollerClass:(Class)verticalScrollerClass
|
||||
borderType:(NSBorderType)type
|
||||
controlSize:(NSControlSize)controlSize
|
||||
scrollerStyle:(NSScrollerStyle)scrollerStyle;
|
||||
|
||||
+ (void) setRulerViewClass: (Class) aClass;
|
||||
+ (Class) rulerViewClass;
|
||||
@ -94,6 +112,10 @@ APPKIT_EXPORT NSString *const NSScrollViewDidLiveScrollNotification;
|
||||
- (BOOL) autohidesScrollers;
|
||||
|
||||
- (NSCursor *) documentCursor;
|
||||
- (CGFloat) magnification;
|
||||
- (CGFloat) minMagnification;
|
||||
- (CGFloat) maxMagnification;
|
||||
- (BOOL) allowsMagnification;
|
||||
|
||||
- (void) setDocumentView: (NSView *) view;
|
||||
- (void) setContentView: (NSClipView *) clipView;
|
||||
@ -116,6 +138,10 @@ APPKIT_EXPORT NSString *const NSScrollViewDidLiveScrollNotification;
|
||||
- (void) setScrollsDynamically: (BOOL) flag;
|
||||
- (void) setDocumentCursor: (NSCursor *) cursor;
|
||||
- (void) setAutohidesScrollers: (BOOL) value;
|
||||
- (void) setMagnification: (CGFloat) value;
|
||||
- (void) setMinMagnification: (CGFloat) value;
|
||||
- (void) setMaxMagnification: (CGFloat) value;
|
||||
- (BOOL) setAllowsMagnification: (BOOL) value;
|
||||
|
||||
- (void) tile;
|
||||
- (void) reflectScrolledClipView: (NSClipView *) clipView;
|
||||
|
@ -46,6 +46,12 @@ enum {
|
||||
NSOnlyScrollerArrows = 1,
|
||||
NSAllScrollerParts = 2,
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSInteger, NSScrollerStyle) {
|
||||
NSScrollerStyleLegacy,
|
||||
NSScrollerStyleOverlay,
|
||||
};
|
||||
|
||||
typedef NSUInteger NSUsableScrollerParts;
|
||||
|
||||
@interface NSScroller : NSControl {
|
||||
@ -64,6 +70,8 @@ typedef NSUInteger NSUsableScrollerParts;
|
||||
NSScrollerPart _hitPart;
|
||||
BOOL _isEnabled;
|
||||
BOOL _isHighlighted;
|
||||
|
||||
NSScrollerStyle _scrollerStyle;
|
||||
}
|
||||
|
||||
+ (CGFloat) scrollerWidth;
|
||||
@ -71,11 +79,14 @@ typedef NSUInteger NSUsableScrollerParts;
|
||||
- (CGFloat) knobProportion;
|
||||
- (NSScrollArrowPosition) arrowsPosition;
|
||||
- (NSControlSize) controlSize;
|
||||
- (NSScrollerStyle) scrollerStyle;
|
||||
+ (NSScrollerStyle) preferredScrollerStyle;
|
||||
|
||||
- (void) setFloatValue: (float) zeroToOneValue
|
||||
knobProportion: (CGFloat) zeroToOneKnob;
|
||||
- (void) setArrowsPosition: (NSScrollArrowPosition) position;
|
||||
- (void) setControlSize: (NSControlSize) value;
|
||||
- (void) setScrollerStyle : (NSScrollerStyle) style;
|
||||
|
||||
- (NSRect) rectForPart: (NSScrollerPart) part;
|
||||
- (void) checkSpaceForParts;
|
||||
|
@ -30,6 +30,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
#import <AppKit/NSText.h>
|
||||
#import <AppKit/NSTextInput.h>
|
||||
#import <AppKit/NSTextInputClient.h>
|
||||
#import <AppKit/NSLayoutManager.h>
|
||||
|
||||
#import <Foundation/NSTextCheckingResult.h>
|
||||
|
||||
@ -68,7 +69,7 @@ APPKIT_EXPORT NSString *const NSAllRomanInputSourcesLocaleIdentifier;
|
||||
|
||||
@class NSUndoTyping;
|
||||
|
||||
@interface NSTextView : NSText <NSTextInput> {
|
||||
@interface NSTextView : NSText <NSTextInput, NSTextLayoutOrientationProvider> {
|
||||
NSTextStorage *_textStorage;
|
||||
NSTextContainer *_textContainer;
|
||||
NSSize _textContainerInset;
|
||||
@ -98,6 +99,7 @@ APPKIT_EXPORT NSString *const NSAllRomanInputSourcesLocaleIdentifier;
|
||||
BOOL _usesRuler;
|
||||
BOOL _rulerVisible;
|
||||
BOOL _usesFontPanel;
|
||||
BOOL _usesFindBar;
|
||||
BOOL _allowsUndo;
|
||||
|
||||
NSMutableArray *_selectedRanges;
|
||||
@ -129,8 +131,14 @@ APPKIT_EXPORT NSString *const NSAllRomanInputSourcesLocaleIdentifier;
|
||||
BOOL _isContinuousSpellCheckingEnabled;
|
||||
BOOL _isAutomaticSpellingCorrectionEnabled;
|
||||
NSTextCheckingTypes _enabledTextCheckingTypes;
|
||||
BOOL _smartInsertDeleteEnabled;
|
||||
|
||||
BOOL _allowsDocumentBackgroundColorChange;
|
||||
|
||||
NSUndoTyping *_undoTyping;
|
||||
NSTextLayoutOrientation _layoutOrientation;
|
||||
|
||||
BOOL _incrementalSearchingEnabled;
|
||||
}
|
||||
|
||||
- initWithFrame: (NSRect) frame textContainer: (NSTextContainer *) container;
|
||||
@ -250,8 +258,21 @@ APPKIT_EXPORT NSString *const NSAllRomanInputSourcesLocaleIdentifier;
|
||||
- (NSTextCheckingTypes) enabledTextCheckingTypes;
|
||||
- (void) setEnabledTextCheckingTypes: (NSTextCheckingTypes) checkingTypes;
|
||||
|
||||
- (BOOL) smartInsertDeleteEnabled;
|
||||
- (void) setSmartInsertDeleteEnabled: (BOOL) boolForKey;
|
||||
|
||||
- (BOOL) allowsDocumentBackgroundColorChange;
|
||||
- (void) setAllowsDocumentBackgroundColorChange: (BOOL) value;
|
||||
|
||||
- (void) setSpellingState: (NSInteger) value range: (NSRange) characterRange;
|
||||
|
||||
- (BOOL) usesFindBar;
|
||||
- (void) setUsesFindBar: (BOOL) value;
|
||||
- (BOOL) isIncrementalSearchingEnabled;
|
||||
- (void) setIncrementalSearchingEnabled: (BOOL) value;
|
||||
|
||||
- (void) setLayoutOrientation:(NSTextLayoutOrientation)orientation;
|
||||
|
||||
@end
|
||||
|
||||
@interface NSObject (NSTextView_undoManager)
|
||||
|
@ -109,6 +109,7 @@ APPKIT_EXPORT const NSViewFullScreenModeOptionKey NSFullScreenModeApplicationPre
|
||||
NSInteger _rectsBeingRedrawnCount;
|
||||
CGFloat _frameRotation;
|
||||
CGFloat _boundsRotation;
|
||||
BOOL _translatesAutoresizingMaskIntoConstraints;
|
||||
|
||||
BOOL _validTrackingAreas;
|
||||
BOOL _validTransforms;
|
||||
@ -203,6 +204,7 @@ APPKIT_EXPORT const NSViewFullScreenModeOptionKey NSFullScreenModeApplicationPre
|
||||
- (NSMenu *) menuForEvent: (NSEvent *) event;
|
||||
- (NSMenuItem *) enclosingMenuItem;
|
||||
- (NSString *) toolTip;
|
||||
- (BOOL) translatesAutoresizingMaskIntoConstraints;
|
||||
|
||||
- viewWithTag: (NSInteger) tag;
|
||||
- (NSView *) hitTest: (NSPoint) point;
|
||||
@ -225,6 +227,7 @@ APPKIT_EXPORT const NSViewFullScreenModeOptionKey NSFullScreenModeApplicationPre
|
||||
- (void) setBoundsSize: (NSSize) size;
|
||||
- (void) setBoundsOrigin: (NSPoint) origin;
|
||||
- (void) setBoundsRotation: (CGFloat) angle;
|
||||
- (void) setTranslatesAutoresizingMaskIntoConstraints: (BOOL) value;
|
||||
|
||||
- (CGFloat) frameRotation;
|
||||
- (CGFloat) boundsRotation;
|
||||
|
Loading…
x
Reference in New Issue
Block a user