From 96b170e7fb83233c50b17fedf650a6ba8aaa7364 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Sun, 6 Oct 2013 10:03:24 +1100 Subject: Allow subclassing InnerView. --- cocoa/ScintillaView.h | 2 ++ cocoa/ScintillaView.mm | 13 ++++++++++++- doc/ScintillaHistory.html | 4 ++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/cocoa/ScintillaView.h b/cocoa/ScintillaView.h index 63b5cf4e9..f6a0e0dea 100644 --- a/cocoa/ScintillaView.h +++ b/cocoa/ScintillaView.h @@ -118,6 +118,8 @@ extern NSString *const SCIUpdateUINotification; @property (nonatomic, assign) id delegate; @property (nonatomic, readonly) NSScrollView *scrollView; ++ (Class) innerViewClass; + - (void) positionSubViews; - (void) sendNotification: (NSString*) notificationName; diff --git a/cocoa/ScintillaView.mm b/cocoa/ScintillaView.mm index 3bdc9646a..100da27a8 100644 --- a/cocoa/ScintillaView.mm +++ b/cocoa/ScintillaView.mm @@ -872,6 +872,17 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) //-------------------------------------------------------------------------------------------------- +/** + * Specify the InnerView class. Can be overridden in a subclass to provide an InnerView subclass. + */ + ++ (Class) innerViewClass +{ + return [InnerView class]; +} + +//-------------------------------------------------------------------------------------------------- + /** * Receives zoom messages, for example when a "pinch zoom" is performed on the trackpad. */ @@ -1032,7 +1043,7 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) self = [super initWithFrame:frame]; if (self) { - mContent = [[[InnerView alloc] init] autorelease]; + mContent = [[[[[self class] innerViewClass] alloc] initWithFrame:NSZeroRect] autorelease]; mContent.owner = self; // Initialize the scrollers but don't show them yet. diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index dd1dff440..d15caa997 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -479,6 +479,10 @@ to registerNotifyCallback: which will be deprecated in the future.
  • + On Cocoa, clients may customize InnerView by subclassing both InnerView and ScintillaView and implementing the + innerViewClass class method on the ScintillaView subclass to return the class of the InnerView subclass. +
  • +
  • On Cocoa, the ScintillaView.h header hides internal implementation details from Platform.h and ScintillaCocoa.h. dealloc removed from @interface.
  • -- cgit v1.2.3