libs-gui/Source/NSAppearance.m

111 lines
2.5 KiB
Mathematica
Raw Permalink Normal View History

2020-01-15 13:19:59 +00:00
/* Implementation of class NSAppearance
2020-01-17 13:20:33 +00:00
Copyright (C) 2020 Free Software Foundation, Inc.
2020-01-15 13:19:59 +00:00
By: Gregory John Casamento
Date: Wed Jan 15 07:03:39 EST 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 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/NSAppearance.h>
2020-01-15 15:39:44 +00:00
#import <Foundation/NSArchiver.h>
2020-01-15 13:19:59 +00:00
NSAppearance *__currentAppearance = nil;
@implementation NSAppearance
// Creating an appearance...
+ (instancetype) appearanceNamed: (NSString *)name
{
return [[NSAppearance alloc] initWithAppearanceNamed: name bundle: nil];
}
- (instancetype) initWithAppearanceNamed: (NSString *)name bundle: (NSBundle *)bundle
{
self = [super init];
2020-01-17 13:20:33 +00:00
if (self)
2020-01-15 13:19:59 +00:00
{
ASSIGNCOPY(_name, name);
_allowsVibrancy = NO;
}
return self;
}
- (instancetype) initWithCoder: (NSCoder *)coder
{
2020-01-17 13:20:33 +00:00
if ([coder allowsKeyedCoding])
2020-01-15 15:39:44 +00:00
{
}
else
{
2020-01-17 22:45:41 +00:00
ASSIGN(_name, [coder decodeObject]);
2020-01-15 15:39:44 +00:00
[coder decodeValueOfObjCType: @encode(BOOL) at: &_allowsVibrancy];
}
2020-01-15 13:19:59 +00:00
return self;
}
- (void) encodeWithCoder: (NSCoder *)coder
{
2020-01-17 13:20:33 +00:00
if ([coder allowsKeyedCoding])
2020-01-15 15:39:44 +00:00
{
}
else
{
[coder encodeObject: _name];
[coder encodeValueOfObjCType: @encode(BOOL) at: &_allowsVibrancy];
}
2020-01-15 13:19:59 +00:00
}
2020-01-19 21:11:06 +00:00
- (void) dealloc
{
RELEASE(_name);
[super dealloc];
}
2020-01-15 13:19:59 +00:00
// Getting the appearance name
- (NSString *) name
{
return _name;
}
// Determining the most appropriate appearance
- (NSAppearanceName) bestMatchFromAppearancesWithNames: (NSArray *)appearances
{
return nil;
}
// Getting and setting the appearance
+ (void) setCurrentAppearance: (NSAppearance *)appearance
{
ASSIGN(__currentAppearance, appearance);
}
+ (NSAppearance *) currentAppearance
{
return __currentAppearance;
}
// Managing vibrancy
- (BOOL) allowsVibrancy
{
return _allowsVibrancy;
}
@end