aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <nyamatongwe@gmail.com>2013-10-06 10:03:24 +1100
committernyamatongwe <nyamatongwe@gmail.com>2013-10-06 10:03:24 +1100
commit39917e8d680034e78af5ddbfd490cb483f1dd5ec (patch)
tree79c7151731c3b3842feb77ad6492ec623b5cdde2
parent81ecc60d90ed506ad8c0bbb35bdd0c88ab24835c (diff)
downloadscintilla-mirror-39917e8d680034e78af5ddbfd490cb483f1dd5ec.tar.gz
Allow subclassing InnerView.
-rw-r--r--cocoa/ScintillaView.h2
-rw-r--r--cocoa/ScintillaView.mm13
-rw-r--r--doc/ScintillaHistory.html4
3 files changed, 18 insertions, 1 deletions
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<ScintillaNotificationProtocol> 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
@@ -873,6 +873,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.
*/
- (void) magnifyWithEvent: (NSEvent *) event
@@ -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.
</li>
<li>
+ 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.
+ </li>
+ <li>
On Cocoa, the ScintillaView.h header hides internal implementation details from Platform.h and ScintillaCocoa.h.
dealloc removed from @interface.
</li>