Skip to content

Commit 055468d

Browse files
committed
Refactored PGClipView (mostly just @Property use).
1 parent e3a022f commit 055468d

File tree

3 files changed

+219
-288
lines changed

3 files changed

+219
-288
lines changed

PGClipView.h

+26-38
Original file line numberDiff line numberDiff line change
@@ -72,54 +72,42 @@ typedef NSUInteger PGScrollToRectType;
7272
NSUInteger _scrollCount;
7373
}
7474

75-
- (NSResponder<PGClipViewDelegate> *)delegate;
76-
- (void)setDelegate:(NSResponder<PGClipViewDelegate> *)anObject;
77-
78-
- (NSView *)documentView;
79-
- (void)setDocumentView:(NSView *)aView;
80-
- (NSRect)documentFrame;
81-
- (PGInset)boundsInset;
82-
- (void)setBoundsInset:(PGInset)inset;
83-
- (NSRect)insetBounds;
84-
85-
- (NSColor *)backgroundColor;
86-
- (void)setBackgroundColor:(NSColor *)aColor;
87-
- (BOOL)showsBorder;
88-
- (void)setShowsBorder:(BOOL)flag;
89-
- (NSCursor *)cursor;
90-
- (void)setCursor:(NSCursor *)cursor;
75+
@property(assign) NSResponder<PGClipViewDelegate> *delegate;
76+
@property(retain) NSView *documentView;
77+
@property(readonly) NSRect documentFrame;
78+
@property(assign) PGInset boundsInset;
79+
@property(readonly) NSRect insetBounds;
80+
@property(retain) NSColor *backgroundColor;
81+
@property(assign) BOOL showsBorder;
82+
@property(retain) NSCursor *cursor;
83+
@property(assign, getter = isScrolling) BOOL scrolling;
84+
@property(assign) PGRectEdgeMask pinLocation;
85+
86+
@property(readonly) NSPoint position;
87+
@property(readonly) NSPoint center;
88+
@property(readonly) NSPoint relativeCenter;
89+
@property(readonly) NSSize pinLocationOffset;
9190

92-
- (NSRect)scrollableRectWithBorder:(BOOL)flag;
93-
- (NSSize)distanceInDirection:(PGRectEdgeMask)direction forScrollType:(PGScrollType)scrollType;
94-
- (NSSize)distanceInDirection:(PGRectEdgeMask)direction forScrollType:(PGScrollType)scrollType fromPosition:(NSPoint)position;
95-
- (NSSize)maximumDistanceForScrollType:(PGScrollType)scrollType;
96-
- (BOOL)shouldExitForMovementInDirection:(PGRectEdgeMask)mask;
97-
98-
- (NSPoint)position;
9991
- (BOOL)scrollTo:(NSPoint)aPoint animation:(PGAnimationType)type;
10092
- (BOOL)scrollBy:(NSSize)aSize animation:(PGAnimationType)type;
10193
- (BOOL)scrollToEdge:(PGRectEdgeMask)mask animation:(PGAnimationType)type;
10294
- (BOOL)scrollToLocation:(PGPageLocation)location animation:(PGAnimationType)type;
103-
- (void)stopAnimatedScrolling;
104-
105-
- (PGRectEdgeMask)pinLocation;
106-
- (void)setPinLocation:(PGRectEdgeMask)mask;
107-
- (NSSize)pinLocationOffset;
108-
- (BOOL)scrollPinLocationToOffset:(NSSize)aSize;
109-
110-
- (NSPoint)center;
11195
- (BOOL)scrollCenterTo:(NSPoint)aPoint animation:(PGAnimationType)type;
112-
- (NSPoint)relativeCenter;
11396
- (BOOL)scrollRelativeCenterTo:(NSPoint)aPoint animation:(PGAnimationType)type;
97+
- (BOOL)scrollPinLocationToOffset:(NSSize)aSize animation:(PGAnimationType)type;
98+
- (void)stopAnimatedScrolling;
99+
100+
- (NSRect)scrollableRectWithBorder:(BOOL)flag;
101+
- (NSSize)distanceInDirection:(PGRectEdgeMask)direction forScrollType:(PGScrollType)scrollType;
102+
- (NSSize)distanceInDirection:(PGRectEdgeMask)direction forScrollType:(PGScrollType)scrollType fromPosition:(NSPoint)position;
103+
- (NSSize)maximumDistanceForScrollType:(PGScrollType)scrollType;
104+
- (BOOL)shouldExitForMovementInDirection:(PGRectEdgeMask)mask;
114105

115106
- (BOOL)handleMouseDown:(NSEvent *)firstEvent;
116107
- (void)arrowKeyDown:(NSEvent *)firstEvent;
117108
- (void)scrollInDirection:(PGRectEdgeMask)direction type:(PGScrollType)scrollType;
118109
- (void)magicPanForward:(BOOL)forward acrossFirst:(BOOL)across;
119110

120-
- (void)beginScrolling;
121-
- (void)endScrolling;
122-
123111
- (void)viewFrameDidChange:(NSNotification *)aNotif;
124112

125113
@end
@@ -137,10 +125,10 @@ typedef NSUInteger PGScrollToRectType;
137125

138126
@end
139127

140-
@interface NSObject(PGClipViewAdditions)
128+
@interface NSView(PGClipViewAdditions)
141129

142-
- (PGClipView *)PG_enclosingClipView;
143-
- (PGClipView *)PG_clipView;
130+
@property(readonly) PGClipView *PG_enclosingClipView;
131+
@property(readonly) PGClipView *PG_clipView;
144132

145133
- (void)PG_scrollRectToVisible:(NSRect)aRect type:(PGScrollToRectType)type;
146134
- (void)PG_scrollRectToVisible:(NSRect)aRect forView:(NSView *)view type:(PGScrollToRectType)type;

0 commit comments

Comments
 (0)