1 /* 2 NSResponder.h 3 4 Abstract class which is basis of command and event processing 5 6 Copyright (C) 1996,1999 Free Software Foundation, Inc. 7 8 Author: Scott Christley <scottc@net-community.com> 9 Date: 1996 10 11 This file is part of the GNUstep GUI Library. 12 13 This library is free software; you can redistribute it and/or 14 modify it under the terms of the GNU Lesser General Public 15 License as published by the Free Software Foundation; either 16 version 2 of the License, or (at your option) any later version. 17 18 This library is distributed in the hope that it will be useful, 19 but WITHOUT ANY WARRANTY; without even the implied warranty of 20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 Lesser General Public License for more details. 22 23 You should have received a copy of the GNU Lesser General Public 24 License along with this library; see the file COPYING.LIB. 25 If not, see <http://www.gnu.org/licenses/> or write to the 26 Free Software Foundation, 51 Franklin Street, Fifth Floor, 27 Boston, MA 02110-1301, USA. 28 */ 29 30 #ifndef _GNUstep_H_NSResponder 31 #define _GNUstep_H_NSResponder 32 #import <GNUstepBase/GSVersionMacros.h> 33 34 #import <Foundation/NSObject.h> 35 #import <AppKit/NSInterfaceStyle.h> 36 #import <AppKit/AppKitDefines.h> 37 38 @class NSCoder; 39 @class NSError; 40 @class NSString; 41 42 @class NSEvent; 43 @class NSMenu; 44 @class NSUndoManager; 45 @class NSWindow; 46 47 @interface NSResponder : NSObject <NSCoding> 48 { 49 PACKAGE_SCOPE 50 #if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST) 51 NSInterfaceStyle _interface_style; 52 #else 53 int _interface_style; 54 #endif 55 @protected 56 NSResponder *_next_responder; 57 58 /* 59 Due to interface brain-damage, both NSResponder and NSMenuView have -menu 60 and -setMenu: methods, but for different menus. Thus, to prevent (future, 61 there have already been some) problems and confusion, this ivar is 62 private (iow, it can't be accidentally used in NSMenuView). 63 */ 64 @private 65 NSMenu *_menu; 66 } 67 68 /* 69 * Instance methods 70 */ 71 72 /* 73 * Managing the next responder 74 */ 75 - (NSResponder*) nextResponder; 76 - (void) setNextResponder: (NSResponder*)aResponder; 77 78 /* 79 * Determining the first responder 80 */ 81 - (BOOL) acceptsFirstResponder; 82 - (BOOL) becomeFirstResponder; 83 - (BOOL) resignFirstResponder; 84 85 /* 86 * Aid event processing 87 */ 88 - (BOOL) performKeyEquivalent: (NSEvent*)theEvent; 89 - (BOOL) tryToPerform: (SEL)anAction with: (id)anObject; 90 91 /* 92 * Forwarding event messages 93 */ 94 - (void) flagsChanged: (NSEvent*)theEvent; 95 - (void) helpRequested: (NSEvent*)theEvent; 96 - (void) keyDown: (NSEvent*)theEvent; 97 - (void) keyUp: (NSEvent*)theEvent; 98 - (void) mouseDown: (NSEvent*)theEvent; 99 - (void) mouseDragged: (NSEvent*)theEvent; 100 - (void) mouseEntered: (NSEvent*)theEvent; 101 - (void) mouseExited: (NSEvent*)theEvent; 102 - (void) mouseMoved: (NSEvent*)theEvent; 103 - (void) mouseUp: (NSEvent*)theEvent; 104 - (void) noResponderFor: (SEL)eventSelector; 105 #if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST) 106 - (void) otherMouseDown: (NSEvent*)theEvent; 107 - (void) otherMouseDragged: (NSEvent*)theEvent; 108 - (void) otherMouseUp: (NSEvent*)theEvent; 109 #endif 110 - (void) rightMouseDown: (NSEvent*)theEvent; 111 - (void) rightMouseDragged: (NSEvent*)theEvent; 112 - (void) rightMouseUp: (NSEvent*)theEvent; 113 #if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST) 114 - (void) scrollWheel: (NSEvent *)theEvent; 115 #endif 116 117 /* 118 * Services menu support 119 */ 120 - (id) validRequestorForSendType: (NSString*)typeSent 121 returnType: (NSString*)typeReturned; 122 123 /* 124 * NSCoding protocol 125 */ 126 - (void) encodeWithCoder: (NSCoder*)aCoder; 127 - (id) initWithCoder: (NSCoder*)aDecoder; 128 129 #if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST) 130 - (void) interpretKeyEvents: (NSArray*)eventArray; 131 - (BOOL) performMnemonic: (NSString*)aString; 132 - (void) flushBufferedKeyEvents; 133 - (void) doCommandBySelector: (SEL)aSelector; 134 135 /** <p>Tells the receiver to insert the given string. In a text view 136 the text is typically inserted at the insertion point, and replaces 137 any selection. 138 </p><p> 139 Subclasses should override this method. The implementation in 140 NSResponder just sends the message on to the next responder. 141 </p><p> 142 Normally, aString will be an NSString, but in some cases, it might 143 be an NSAttributedString. 144 </p> */ 145 - (void) insertText: (id)aString; 146 - (NSUndoManager*) undoManager; 147 148 /* 149 * Menu 150 */ 151 - (NSMenu*) menu; 152 - (void) setMenu: (NSMenu*)aMenu; 153 154 /* 155 * Setting the interface 156 */ 157 - (NSInterfaceStyle) interfaceStyle; 158 - (void) setInterfaceStyle: (NSInterfaceStyle)aStyle; 159 160 - (BOOL) shouldBeTreatedAsInkEvent: (NSEvent *)theEvent; 161 #endif 162 163 #if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST) 164 - (BOOL)presentError:(NSError *)error; 165 - (void)presentError:(NSError *)error 166 modalForWindow:(NSWindow *)window 167 delegate:(id)delegate 168 didPresentSelector:(SEL)sel 169 contextInfo:(void *)context; 170 - (NSError *)willPresentError:(NSError *)error; 171 #endif 172 173 @end 174 175 #if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST) 176 @interface NSResponder (OptionalActionMethods) 177 - (void) capitalizeWord: (id)sender; 178 - (void) centerSelectionInVisibleArea: (id)sender; 179 - (void) changeCaseOfLetter: (id)sender; 180 - (void) complete: (id)sender; 181 - (void) deleteBackward: (id)sender; 182 - (void) deleteForward: (id)sender; 183 - (void) deleteToBeginningOfLine: (id)sender; 184 - (void) deleteToBeginningOfParagraph: (id)sender; 185 - (void) deleteToEndOfLine: (id)sender; 186 - (void) deleteToEndOfParagraph: (id)sender; 187 - (void) deleteToMark: (id)sender; 188 - (void) deleteWordBackward: (id)sender; 189 - (void) deleteWordForward: (id)sender; 190 - (void) indent: (id)sender; 191 - (void) insertBacktab: (id)sender; 192 - (void) insertNewline: (id)sender; 193 - (void) insertNewlineIgnoringFieldEditor: (id)sender; 194 - (void) insertParagraphSeparator: (id)sender; 195 - (void) insertTab: (id)sender; 196 - (void) insertTabIgnoringFieldEditor: (id)sender; 197 - (void) lowercaseWord: (id)sender; 198 - (void) moveBackward: (id)sender; 199 - (void) moveBackwardAndModifySelection: (id)sender; 200 - (void) moveDown: (id)sender; 201 - (void) moveDownAndModifySelection: (id)sender; 202 - (void) moveForward: (id)sender; 203 - (void) moveForwardAndModifySelection: (id)sender; 204 - (void) moveLeft: (id)sender; 205 - (void) moveRight: (id)sender; 206 - (void) moveToBeginningOfDocument: (id)sender; 207 - (void) moveToBeginningOfLine: (id)sender; 208 - (void) moveToBeginningOfParagraph: (id)sender; 209 - (void) moveToEndOfDocument: (id)sender; 210 - (void) moveToEndOfLine: (id)sender; 211 - (void) moveToEndOfParagraph: (id)sender; 212 - (void) moveUp: (id)sender; 213 - (void) moveUpAndModifySelection: (id)sender; 214 - (void) moveWordBackward: (id)sender; 215 - (void) moveWordBackwardAndModifySelection: (id)sender; 216 - (void) moveWordForward: (id)sender; 217 - (void) moveWordForwardAndModifySelection: (id)sender; 218 - (void) pageDown: (id)sender; 219 - (void) pageUp: (id)sender; 220 - (void) scrollLineDown: (id)sender; 221 - (void) scrollLineUp: (id)sender; 222 - (void) scrollPageDown: (id)sender; 223 - (void) scrollPageUp: (id)sender; 224 - (void) scrollToBeginningOfDocument: (id)sender; 225 - (void) scrollToEndOfDocument: (id)sender; 226 - (void) selectAll: (id)sender; 227 - (void) selectLine: (id)sender; 228 - (void) selectParagraph: (id)sender; 229 - (void) selectToMark: (id)sender; 230 - (void) selectWord: (id)sender; 231 - (void) setMark: (id)sender; 232 - (void) showContextHelp: (id)sender; 233 - (void) swapWithMark: (id)sender; 234 - (void) transpose: (id)sender; 235 - (void) transposeWords: (id)sender; 236 - (void) uppercaseWord: (id)sender; 237 - (void) yank: (id)sender; 238 239 #if OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST) 240 - (void) cancelOperation: (id)sender; 241 - (void) deleteBackwardByDecomposingPreviousCharacter: (id)sender; 242 - (void) moveLeftAndModifySelection: (id)sender; 243 - (void) moveRightAndModifySelection: (id)sender; 244 - (void) moveWordLeft: (id)sender; 245 - (void) moveWordLeftAndModifySelection: (id)sender; 246 - (void) moveWordRight: (id)sender; 247 - (void) moveWordRightAndModifySelection: (id)sender; 248 #endif 249 #if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST) 250 - (void) insertContainerBreak: (id)sender; 251 - (void) insertLineBreak: (id)sender; 252 - (void) tabletPoint:(NSEvent *)event; 253 - (void) tabletProximity:(NSEvent *)event; 254 #endif 255 256 @end 257 #endif 258 259 #endif /* _GNUstep_H_NSResponder */ 260