home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2 / Openstep-4.2-Intel-Developer.iso / NextLibrary / Frameworks / AppKit.framework / Versions / B / Headers / NSText.h < prev    next >
Text File  |  1996-10-17  |  4KB  |  140 lines

  1. /*
  2.     NSText.h
  3.     Application Kit
  4.     Copyright (c) 1994-1996, NeXT Software, Inc.
  5.     All rights reserved.
  6. */
  7.  
  8. #import <AppKit/NSView.h>
  9. #import <AppKit/NSSpellProtocol.h>
  10. #import <AppKit/AppKitDefines.h>
  11.  
  12. @class NSColor;
  13. @class NSFont;
  14.  
  15. typedef enum _NSTextAlignment {
  16.     NSLeftTextAlignment        = 0, /* Visually left aligned */
  17.     NSRightTextAlignment    = 1, /* Visually right aligned */
  18.     NSCenterTextAlignment    = 2,
  19.     NSJustifiedTextAlignment    = 3,
  20.     NSNaturalTextAlignment    = 4  /* Indicates the default alignment for script */
  21. } NSTextAlignment;
  22.  
  23. /* Movement codes for movement between fields; these codes are the intValue of the NSTextMovement key in NSTextDidEndEditing notifications
  24. */
  25. enum {
  26.     NSIllegalTextMovement        = 0,
  27.     NSReturnTextMovement        = 0x10,
  28.     NSTabTextMovement            = 0x11,
  29.     NSBacktabTextMovement        = 0x12,
  30.     NSLeftTextMovement            = 0x13,
  31.     NSRightTextMovement            = 0x14,
  32.     NSUpTextMovement            = 0x15,
  33.     NSDownTextMovement            = 0x16
  34. };
  35.  
  36.  
  37. @interface NSText : NSView <NSChangeSpelling, NSIgnoreMisspelledWords> {
  38.     void *_ivars;
  39. }
  40.  
  41. - (NSString *)string;
  42. - (void)setString:(NSString *)string;
  43.  
  44. - (void)replaceCharactersInRange:(NSRange)range withString:(NSString *)aString;
  45. - (void)replaceCharactersInRange:(NSRange)range withRTF:(NSData *)rtfData;
  46. - (void)replaceCharactersInRange:(NSRange)range withRTFD:(NSData *)rtfdData;
  47.  
  48. - (NSData *)RTFFromRange:(NSRange)range;
  49. - (NSData *)RTFDFromRange:(NSRange)range;
  50.  
  51. - (BOOL)writeRTFDToFile:(NSString *)path atomically:(BOOL)flag;
  52. - (BOOL)readRTFDFromFile:(NSString *)path;
  53.  
  54. - (id)delegate;
  55. - (void)setDelegate:(id)anObject;
  56.  
  57. - (BOOL)isEditable;
  58. - (void)setEditable:(BOOL)flag;
  59. - (BOOL)isSelectable;
  60. - (void)setSelectable:(BOOL)flag;
  61. - (BOOL)isRichText;
  62. - (void)setRichText:(BOOL)flag;        /* If NO, also clears setImportsGraphics: */
  63. - (BOOL)importsGraphics;
  64. - (void)setImportsGraphics:(BOOL)flag;    /* If YES, also sets setRichText: */
  65. - (void)setBackgroundColor:(NSColor *)color;
  66. - (NSColor *)backgroundColor;
  67. - (void)setDrawsBackground:(BOOL)flag;
  68. - (BOOL)drawsBackground;
  69.  
  70. - (void)setFont:(NSFont *)obj;
  71. - (NSFont *)font;
  72. - (void)setTextColor:(NSColor *)color;
  73. - (NSColor *)textColor;
  74. - (NSTextAlignment)alignment;
  75. - (void)setAlignment:(NSTextAlignment)mode;
  76.  
  77. - (void)setFieldEditor:(BOOL)flag; /* A BOOL to indicate whether to end on CR, TAB, etc */
  78. - (BOOL)isFieldEditor;
  79.  
  80. - (void)setTextColor:(NSColor *)color range:(NSRange)range;
  81. - (void)setFont:(NSFont *)font range:(NSRange)range;
  82.  
  83. - (BOOL)usesFontPanel;
  84. - (void)setUsesFontPanel:(BOOL)flag;
  85.  
  86. - (NSSize)maxSize;
  87. - (void)setMaxSize:(NSSize)newMaxSize;
  88. - (NSSize)minSize;
  89. - (void)setMinSize:(NSSize)newMinSize;
  90.  
  91. - (BOOL)isHorizontallyResizable;
  92. - (void)setHorizontallyResizable:(BOOL)flag;
  93. - (BOOL)isVerticallyResizable;
  94. - (void)setVerticallyResizable:(BOOL)flag;
  95.  
  96. - (void)sizeToFit;
  97.  
  98. - (void)copy:(id)sender;
  99. - (void)copyFont:(id)sender;
  100. - (void)copyRuler:(id)sender;
  101. - (void)cut:(id)sender;
  102. - (void)delete:(id)sender;
  103. - (void)paste:(id)sender;
  104. - (void)pasteFont:(id)sender;
  105. - (void)pasteRuler:(id)sender;
  106. - (void)selectAll:(id)sender;
  107. - (void)changeFont:(id)sender;
  108. - (void)alignLeft:(id)sender;
  109. - (void)alignRight:(id)sender;
  110. - (void)alignCenter:(id)sender;
  111. - (void)subscript:(id)sender;
  112. - (void)superscript:(id)sender;
  113. - (void)underline:(id)sender;
  114. - (void)unscript:(id)sender;
  115. - (void)showGuessPanel:(id)sender;
  116. - (void)checkSpelling:(id)sender;
  117. - (void)toggleRuler:(id)sender;
  118.  
  119. - (BOOL)isRulerVisible;
  120.  
  121. - (NSRange)selectedRange;
  122. - (void)setSelectedRange:(NSRange)range;
  123.  
  124. - (void)scrollRangeToVisible:(NSRange)range;
  125.  
  126. @end
  127.  
  128. @interface NSObject(NSTextDelegate)
  129. - (BOOL)textShouldBeginEditing:(NSText *)textObject; /* YES means do it */
  130. - (BOOL)textShouldEndEditing:(NSText *)textObject; /* YES means do it */
  131. - (void)textDidBeginEditing:(NSNotification *)notification;
  132. - (void)textDidEndEditing:(NSNotification *)notification;
  133. - (void)textDidChange:(NSNotification *)notification; /* Any keyDown or paste which changes the contents causes this */
  134. @end
  135.  
  136. /* Notifications */
  137. APPKIT_EXTERN NSString *NSTextDidBeginEditingNotification;
  138. APPKIT_EXTERN NSString *NSTextDidEndEditingNotification;    // userInfo key:  @"NSTextMovement"
  139. APPKIT_EXTERN NSString *NSTextDidChangeNotification;
  140.