diff options
author | nyamatongwe <unknown> | 2009-05-14 12:10:06 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2009-05-14 12:10:06 +0000 |
commit | 805e109be2f52c0ea446511fc33efb3746a3bc18 (patch) | |
tree | 3b57cf166d494a0dba47befcea94deba3da0fbda /cocoa/ScintillaView.h | |
parent | 8e12be32e9d14363f1e2f0fe6fc305b68a64ceb5 (diff) | |
download | scintilla-mirror-805e109be2f52c0ea446511fc33efb3746a3bc18.tar.gz |
First upload of Cocoa platform from Mike Lischke at Sun.
Diffstat (limited to 'cocoa/ScintillaView.h')
-rw-r--r-- | cocoa/ScintillaView.h | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/cocoa/ScintillaView.h b/cocoa/ScintillaView.h new file mode 100644 index 000000000..b341dd225 --- /dev/null +++ b/cocoa/ScintillaView.h @@ -0,0 +1,89 @@ + +/** + * Declaration of the native Cocoa View that serves as container for the scintilla parts. + * + * Created by Mike Lischke. + * + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * This file is dual licensed under LGPL v2.1 and the Scintilla license (http://www.scintilla.org/License.txt). + */ + +#import <Cocoa/Cocoa.h> + +#import "ScintillaCocoa.h" + +@class ScintillaView; + +/** + * InnerView is the Cocoa interface to the Scintilla backend. It handles text input and + * provides a canvas for painting the output. + */ +@interface InnerView : NSView <NSTextInput> +{ +@private + Scintilla::ScintillaView* mOwner; + NSCursor* mCurrentCursor; + NSTrackingRectTag mCurrentTrackingRect; + + // Set when we are in composition mode and partial input is displayed. + NSRange mMarkedTextRange; + + // Caret position when a drag operation started. + int mLastPosition; +} + +- (void) removeMarkedText; +- (void) setCursor: (Scintilla::Window::Cursor) cursor; + +@property (retain) ScintillaView* owner; +@end + +@interface ScintillaView : NSView +{ +@private + // The back end is kind of a controller and model in one. + // It uses the content view for display. + Scintilla::ScintillaCocoa* mBackend; + + // This is the actual content to which the backend renders itself. + InnerView* mContent; + + NSScroller* mHorizontalScroller; + NSScroller* mVerticalScroller; +} + +- (void) dealloc; +- (void) layout; + +- (void) sendNotification: (NSString*) notificationName; + +// 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) scrollerAction: (id) sender; +- (InnerView*) content; + +// NSTextView compatibility layer. +- (NSString*) string; +- (void) setString: (NSString*) aString; +- (void) setEditable: (BOOL) editable; + +// Back end properties getters and setters. +- (void) setGeneralProperty: (int) property parameter: (long) parameter value: (long) value; +- (long) getGeneralProperty: (int) property parameter: (long) parameter; +- (void) setColorProperty: (int) property parameter: (long) parameter value: (NSColor*) value; +- (void) setColorProperty: (int) property parameter: (long) parameter fromHTML: (NSString*) fromHTML; +- (NSColor*) getColorProperty: (int) property parameter: (long) parameter; +- (void) setReferenceProperty: (int) property parameter: (long) parameter value: (const void*) value; +- (const void*) getReferenceProperty: (int) property parameter: (long) parameter; +- (void) setStringProperty: (int) property parameter: (long) parameter value: (NSString*) value; +- (NSString*) getStringProperty: (int) property parameter: (long) parameter; +- (void) setLexerProperty: (NSString*) name value: (NSString*) value; +- (NSString*) getLexerProperty: (NSString*) name; + +@property Scintilla::ScintillaCocoa* backend; + +@end |