From 93f47df6328a33e7d2044afbe135d1189157e63d Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Fri, 15 Mar 2013 23:34:46 +1100 Subject: Use an NSScrollView on Cocoa for kinetic scrolling and hiding scrollbars unless wanted. Also affects platform-independent code. --- cocoa/ScintillaView.h | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'cocoa/ScintillaView.h') diff --git a/cocoa/ScintillaView.h b/cocoa/ScintillaView.h index f34ac7e08..87a443f73 100644 --- a/cocoa/ScintillaView.h +++ b/cocoa/ScintillaView.h @@ -26,6 +26,24 @@ extern NSString *SCIUpdateUINotification; - (void)notification: (Scintilla::SCNotification*)notification; @end +/** + * MarginView draws line numbers and other margins next to the text view. + */ +@interface MarginView : NSRulerView +{ +@private + int marginWidth; + ScintillaView *owner; + NSMutableArray *currentCursors; +} + +@property (assign) int marginWidth; +@property (assign) ScintillaView *owner; + +- (id)initWithScrollView:(NSScrollView *)aScrollView; + +@end + /** * InnerView is the Cocoa interface to the Scintilla backend. It handles text input and * provides a canvas for painting the output. @@ -63,8 +81,8 @@ extern NSString *SCIUpdateUINotification; // This is the actual content to which the backend renders itself. InnerView* mContent; - NSScroller* mHorizontalScroller; - NSScroller* mVerticalScroller; + NSScrollView *scrollView; + MarginView *marginView; CGFloat zoomDelta; @@ -78,6 +96,7 @@ extern NSString *SCIUpdateUINotification; @property (nonatomic, readonly) Scintilla::ScintillaCocoa* backend; @property (nonatomic, assign) id delegate; +@property (nonatomic, readonly) NSScrollView *scrollView; - (void) dealloc; - (void) positionSubViews; @@ -90,11 +109,7 @@ extern NSString *SCIUpdateUINotification; - (void) suspendDrawing: (BOOL) suspend; // Scroller handling -- (BOOL) setVerticalScrollRange: (int) range page: (int) page; -- (void) setVerticalScrollPosition: (float) position; -- (BOOL) setHorizontalScrollRange: (int) range page: (int) page; -- (void) setHorizontalScrollPosition: (float) position; - +- (void) setMarginWidth: (int) width; - (void) scrollerAction: (id) sender; - (InnerView*) content; -- cgit v1.2.3