This commit is contained in:
Justin Spahr-Summers 2012-10-22 21:13:04 -07:00
Родитель 5dd7432297
Коммит 9bd339bfb8
8 изменённых файлов: 62 добавлений и 107 удалений

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

@ -11,20 +11,15 @@
#import <AppKit/AppKit.h>
/*
* Extensions to NSColor for interoperability with CGColor.
*/
// Extensions to NSColor for interoperability with CGColor.
@interface NSColor (RBLCGColorAdditions)
/*
* The CGColor corresponding to the receiver.
*/
// The CGColor corresponding to the receiver.
@property (nonatomic, readonly) CGColorRef rbl_CGColor;
/*
* Returns an NSColor corresponding to the given CGColor.
*
* This currently does not handle pattern colors.
*/
// Returns an NSColor corresponding to the given CGColor.
//
// This currently does not handle pattern colors.
+ (NSColor *)rbl_colorWithCGColor:(CGColorRef)color;
@end

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

@ -11,9 +11,7 @@
#import <Cocoa/Cocoa.h>
/*
* This private category fixes blurry text in layer-backed text views and text
* fields.
*/
// This private category fixes blurry text in layer-backed text views and text
// fields.
@interface NSTextView (RBLAntialiasingAdditions)
@end

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

@ -8,43 +8,31 @@
#import <Cocoa/Cocoa.h>
/*
* Better block-based animation and animator proxies.
*/
// Better block-based animation and animator proxies.
@interface NSView (RBLAnimationAdditions)
/*
* Invokes +rbl_animate:completion: with a nil completion block.
*/
// Invokes +rbl_animate:completion: with a nil completion block.
+ (void)rbl_animate:(void (^)(void))animations;
/*
* Executes the given animation block within a new NSAnimationContext. When all
* animations in the group complete or are canceled, the given completion block
* (if not nil) will be invoked.
*/
// Executes the given animation block within a new NSAnimationContext. When all
// animations in the group complete or are canceled, the given completion block
// (if not nil) will be invoked.
+ (void)rbl_animate:(void (^)(void))animations completion:(void (^)(void))completion;
/*
* Invokes +rbl_animate:completion:, setting the animation duration of the
* context before queuing the given animations.
*/
// Invokes +rbl_animate:completion:, setting the animation duration of the
// context before queuing the given animations.
+ (void)rbl_animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations completion:(void (^)(void))completion;
/*
* Returns whether the calling code is executing in an animation context created
* by this category (like through -rbl_animate:completion:).
*
* This only describes whether an animation context is open, not if animations
* happen to be executing at the moment.
*/
// Returns whether the calling code is executing in an animation context created
// by this category (like through -rbl_animate:completion:).
//
// This only describes whether an animation context is open, not if animations
// happen to be executing at the moment.
+ (BOOL)rbl_isInAnimationContext;
/*
* Returns an animator proxy for the receiver if +rbl_isInAnimationContext
* returns YES. Otherwise, the receiver is returned (so that animating is
* effectively disabled).
*/
// Returns an animator proxy for the receiver if +rbl_isInAnimationContext
// returns YES. Otherwise, the receiver is returned (so that animating is
// effectively disabled).
- (instancetype)rbl_animator;
@end

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

@ -8,14 +8,12 @@
#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.

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

@ -13,7 +13,7 @@
@class RBLPopover;
@class RBLPopoverBackgroundView;
// Defines the different types of behavior of an `RBLPopover`
// Defines the different types of behavior of a RBLPopover.
//
// RBLPopoverViewControllerBehaviorApplicationDefined - The application decides
// when the popover should

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

@ -11,17 +11,13 @@
#import <Cocoa/Cocoa.h>
/*
* An image that supports resizing based on end caps.
*/
// An image that supports resizing based on end caps.
@interface RBLResizableImage : NSImage <NSCoding, NSCopying>
/*
* The end cap insets for the image.
*
* Any portion of the image not covered by end caps will be tiled when the image
* is drawn.
*/
// The end cap insets for the image.
//
// Any portion of the image not covered by end caps will be tiled when the image
// is drawn.
@property (nonatomic, assign) NSEdgeInsets capInsets;
@end

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

