Add string constants

This commit is contained in:
Gregory John Casamento 2019-12-22 21:38:14 -05:00
parent fdadb2109c
commit a8360c0de4
2 changed files with 56 additions and 2 deletions

View file

@ -51,8 +51,16 @@ APPKIT_EXPORT NSFontCollectionMatchingOptionKey const NSFontCollectionDisallowAu
typedef NSString* NSFontCollectionName;
@interface NSFontCollection : NSObject <NSCopying, NSMutableCopying, NSCoding>
@class NSMutableDictionary, NSMutableArray, GSFontEnumerator, NSArray, NSDictionary, NSError;
@interface NSFontCollection : NSObject <NSCopying, NSMutableCopying, NSCoding>
{
NSMutableDictionary *_collectionDictionary;
NSMutableArray *_queryDescriptors;
NSMutableArray *_exclusionDescriptors;
GSFontEnumerator *_fontEnumerator;
}
// Initializers...
+ (NSFontCollection *) fontCollectionWithDescriptors: (NSArray *)queryDescriptors;
+ (NSFontCollection *) fontCollectionWithAllAvailableDescriptors;

View file

@ -23,10 +23,52 @@
*/
#import <AppKit/NSFontCollection.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSArray.h>
#import <Foundation/NSError.h>
#import <GNUstepGUI/GSFontInfo.h>
// Values for NSFontCollectionAction
NSFontCollectionActionTypeKey const NSFontCollectionWasShown = @"NSFontCollectionWasShown";
NSFontCollectionActionTypeKey const NSFontCollectionWasHidden = @"NSFontCollectionWasHidden";
NSFontCollectionActionTypeKey const NSFontCollectionWasRenamed = @"NSFontCollectionWasRenamed";
// Standard named collections
NSFontCollectionName const NSFontCollectionAllFonts = @"NSFontCollectionAllFonts";
NSFontCollectionName const NSFontCollectionUser = @"NSFontCollectionUser";
NSFontCollectionName const NSFontCollectionFavorites = @"NSFontCollectionFavorites";
NSFontCollectionName const NSFontCollectionRecentlyUsed = @"NSFontCollectionRecentlyUsed";
// Collections
NSFontCollectionMatchingOptionKey const NSFontCollectionIncludeDisabledFontsOption = @"NSFontCollectionIncludeDisabledFontsOption";
NSFontCollectionMatchingOptionKey const NSFontCollectionRemoveDuplicatesOption = @"NSFontCollectionRemoveDuplicatesOption";
NSFontCollectionMatchingOptionKey const NSFontCollectionDisallowAutoActivationOption = @"NSFontCollectionDisallowAutoActivationOption";
@implementation NSFontCollection
// Initializers...
- (instancetype) init
{
self = [super init];
if (self != nil)
{
_fontEnumerator = [[GSFontEnumerator alloc] init];
_collectionDictionary = [[NSMutableDictionary alloc] init];
_queryDescriptors = [[NSMutableArray alloc] init];
_exclusionDescriptors = [[NSMutableArray alloc] init];
}
return self;
}
- (void) dealloc
{
RELEASE(_fontEnumerator);
RELEASE(_collectionDictionary);
RELEASE(_queryDescriptors);
RELEASE(_exclusionDescriptors);
[super dealloc];
}
+ (NSFontCollection *) fontCollectionWithDescriptors: (NSArray *)queryDescriptors
{
return nil;
@ -67,7 +109,11 @@
+ (NSArray *) allFontCollectionNames
{
return nil;
NSArray *array = [NSArray arrayWithObjects: NSFontCollectionAllFonts,
NSFontCollectionUser,
NSFontCollectionFavorites,
NSFontCollectionRecentlyUsed, nil];
return array;
}
+ (NSFontCollection *) fontCollectionWithName: (NSFontCollectionName)name