This commit is contained in:
Danny Greg 2012-09-18 10:53:27 +01:00
Родитель 8908964e03 916afb1a8a
Коммит b9c99825db
5 изменённых файлов: 99 добавлений и 2 удалений

@ -1 +1 @@
Subproject commit 0753c732b0225973fb37e74a316cefe3cd76ba68
Subproject commit 7527301abb2c12d2ef8950926f74116ea5a554bf

Просмотреть файл

@ -42,6 +42,9 @@
D09AE4FA15C5F45300ECAD10 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D09AE4E215C5F45200ECAD10 /* Cocoa.framework */; };
D09AE4FD15C5F45300ECAD10 /* Rebel.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D09AE4DF15C5F45200ECAD10 /* Rebel.framework */; };
D09AE50315C5F45300ECAD10 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = D09AE50115C5F45300ECAD10 /* InfoPlist.strings */; };
D0E91C581603CC7600D23E93 /* RBLClipView.h in Headers */ = {isa = PBXBuildFile; fileRef = D0E91C561603CC7600D23E93 /* RBLClipView.h */; settings = {ATTRIBUTES = (Public, ); }; };
D0E91C591603CC7600D23E93 /* RBLClipView.m in Sources */ = {isa = PBXBuildFile; fileRef = D0E91C571603CC7600D23E93 /* RBLClipView.m */; };
D0E91C5B1603CDC300D23E93 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0E91C5A1603CDC300D23E93 /* QuartzCore.framework */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@ -211,6 +214,9 @@
D09AE4F815C5F45300ECAD10 /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; };
D09AE50015C5F45300ECAD10 /* RebelTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "RebelTests-Info.plist"; sourceTree = "<group>"; };
D09AE50215C5F45300ECAD10 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
D0E91C561603CC7600D23E93 /* RBLClipView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RBLClipView.h; sourceTree = "<group>"; };
D0E91C571603CC7600D23E93 /* RBLClipView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RBLClipView.m; sourceTree = "<group>"; };
D0E91C5A1603CDC300D23E93 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -218,7 +224,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
306A81ED1601F44200BF45F3 /* QuartzCore.framework in Frameworks */,
D0E91C5B1603CDC300D23E93 /* QuartzCore.framework in Frameworks */,
D06AD30F15C6370700A73D8E /* ReactiveCocoa.framework in Frameworks */,
D09AE4E315C5F45200ECAD10 /* Cocoa.framework in Frameworks */,
);
@ -261,6 +267,8 @@
D0723FBD15C5F9CD004DBDC7 /* Classes */ = {
isa = PBXGroup;
children = (
D0E91C561603CC7600D23E93 /* RBLClipView.h */,
D0E91C571603CC7600D23E93 /* RBLClipView.m */,
D0723FE115C616AF004DBDC7 /* RBLResizableImage.h */,
D0723FE215C616AF004DBDC7 /* RBLResizableImage.m */,
D0723FBE15C5F9D8004DBDC7 /* RBLView.h */,
@ -417,6 +425,7 @@
306A81EC1601F44200BF45F3 /* QuartzCore.framework */,
D09AE4E215C5F45200ECAD10 /* Cocoa.framework */,
D09AE4F815C5F45300ECAD10 /* SenTestingKit.framework */,
D0E91C5A1603CDC300D23E93 /* QuartzCore.framework */,
D09AE4E415C5F45200ECAD10 /* Other Frameworks */,
);
name = Frameworks;
@ -489,6 +498,7 @@
306A81DB1601C7A300BF45F3 /* RBLPopover.h in Headers */,
889E5E0F15FFDAE0007F2445 /* RBLViewModel.h in Headers */,
304692F21607259A00B79746 /* EXTKeyPathCoding.h in Headers */,
D0E91C581603CC7600D23E93 /* RBLClipView.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -705,6 +715,7 @@
306A81DC1601C7A300BF45F3 /* RBLPopover.m in Sources */,
306A81E91601E92000BF45F3 /* CAAnimation+RBLBlockAdditions.m in Sources */,
889E5E1015FFDAE0007F2445 /* RBLViewModel.m in Sources */,
D0E91C591603CC7600D23E93 /* RBLClipView.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

29
Rebel/RBLClipView.h Normal file
Просмотреть файл

@ -0,0 +1,29 @@
//
// RBLClipView.h
// Rebel
//
// Created by Justin Spahr-Summers on 2012-09-14.
// Copyright (c) 2012 GitHub. All rights reserved.
//
#import <QuartzCore/QuartzCore.h>
//
// A faster NSClipView based on CAScrollLayer.
//
// This view should be set as the scroll view's contentView as soon as possible
// after the scroll view is initialized. For some reason, scroll bars will
// disappear on 10.7 (but not 10.8) unless hasHorizontalScroller and
// hasVerticalScroller are set _after_ the contentView.
//
@interface RBLClipView : NSClipView
// The backing layer for this view.
@property (nonatomic, strong) CAScrollLayer *layer;
// Whether the content in this view is opaque.
//
// Defaults to NO.
@property (nonatomic, getter = isOpaque) BOOL opaque;
@end

56
Rebel/RBLClipView.m Normal file
Просмотреть файл

@ -0,0 +1,56 @@
//
// RBLClipView.m
// Rebel
//
// Created by Justin Spahr-Summers on 2012-09-14.
// Copyright (c) 2012 GitHub. All rights reserved.
//
#import "RBLClipView.h"
#import "NSColor+RBLCGColorAdditions.h"
@implementation RBLClipView
#pragma mark Properties
@dynamic layer;
- (NSColor *)backgroundColor {
return [NSColor rbl_colorWithCGColor:self.layer.backgroundColor];
}
- (void)setBackgroundColor:(NSColor *)color {
self.layer.backgroundColor = color.rbl_CGColor;
}
- (BOOL)isOpaque {
return self.layer.opaque;
}
- (void)setOpaque:(BOOL)opaque {
self.layer.opaque = opaque;
}
#pragma mark Lifecycle
- (id)initWithFrame:(NSRect)frame {
self = [super initWithFrame:frame];
if (self == nil) return nil;
self.wantsLayer = YES;
self.layerContentsRedrawPolicy = NSViewLayerContentsRedrawNever;
// Matches default NSClipView settings.
self.backgroundColor = NSColor.clearColor;
self.opaque = NO;
return self;
}
#pragma mark Backing Layer
- (CALayer *)makeBackingLayer {
return [CAScrollLayer layer];
}
@end

Просмотреть файл

@ -8,6 +8,7 @@
#import <Rebel/NSColor+RBLCGColorAdditions.h>
#import <Rebel/NSView+RBLAnimationAdditions.h>
#import <Rebel/RBLClipView.h>
#import <Rebel/RBLResizableImage.h>
#import <Rebel/RBLView.h>
#import <Rebel/RBLViewModel.h>