@ -14,69 +14,53 @@
// for MVVM.
@interface RBLView : NSView
/*
* The backing layer's background color, or nil if none has been set.
*/
// The backing layer's background color, or nil if none has been set.
@property (nonatomic, strong) NSColor *backgroundColor;
/*
* Whether the view's drawing completely fills its bounds with opaque content.
*
* Defaults to NO.
*/
// Whether the view's drawing completely fills its bounds with opaque content.
//
// Defaults to NO.
@property (nonatomic, getter = isOpaque) BOOL opaque;
/*
* Whether the view's drawing and layout uses a flipped (top-left origin)
* coordinate system.
*
* Defaults to NO.
*/
// Whether the view's drawing and layout uses a flipped (top-left origin)
// coordinate system.
//
// Defaults to NO.
@property (nonatomic, getter = isFlipped) BOOL flipped;
/*
* Whether the graphics context for the view's drawing should be cleared to
* transparent black in RBLView's implementation of -drawRect:.
*
* Defaults to YES.
*/
// Whether the graphics context for the view's drawing should be cleared to
// transparent black in RBLView's implementation of -drawRect:.
//
// Defaults to YES.
@property (nonatomic, assign) BOOL clearsContextBeforeDrawing;
/*
* Determines when the backing layer's contents should be redrawn.
*
* If -drawRect: is not overridden, this defaults to
* NSViewLayerContentsRedrawNever. If -drawRect: is overridden, this defaults to
* NSViewLayerContentsRedrawDuringViewResize.
*
* For better performance, subclasses should set the contentsCenter property of
* the backing layer to support scaling, and then change the value of this
* property to NSViewLayerContentsRedrawBeforeViewResize or
* NSViewLayerContentsRedrawOnSetNeedsDisplay.
*/
// Determines when the backing layer's contents should be redrawn.
//
// If -drawRect: is not overridden, this defaults to
// NSViewLayerContentsRedrawNever. If -drawRect: is overridden, this defaults to
// NSViewLayerContentsRedrawDuringViewResize.
//
// For better performance, subclasses should set the contentsCenter property of
// the backing layer to support scaling, and then change the value of this
// property to NSViewLayerContentsRedrawBeforeViewResize or
// NSViewLayerContentsRedrawOnSetNeedsDisplay.
@property (nonatomic, assign) NSViewLayerContentsRedrawPolicy layerContentsRedrawPolicy;
/*
* A prerendered image to use as the content for this view. This property is
* not the same as CALayer.contents, but does manipulate it.
*
* The behavior of this property is undefined if -drawRect: is overridden.
*/
// A prerendered image to use as the content for this view. This property is
// not the same as CALayer.contents, but does manipulate it.
//
// The behavior of this property is undefined if -drawRect: is overridden.
@property (nonatomic, strong) NSImage *contents;
// The view model which drives the view.
@property (nonatomic, strong) RBLViewModel *viewModel;
/*
* Subclasses may override this method to redraw the given rectangle. Any
* override of this method should invoke super.
*/
// Subclasses may override this method to redraw the given rectangle. Any
// override of this method should invoke super.
- (void)drawRect:(NSRect)rect;
/*
* Subclasses may override this method to manually lay out subviews. Any
* override of this method should invoke super.
*/
// Subclasses may override this method to manually lay out subviews. Any
// override of this method should invoke super.
- (void)layout;
@end

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

@ -9,10 +9,8 @@
#import "RBLView.h"
#import "NSColor+RBLCGColorAdditions.h"
/*
* The implementation pointer for -[RBLView drawRect:], used to identify when
* the method is overridden by subclasses.
*/
// The implementation pointer for -[RBLView drawRect:], used to identify when
// the method is overridden by subclasses.
static IMP RBLViewDrawRectIMP;
@interface RBLView () {
@ -22,9 +20,7 @@ static IMP RBLViewDrawRectIMP;
} _flags;
}
/*
* Whether this subclass of RBLView overrides -drawRect:.
*/
// Whether this subclass of RBLView overrides -drawRect:.
+ (BOOL)doesCustomDrawing;
@end