NSView: define layer-related properties

Define layer-related properties in NSView for compatibility purposes,
and keep their getters and setters as stubs, since they will not have
any effect before NSView-CALayer integration is implemented.
This commit is contained in:
Daniel Ferreira 2017-07-18 03:47:20 +10:00 committed by Ivan Vučica
parent 9e80b07531
commit bb6805742d
2 changed files with 72 additions and 0 deletions

View file

@ -72,6 +72,31 @@ enum _NSBorderType {
};
typedef NSUInteger NSBorderType;
typedef NSInteger NSViewLayerContentsRedrawPolicy;
enum {
NSViewLayerContentsRedrawNever = 0,
NSViewLayerContentsRedrawOnSetNeedsDisplay = 1,
NSViewLayerContentsRedrawDuringViewResize = 2,
NSViewLayerContentsRedrawBeforeViewResize = 3,
NSViewLayerContentsRedrawCrossfade = 4
};
typedef NSInteger NSViewLayerContentsPlacement;
enum {
NSViewLayerContentsPlacementScaleAxesIndependently = 0,
NSViewLayerContentsPlacementScaleProportionallyToFit = 1,
NSViewLayerContentsPlacementScaleProportionallyToFill = 2,
NSViewLayerContentsPlacementCenter = 3,
NSViewLayerContentsPlacementTop = 4,
NSViewLayerContentsPlacementTopRight = 5,
NSViewLayerContentsPlacementRight = 6,
NSViewLayerContentsPlacementBottomRight = 7,
NSViewLayerContentsPlacementBottom = 8,
NSViewLayerContentsPlacementBottomLeft = 9,
NSViewLayerContentsPlacementLeft = 10,
NSViewLayerContentsPlacementTopLeft = 11
};
/*
* autoresize constants which NSView uses in
* determining the parts of a view which are
@ -590,6 +615,19 @@ PACKAGE_SCOPE
- (NSAttributedString *)pageHeader;
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
#if GS_HAS_DECLARED_PROPERTIES
@property (nonatomic) NSViewLayerContentsPlacement layerContentsPlacement;
@property (nonatomic) NSViewLayerContentsRedrawPolicy layerContentsRedrawPolicy;
#else
- (NSViewLayerContentsPlacement) layerContentsPlacement;
- (void) setLayerContentsPlacement: (NSViewLayerContentsPlacement)placement;
- (NSViewLayerContentsRedrawPolicy) layerContentsRedrawPolicy;
- (void) setLayerContentsRedrawPolicy: (NSViewLayerContentsRedrawPolicy) pol;
#endif
#endif
@end

View file

@ -5086,6 +5086,40 @@ static NSView* findByTag(NSView *view, NSInteger aTag, NSUInteger *level)
}
}
- (NSViewLayerContentsPlacement) layerContentsPlacement
{
// FIXME (when views have CALayer support)
return NSViewLayerContentsPlacementScaleAxesIndependently;
}
- (void) setLayerContentsPlacement: (NSViewLayerContentsPlacement)placement
{
// FIXME (when views have CALayer support)
static BOOL logged = NO;
if (!logged)
{
NSLog(@"warning: stub no-op implementation of -[NSView setLayerContentsPlacement:]");
logged = YES;
}
}
- (NSViewLayerContentsRedrawPolicy) layerContentsRedrawPolicy
{
// FIXME (when views have CALayer support)
return NSViewLayerContentsRedrawNever;
}
- (void) setLayerContentsRedrawPolicy: (NSViewLayerContentsRedrawPolicy) pol
{
// FIXME (when views have CALayer support)
static BOOL logged = NO;
if (!logged)
{
NSLog(@"warning: stub no-op implementation of -[NSView setLayerContentsRedrawPolicy:]");
logged = YES;
}
}
@end
@implementation NSView(KeyViewLoop)