Merged NSText code into NSTextView

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@8383 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Nicola Pero 2000-12-20 17:00:32 +00:00
parent b9ee49fb74
commit 6455046227
4 changed files with 2138 additions and 2118 deletions

View file

@ -1,16 +1,18 @@
/*
/* -*-objc-*-
NSText.h
The text object
Copyright (C) 1996 Free Software Foundation, Inc.
Author: Scott Christley <scottc@net-community.com>
Author: Scott Christley <scottc@net-community.com>
Date: 1996
Author: Felipe A. Rodriguez <far@ix.netcom.com>
Author: Felipe A. Rodriguez <far@ix.netcom.com>
Date: July 1998
Author: Daniel Bðhringer <boehring@biomed.ruhr-uni-bochum.de>
Author: Daniel Bðhringer <boehring@biomed.ruhr-uni-bochum.de>
Date: August 1998
Author: Nicola Pero <n.pero@mi.flashnet.it>
Date: December 2000
This file is part of the GNUstep GUI Library.
@ -43,12 +45,17 @@
* methods that a text editing object should have; it has ivars to
* track the various options (editable, selectable, background color
* etc) and implementations for methods setting and getting these
* generic options and for quite some helper methods which are simple
* generic options and for some helper methods which are simple
* wrappers around the real basic editing methods. The real editing
* methods are not implemented in NSText, which is why it is abstract.
* To make a working subclass, you need to implement these methods.
* */
* The working subclass could potentially be implemented in absolutely
* *any* way you want. I have been told that some versions of Emacs
* can be embedded as an X subwindow inside alien widgets and windows
* - so yes, potentially if you are able to figure out how to embed
* Emacs inside the GNUstep NSView tree, you can write a subclass
* of NSText which just uses Emacs. */
#include <AppKit/NSView.h>
#include <AppKit/NSSpellProtocol.h>
#include <Foundation/NSRange.h>
@ -58,9 +65,6 @@
@class NSNotification;
@class NSColor;
@class NSFont;
@class NSTextStorage;
@class NSTextContainer;
@class NSLayoutManager;
typedef enum _NSTextAlignment {
NSLeftTextAlignment = 0,
@ -96,31 +100,9 @@ enum {
#include <AppKit/NSStringDrawing.h>
// these definitions should migrate to NSTextView when implemented
typedef enum _NSSelectionGranularity {
NSSelectByCharacter = 0,
NSSelectByWord = 1,
NSSelectByParagraph = 2,
} NSSelectionGranularity;
#ifndef NO_GNUSTEP
typedef enum _NSSelectionAffinity {
NSSelectionAffinityUpstream = 0,
NSSelectionAffinityDownstream = 1,
} NSSelectionAffinity;
#endif
@interface NSText : NSView <NSChangeSpelling,NSIgnoreMisspelledWords>
@interface NSText : NSView <NSChangeSpelling, NSIgnoreMisspelledWords>
{
id _delegate;
// content
NSTextStorage *_textStorage;
NSTextContainer *_textContainer;
// contains layout information
NSLayoutManager *_layoutManager;
// Attributes
struct GSTextFlagsType {
unsigned is_field_editor: 1;
unsigned is_editable: 1;
@ -134,37 +116,31 @@ typedef enum _NSSelectionAffinity {
unsigned uses_ruler: 1;
unsigned is_ruler_visible: 1;
} _tf;
NSMutableDictionary *_typingAttributes;
NSColor *_background_color;
NSRange _selected_range;
NSColor *_caret_color;
NSSize _minSize;
NSSize _maxSize;
int _spellCheckerDocumentTag;
// column-stable cursor up/down
NSPoint _currentCursor;
}
/*
* Getting and Setting Contents */
- (void) replaceCharactersInRange: (NSRange)aRange
* Getting and Setting Contents
*/
- (void) replaceCharactersInRange: (NSRange)aRange
withRTF: (NSData*)rtfData;
- (void) replaceCharactersInRange: (NSRange)aRange
- (void) replaceCharactersInRange: (NSRange)aRange
withRTFD: (NSData*)rtfdData;
- (void) replaceCharactersInRange: (NSRange)aRange
- (void) replaceCharactersInRange: (NSRange)aRange
withString: (NSString*)aString;
- (void) setString: (NSString*)string;
- (NSString*) string;
// old fashioned
- (void) replaceRange: (NSRange)range withString: (NSString*)aString;
- (void) replaceRange: (NSRange)range withRTF: (NSData*)rtfData;
- (void) replaceRange: (NSRange)range withRTFD: (NSData*)rtfdData;
/*
* Old fashioned OpenStep methods (wrappers for the previous ones)
*/
- (void) replaceRange: (NSRange)range withString: (NSString*)aString;
- (void) replaceRange: (NSRange)range withRTF: (NSData*)rtfData;
- (void) replaceRange: (NSRange)range withRTFD: (NSData*)rtfdData;
- (void) setText: (NSString*)string;
- (void) setText: (NSString*)aString
range: (NSRange)aRange;
- (void) setText: (NSString*)aString range: (NSRange)aRange;
- (NSString*) text;
/*
@ -175,7 +151,6 @@ typedef enum _NSSelectionAffinity {
- (void) setBackgroundColor: (NSColor*)color;
- (void) setDrawsBackground: (BOOL)flag;
/*
* Managing Global Characteristics
*/
@ -309,59 +284,11 @@ typedef enum _NSSelectionAffinity {
- (void) ignoreSpelling: (id)sender;
@end
@interface NSText (GNUstepExtensions)
@interface NSText(NSTextView)
// Methods that should be declared on NSTextView, but are usable for NSText
- (NSTextContainer *)textContainer;
- (NSPoint)textContainerOrigin;
- (NSSize) textContainerInset;
- (void) setRulerVisible: (BOOL)flag;
- (NSRange)rangeForUserTextChange;
- (NSRange)rangeForUserCharacterAttributeChange;
- (NSRange)rangeForUserParagraphAttributeChange;
- (BOOL)shouldChangeTextInRange:(NSRange)affectedCharRange
replacementString:(NSString *)replacementString;
- (void)didChangeText;
- (void) setAlignment: (NSTextAlignment)alignment
range: (NSRange)aRange;
- (int) spellCheckerDocumentTag;
// changed to only except class NSString
- (void) insertText: (NSString*)insertString;
- (NSMutableDictionary*) typingAttributes;
- (void) setTypingAttributes: (NSDictionary*)attrs;
- (void) updateFontPanel;
- (BOOL) shouldDrawInsertionPoint;
- (void) drawInsertionPointInRect: (NSRect)rect
color: (NSColor*)color
turnedOn: (BOOL)flag;
// override if you want special cursor behaviour
- (NSRange) selectionRangeForProposedRange: (NSRange)proposedCharRange
granularity: (NSSelectionGranularity)granularity;
- (NSString *)preferredPasteboardTypeFromArray:(NSArray *)availableTypes
restrictedToTypesFromArray:(NSArray *)allowedTypes;
- (BOOL)readSelectionFromPasteboard:(NSPasteboard *)pboard;
- (BOOL)readSelectionFromPasteboard:(NSPasteboard *)pboard type:(NSString *)type;
- (NSArray *)readablePasteboardTypes;
- (NSArray *)writablePasteboardTypes;
- (BOOL)writeSelectionToPasteboard:(NSPasteboard *)pboard type:(NSString *)type;
- (BOOL)writeSelectionToPasteboard:(NSPasteboard *)pboard types:(NSArray *)types;
@end
@interface NSText(GNUstepExtension)
// GNU extension
- (void) replaceRange: (NSRange)range
withAttributedString: (NSAttributedString*)attrString;
- (unsigned) textLength;
@end
@ -371,27 +298,13 @@ extern NSString *NSTextDidBeginEditingNotification;
extern NSString *NSTextDidEndEditingNotification;
extern NSString *NSTextDidChangeNotification;
#ifdef GNUSTEP
@interface NSObject(NSTextDelegate)
@interface NSObject (NSTextDelegate)
- (BOOL) textShouldBeginEditing: (NSText*)textObject; /* YES means do it */
- (BOOL) textShouldEndEditing: (NSText*)textObject; /* YES means do it */
- (void) textDidBeginEditing: (NSNotification*)notification;
- (void) textDidEndEditing: (NSNotification*)notification;
- (void) textDidChange: (NSNotification*)notification; /* Any keyDown or paste which changes the contents causes this */
@end
#endif
#endif // _GNUstep_H_NSText
#if 0
NSFontAttributeName; /* NSFont, default Helvetica 12 */
-> NSParagraphStyleAttributeName; /* NSParagraphStyle, default defaultParagraphStyle */
NSForegroundColorAttributeName; /* NSColor, default blackColor */
NSUnderlineStyleAttributeName; /* int, default 0: no underline */
NSSuperscriptAttributeName; /* int, default 0 */
NSBackgroundColorAttributeName; /* NSColor, default nil: no background */
-> NSAttachmentAttributeName; /* NSTextAttachment, default nil */
NSLigatureAttributeName; /* int, default 1: default ligatures, 0: no ligatures, 2: all ligatures */
NSBaselineOffsetAttributeName; /* float, in points; offset from baseline, default 0 */
NSKernAttributeName; /* float, amount to modify default kerning, if 0, kerning off */
#endif

View file

@ -1,12 +1,15 @@
/* -*-objc-*-
NSTextView.h
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
Author: Fred Kiefer <FredKiefer@gmx.de>
Date: September 2000
Reformatted and cleaned up.
Author: Nicola Pero <n.pero@mi.flashnet.it>
Date: December 2000
This file is part of the GNUstep GUI Library.
This library is free software; you can redistribute it and/or
@ -37,6 +40,20 @@
@class NSTextStorage;
@class NSLayoutManager;
// these definitions should migrate to NSTextView when implemented
typedef enum _NSSelectionGranularity {
NSSelectByCharacter = 0,
NSSelectByWord = 1,
NSSelectByParagraph = 2,
} NSSelectionGranularity;
#ifndef NO_GNUSTEP
typedef enum _NSSelectionAffinity {
NSSelectionAffinityUpstream = 0,
NSSelectionAffinityDownstream = 1,
} NSSelectionAffinity;
#endif
@interface NSTextView : NSText //<NSTextInput>
{
struct GSTextViewFlagsType {
@ -64,6 +81,21 @@
it is the firstTextView returned by the layout manager - which
might or might not be `self'. This must *not* be retained. */
NSTextView *_notifObject;
/* content */
NSTextStorage *_textStorage;
NSTextContainer *_textContainer;
/* manages layout information */
NSLayoutManager *_layoutManager;
NSMutableDictionary *_typingAttributes;
NSRange _selected_range;
NSColor *_caret_color;
int _spellCheckerDocumentTag;
/* column-stable cursor up/down */
NSPoint _currentCursor;
NSSize _textContainerInset;
NSPoint _textContainerOrigin;
@ -79,7 +111,8 @@
// This is sent each time a view is initialized. If you subclass you
//should ensure that you only register once.
- (id)initWithFrame:(NSRect)frameRect textContainer:(NSTextContainer *)container;
- (id)initWithFrame:(NSRect)frameRect
textContainer:(NSTextContainer *)container;
// Designated Initializer. container may be nil.
- (id)initWithFrame:(NSRect)frameRect;
@ -90,211 +123,235 @@
-(NSTextContainer*) textContainer;
-(void)setTextContainer:(NSTextContainer*) container;
// The set method should not be called directly, but you might want to override
// it. Gets or sets the text container for this view. Setting the text container
// marks the view as needing display. The text container calls the set method
// from its setTextView: method.
// The set method should not be called directly, but you might want to
// override it. Gets or sets the text container for this view.
// Setting the text container marks the view as needing display. The
// text container calls the set method from its setTextView: method.
- (void)replaceTextContainer:(NSTextContainer *)newContainer;
// This method should be used instead of the primitive -setTextContainer: if you
// need to replace a view's text container with a new one leaving the rest of the
// web intact. This method deals with all the work of making sure the view doesn't
// get deallocated and removing the old container from the layoutManager and
// replacing it with the new one.
// This method should be used instead of the primitive
// -setTextContainer: if you need to replace a view's text container
// with a new one leaving the rest of the web intact. This method
// deals with all the work of making sure the view doesn't get
// deallocated and removing the old container from the layoutManager
// and replacing it with the new one.
- (void)setTextContainerInset:(NSSize)inset;
- (NSSize)textContainerInset;
// The textContianerInset determines the padding that the view provides around the
// container. The container's origin will be inset by this amount from the bounds
// point {0,0} and padding will be left to the right and below the container of
// the same amount. This inset affects the view sizing in response to new layout
// and is used by the rectangular text containers when they track the view's frame
// dimensions.
// The textContianerInset determines the padding that the view
// provides around the container. The container's origin will be
// inset by this amount from the bounds point {0,0} and padding will
// be left to the right and below the container of the same amount.
// This inset affects the view sizing in response to new layout and is
// used by the rectangular text containers when they track the view's
// frame dimensions.
- (NSPoint)textContainerOrigin;
- (void)invalidateTextContainerOrigin;
// The container's origin in the view is determined from the current usage of the
// container, the container inset, and the view size. textContainerOrigin returns
// this point. invalidateTextContainerOrigin is sent automatically whenever
// something changes that causes the origin to possibly move. You usually do not
// need to call invalidate yourself.
// The container's origin in the view is determined from the current
// usage of the container, the container inset, and the view size.
// textContainerOrigin returns this point.
// invalidateTextContainerOrigin is sent automatically whenever
// something changes that causes the origin to possibly move. You
// usually do not need to call invalidate yourself.
- (NSLayoutManager *)layoutManager;
- (NSTextStorage *)textStorage;
- (NSLayoutManager *) layoutManager;
- (NSTextStorage *) textStorage;
// Convenience methods
/************************* Key binding entry-point *************************/
- (void)insertText:(NSString *)insertString;
// This method is the funnel point for text insertion after keys pass through the key binder.
- (void) insertText: (NSString *)insertString;
// This method is the funnel point for text insertion after keys pass
// through the key binder.
/*************************** Sizing methods ***************************/
- (void)setConstrainedFrameSize:(NSSize)desiredSize;
// Sets the frame size of the view to desiredSize constrained within min and max size.
- (void) setConstrainedFrameSize: (NSSize)desiredSize;
// Sets the frame size of the view to desiredSize constrained within
// min and max size.
/***************** New miscellaneous API above and beyond NSText *****************/
- (void)changeColor:(id)sender;
- (void) changeColor: (id)sender;
// Called from NSColorPanel to set the text colour of the selection
- (void)alignJustified:(id)sender;
- (void)setAlignment:(NSTextAlignment)alignment range:(NSRange)range;
// These complete the set of range: type set methods. to be equivalent to the set
// of non-range taking varieties.
- (void) alignJustified: (id)sender;
- (void) setAlignment: (NSTextAlignment)alignment range: (NSRange)range;
// These complete the set of range: type set methods. to be equivalent
// to the set of non-range taking varieties.
- (void)pasteAsPlainText:(id)sender;
- (void)pasteAsRichText:(id)sender;
// These methods are like paste: (from NSResponder) but they restrict the acceptable
// type of the pasted data. They are suitable as menu actions for appropriate
// "Paste As" submenu commands.
- (void) pasteAsPlainText: (id)sender;
- (void) pasteAsRichText: (id)sender;
// These methods are like paste: (from NSResponder) but they restrict
// the acceptable type of the pasted data. They are suitable as menu
// actions for appropriate "Paste As" submenu commands.
/*************************** New Font menu commands ***************************/
- (void)turnOffKerning:(id)sender;
- (void)tightenKerning:(id)sender;
- (void)loosenKerning:(id)sender;
- (void)useStandardKerning:(id)sender;
- (void)turnOffLigatures:(id)sender;
- (void)useStandardLigatures:(id)sender;
- (void)useAllLigatures:(id)sender;
- (void)raiseBaseline:(id)sender;
- (void)lowerBaseline:(id)sender;
- (void) turnOffKerning: (id)sender;
- (void) tightenKerning: (id)sender;
- (void) loosenKerning: (id)sender;
- (void) useStandardKerning: (id)sender;
- (void) turnOffLigatures: (id)sender;
- (void) useStandardLigatures: (id)sender;
- (void) useAllLigatures: (id)sender;
- (void) raiseBaseline: (id)sender;
- (void) lowerBaseline: (id)sender;
/*************************** Ruler support ***************************/
- (void)rulerView:(NSRulerView *)ruler didMoveMarker:(NSRulerMarker *)marker;
- (void)rulerView:(NSRulerView *)ruler didRemoveMarker:(NSRulerMarker *)marker;
- (void)rulerView:(NSRulerView *)ruler didAddMarker:(NSRulerMarker *)marker;
- (BOOL)rulerView:(NSRulerView *)ruler shouldMoveMarker:(NSRulerMarker *)marker;
- (BOOL)rulerView:(NSRulerView *)ruler shouldAddMarker:(NSRulerMarker *)marker;
- (float)rulerView:(NSRulerView *)ruler willMoveMarker:(NSRulerMarker *)marker
toLocation:(float)location;
- (BOOL)rulerView:(NSRulerView *)ruler shouldRemoveMarker:(NSRulerMarker *)marker;
- (float)rulerView:(NSRulerView *)ruler willAddMarker:(NSRulerMarker *)marker
atLocation:(float)location;
- (void)rulerView:(NSRulerView *)ruler handleMouseDown:(NSEvent *)event;
- (void) setRulerVisible: (BOOL)flag;
- (void) rulerView: (NSRulerView *)ruler
didMoveMarker: (NSRulerMarker *)marker;
- (void) rulerView: (NSRulerView *)ruler
didRemoveMarker: (NSRulerMarker *)marker;
- (void) rulerView: (NSRulerView *)ruler
didAddMarker: (NSRulerMarker *)marker;
- (BOOL) rulerView: (NSRulerView *)ruler
shouldMoveMarker: (NSRulerMarker *)marker;
- (BOOL) rulerView: (NSRulerView *)ruler
shouldAddMarker: (NSRulerMarker *)marker;
- (float) rulerView: (NSRulerView *)ruler
willMoveMarker: (NSRulerMarker *)marker
toLocation: (float)location;
- (BOOL) rulerView: (NSRulerView *)ruler
shouldRemoveMarker: (NSRulerMarker *)marker;
- (float) rulerView: (NSRulerView *)ruler
willAddMarker: (NSRulerMarker *)marker
atLocation: (float)location;
- (void) rulerView: (NSRulerView *)ruler
handleMouseDown: (NSEvent *)event;
/*************************** Fine display control ***************************/
- (void)setNeedsDisplayInRect:(NSRect)rect avoidAdditionalLayout:(BOOL)flag;
- (void) setNeedsDisplayInRect: (NSRect)rect
avoidAdditionalLayout: (BOOL)flag;
- (BOOL)shouldDrawInsertionPoint;
- (void)drawInsertionPointInRect:(NSRect)rect color:(NSColor *)color turnedOn:(BOOL)flag;
- (void)cleanUpAfterDragOperation;
- (BOOL) shouldDrawInsertionPoint;
- (void) drawInsertionPointInRect: (NSRect)rect color: (NSColor *)color
turnedOn: (BOOL)flag;
- (void) cleanUpAfterDragOperation;
/*************************** Pasteboard management ***************************/
- (NSString *)preferredPasteboardTypeFromArray:(NSArray *)availableTypes
restrictedToTypesFromArray:(NSArray *)allowedTypes;
- (BOOL)readSelectionFromPasteboard:(NSPasteboard *)pboard;
- (BOOL)readSelectionFromPasteboard:(NSPasteboard *)pboard type:(NSString *)type;
- (NSArray *)readablePasteboardTypes;
- (NSArray *)writablePasteboardTypes;
- (BOOL)writeSelectionToPasteboard:(NSPasteboard *)pboard type:(NSString *)type;
- (BOOL)writeSelectionToPasteboard:(NSPasteboard *)pboard types:(NSArray *)types;
- (NSString *) preferredPasteboardTypeFromArray: (NSArray *)availableTypes
restrictedToTypesFromArray: (NSArray *)allowedTypes;
- (BOOL) readSelectionFromPasteboard: (NSPasteboard *)pboard;
- (BOOL) readSelectionFromPasteboard: (NSPasteboard *)pboard
type: (NSString *)type;
- (NSArray *) readablePasteboardTypes;
- (NSArray *) writablePasteboardTypes;
- (BOOL) writeSelectionToPasteboard: (NSPasteboard *)pboard
type: (NSString *)type;
- (BOOL) writeSelectionToPasteboard: (NSPasteboard *)pboard
types: (NSArray *)types;
/*************************** Especially for subclassers ***************************/
- (void)updateRuler;
- (void)updateFontPanel;
- (void) updateRuler;
- (void) updateFontPanel;
- (NSArray *)acceptableDragTypes;
- (void)updateDragTypeRegistration;
- (NSArray *) acceptableDragTypes;
- (void) updateDragTypeRegistration;
- (NSRange) selectionRangeForProposedRange: (NSRange)proposedCharRange
granularity: (NSSelectionGranularity)gr;
- (NSRange)selectionRangeForProposedRange:(NSRange)proposedCharRange
granularity:(NSSelectionGranularity)granularity;
@end
@interface NSTextView (NSSharing)
// The methods in this category deal with settings that need to be shared by all
// the GNUTextViews of a single NSLayoutManager. Many of these methods are overrides
// of NSText or NSResponder methods.
// The methods in this category deal with settings that need to be
// shared by all the GNUTextViews of a single NSLayoutManager. Many
// of these methods are overrides of NSText or NSResponder methods.
/*************************** Selected/Marked range ***************************/
- (void)setSelectedRange:(NSRange)charRange affinity:(NSSelectionAffinity)affinity
stillSelecting:(BOOL)stillSelectingFlag;
- (NSSelectionAffinity)selectionAffinity;
- (NSSelectionGranularity)selectionGranularity;
- (void)setSelectionGranularity:(NSSelectionGranularity)granularity;
- (void) setSelectedRange: (NSRange)charRange
affinity: (NSSelectionAffinity)affinity
stillSelecting: (BOOL)stillSelectingFlag;
- (NSSelectionAffinity) selectionAffinity;
- (NSSelectionGranularity) selectionGranularity;
- (void) setSelectionGranularity: (NSSelectionGranularity)granularity;
- (void)setSelectedTextAttributes:(NSDictionary *)attributeDictionary;
- (NSDictionary *)selectedTextAttributes;
- (void) setSelectedTextAttributes: (NSDictionary *)attributeDictionary;
- (NSDictionary *) selectedTextAttributes;
- (void)setInsertionPointColor:(NSColor *)color;
- (NSColor *)insertionPointColor;
- (void) setInsertionPointColor: (NSColor *)color;
- (NSColor *) insertionPointColor;
- (void)updateInsertionPointStateAndRestartTimer:(BOOL)restartFlag;
- (void) updateInsertionPointStateAndRestartTimer: (BOOL)restartFlag;
- (NSRange)markedRange;
- (NSRange) markedRange;
- (void)setMarkedTextAttributes:(NSDictionary *)attributeDictionary;
- (NSDictionary *)markedTextAttributes;
- (void) setMarkedTextAttributes: (NSDictionary *)attributeDictionary;
- (NSDictionary *) markedTextAttributes;
/*************************** Other GNUTextView methods ***************************/
- (void)setRulerVisible:(BOOL)flag;
- (BOOL)usesRuler;
- (void)setUsesRuler:(BOOL)flag;
- (void) setRulerVisible: (BOOL)flag;
- (BOOL) usesRuler;
- (void) setUsesRuler: (BOOL)flag;
- (int)spellCheckerDocumentTag;
- (int) spellCheckerDocumentTag;
- (NSDictionary *)typingAttributes;
- (void)setTypingAttributes:(NSDictionary *)attrs;
- (NSDictionary *) typingAttributes;
- (void) setTypingAttributes: (NSDictionary *)attrs;
- (BOOL)shouldChangeTextInRange:(NSRange)affectedCharRange
replacementString:(NSString *)replacementString;
- (void)didChangeText;
- (BOOL) shouldChangeTextInRange: (NSRange)affectedCharRange
replacementString: (NSString *)replacementString;
- (void) didChangeText;
- (NSRange)rangeForUserTextChange;
- (NSRange)rangeForUserCharacterAttributeChange;
- (NSRange)rangeForUserParagraphAttributeChange;
- (NSRange) rangeForUserTextChange;
- (NSRange) rangeForUserCharacterAttributeChange;
- (NSRange) rangeForUserParagraphAttributeChange;
- (BOOL)allowsUndo;
- (void)setAllowsUndo:(BOOL)flag;
- (BOOL) allowsUndo;
- (void) setAllowsUndo: (BOOL)flag;
/*************************** NSText methods ***************************/
- (BOOL)isSelectable;
- (void)setSelectable:(BOOL)flag;
- (BOOL)isEditable;
- (void)setEditable:(BOOL)flag;
- (BOOL)isRichText;
- (void)setRichText:(BOOL)flag;
- (BOOL)importsGraphics;
- (void)setImportsGraphics:(BOOL)flag;
- (id)delegate;
- (void)setDelegate:(id)anObject;
- (BOOL)isFieldEditor;
- (void)setFieldEditor:(BOOL)flag;
- (BOOL)usesFontPanel;
- (void)setUsesFontPanel:(BOOL)flag;
- (BOOL)isRulerVisible;
- (void)setBackgroundColor:(NSColor *)color;
- (NSColor *)backgroundColor;
- (void)setDrawsBackground:(BOOL)flag;
- (BOOL)drawsBackground;
- (BOOL) isSelectable;
- (void) setSelectable:(BOOL)flag;
- (BOOL) isEditable;
- (void) setEditable:(BOOL)flag;
- (BOOL) isRichText;
- (void) setRichText:(BOOL)flag;
- (BOOL) importsGraphics;
- (void) setImportsGraphics:(BOOL)flag;
- (id) delegate;
- (void) setDelegate:(id)anObject;
- (BOOL) isFieldEditor;
- (void) setFieldEditor:(BOOL)flag;
- (BOOL) usesFontPanel;
- (void) setUsesFontPanel:(BOOL)flag;
- (BOOL) isRulerVisible;
- (void) setBackgroundColor:(NSColor *)color;
- (NSColor *) backgroundColor;
- (void) setDrawsBackground:(BOOL)flag;
- (BOOL) drawsBackground;
//- (NSRange)selectedRange;
- (void)setSelectedRange:(NSRange)charRange;
- (NSRange) selectedRange;
- (void) setSelectedRange:(NSRange)charRange;
/*************************** NSResponder methods ***************************/
- (BOOL)resignFirstResponder;
- (BOOL)becomeFirstResponder;
- (id)validRequestorForSendType:(NSString *)sendType
returnType:(NSString *)returnType;
- (BOOL) resignFirstResponder;
- (BOOL) becomeFirstResponder;
- (id) validRequestorForSendType:(NSString *)sendType
returnType:(NSString *)returnType;
/*************************** Smart copy/paste/delete support ***************************/
- (BOOL)smartInsertDeleteEnabled;
- (void)setSmartInsertDeleteEnabled:(BOOL)flag;
- (NSRange)smartDeleteRangeForProposedRange:(NSRange)proposedCharRange;
- (void)smartInsertForString:(NSString *)aString
replacingRange:(NSRange)charRange
beforeString:(NSString **)beforeString
afterString:(NSString **)afterString;
- (BOOL) smartInsertDeleteEnabled;
- (void) setSmartInsertDeleteEnabled: (BOOL)flag;
- (NSRange) smartDeleteRangeForProposedRange: (NSRange)proposedCharRange;
- (void) smartInsertForString: (NSString *)aString
replacingRange: (NSRange)charRange
beforeString: (NSString **)beforeString
afterString: (NSString **)afterString;
@end
@interface NSTextView (GSTextViewUpdateMultipleViews)
@ -310,61 +367,77 @@
@interface NSObject (NSTextViewDelegate)
- (void)textView:(NSTextView *)textView
clickedOnCell:(id <NSTextAttachmentCell>)cell
inRect:(NSRect)cellFrame;
- (void)textView:(NSTextView *)textView
clickedOnCell:(id <NSTextAttachmentCell>)cell
inRect:(NSRect)cellFrame
atIndex:(unsigned)charIndex;
- (void) textView: (NSTextView *)textView
clickedOnCell: (id <NSTextAttachmentCell>)cell
inRect: (NSRect)cellFrame;
- (void) textView: (NSTextView *)textView
clickedOnCell: (id <NSTextAttachmentCell>)cell
inRect: (NSRect)cellFrame
atIndex: (unsigned)charIndex;
- (BOOL)textView:(NSTextView *)textView clickedOnLink:(id)link;
- (BOOL)textView:(NSTextView *)textView
clickedOnLink:(id)link
atIndex:(unsigned)charIndex;
- (BOOL) textView: (NSTextView *)textView clickedOnLink: (id)link;
- (BOOL) textView: (NSTextView *)textView
clickedOnLink: (id)link
atIndex: (unsigned)charIndex;
- (void)textView:(NSTextView *)textView
doubleClickedOnCell:(id <NSTextAttachmentCell>)cell
inRect:(NSRect)cellFrame;
- (void)textView:(NSTextView *)textView
doubleClickedOnCell:(id <NSTextAttachmentCell>)cell
inRect:(NSRect)cellFrame
atIndex:(unsigned)charIndex;
- (void) textView: (NSTextView *)textView
doubleClickedOnCell: (id <NSTextAttachmentCell>)cell
inRect: (NSRect)cellFrame;
- (void) textView: (NSTextView *)textView
doubleClickedOnCell: (id <NSTextAttachmentCell>)cell
inRect: (NSRect)cellFrame
atIndex: (unsigned)charIndex;
- (void)textView:(NSTextView *)view
draggedCell:(id <NSTextAttachmentCell>)cell
inRect:(NSRect)rect event:(NSEvent *)event;
- (void)textView:(NSTextView *)view
draggedCell:(id <NSTextAttachmentCell>)cell
inRect:(NSRect)rect
event:(NSEvent *)event
atIndex:(unsigned)charIndex;
- (void) textView: (NSTextView *)view
draggedCell: (id <NSTextAttachmentCell>)cell
inRect: (NSRect)rect event:(NSEvent *)event;
- (void) textView: (NSTextView *)view
draggedCell: (id <NSTextAttachmentCell>)cell
inRect: (NSRect)rect
event: (NSEvent *)event
atIndex: (unsigned)charIndex;
- (NSRange)textView:(NSTextView *)textView
willChangeSelectionFromCharacterRange:(NSRange)oldSelectedCharRange
toCharacterRange:(NSRange)newSelectedCharRange;
- (NSRange) textView: (NSTextView *)textView
willChangeSelectionFromCharacterRange: (NSRange)oldSelectedCharRange
toCharacterRange: (NSRange)newSelectedCharRange;
- (void)textViewDidChangeSelection:(NSNotification *)notification;
- (void) textViewDidChangeSelection: (NSNotification *)notification;
- (BOOL)textView:(NSTextView *)textView
shouldChangeTextInRange:(NSRange)affectedCharRange
replacementString:(NSString *)replacementString;
// If characters are changing, replacementString is what will replace the
// affectedCharRange. If attributes only are changing, replacementString will be nil.
- (BOOL) textView: (NSTextView *)textView
shouldChangeTextInRange: (NSRange)affectedCharRange
replacementString: (NSString *)replacementString;
// If characters are changing, replacementString is what will replace
// the affectedCharRange. If attributes only are changing,
// replacementString will be nil.
- (BOOL)textView:(NSTextView *)textView
doCommandBySelector:(SEL)commandSelector;
- (BOOL) textView: (NSTextView *)textView
doCommandBySelector: (SEL)commandSelector;
- (NSUndoManager *)undoManagerForTextView:(NSTextView *)view;
- (NSUndoManager *) undoManagerForTextView: (NSTextView *)view;
@end
extern NSString *NSTextViewWillChangeNotifyingTextViewNotification;
// NSOldNotifyingTextView -> the old view, NSNewNotifyingTextView -> the new view.
// The text view delegate is not automatically registered to receive this notification
// because the text machinery will automatically switch over the delegate to observe
// the new first text view as the first text view changes.
// NSOldNotifyingTextView -> the old view, NSNewNotifyingTextView ->
// the new view. The text view delegate is not automatically
// registered to receive this notification because the text machinery
// will automatically switch over the delegate to observe the new
// first text view as the first text view changes.
extern NSString *NSTextViewDidChangeSelectionNotification;
// NSOldSelectedCharacterRange -> NSValue with old range.
#endif /* _GNUstep_H_NSTextView */
#if 0
NSFontAttributeName; /* NSFont, default Helvetica 12 */
-> NSParagraphStyleAttributeName; /* NSParagraphStyle, default defaultParagraphStyle */
NSForegroundColorAttributeName; /* NSColor, default blackColor */
NSUnderlineStyleAttributeName; /* int, default 0: no underline */
NSSuperscriptAttributeName; /* int, default 0 */
NSBackgroundColorAttributeName; /* NSColor, default nil: no background */
-> NSAttachmentAttributeName; /* NSTextAttachment, default nil */
NSLigatureAttributeName; /* int, default 1: default ligatures, 0: no ligatures, 2: all ligatures */
NSBaselineOffsetAttributeName; /* float, in points; offset from baseline, default 0 */
NSKernAttributeName; /* float, amount to modify default kerning, if 0, kerning off */
#endif

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff