2003-07-31 23:52:10 +00:00
|
|
|
/*
|
|
|
|
NSResponder.h
|
|
|
|
|
|
|
|
Abstract class which is basis of command and event processing
|
|
|
|
|
|
|
|
Copyright (C) 1996,1999 Free Software Foundation, Inc.
|
|
|
|
|
|
|
|
Author: Scott Christley <scottc@net-community.com>
|
|
|
|
Date: 1996
|
|
|
|
|
|
|
|
This file is part of the GNUstep GUI Library.
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Library General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Library General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Library General Public
|
|
|
|
License along with this library; see the file COPYING.LIB.
|
|
|
|
If not, write to the Free Software Foundation,
|
2005-05-26 02:52:46 +00:00
|
|
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2003-07-31 23:52:10 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _GNUstep_H_NSResponder
|
|
|
|
#define _GNUstep_H_NSResponder
|
|
|
|
|
|
|
|
#include <Foundation/NSObject.h>
|
|
|
|
#include <AppKit/NSInterfaceStyle.h>
|
|
|
|
#include <AppKit/AppKitDefines.h>
|
|
|
|
|
|
|
|
@class NSCoder;
|
|
|
|
@class NSString;
|
|
|
|
@class NSEvent;
|
|
|
|
@class NSMenu;
|
|
|
|
@class NSUndoManager;
|
|
|
|
|
|
|
|
@interface NSResponder : NSObject <NSCoding>
|
|
|
|
{
|
|
|
|
#ifdef STRICT_OPENSTEP
|
|
|
|
int _interface_style;
|
|
|
|
#else
|
|
|
|
NSInterfaceStyle _interface_style;
|
|
|
|
#endif
|
|
|
|
NSResponder *_next_responder;
|
|
|
|
|
|
|
|
/*
|
2005-01-21 21:43 Alexander Malmberg <alexander@malmberg.org>
Various whitespace cleanups, comment type fixes, and changes
to avoid warnings from recent versions of gcc.
* Headers/Additions/GNUstepGUI/GSToolbar.h (-_toolbars): Declare.
* Source/NSWindow+Toolbar.m: Remove conflicting declaration of
[NSToolbar -_toolbars].
* Headers/Additions/GNUstepGUI/GSServicesManager.h,
Source/GSServicesMananger.m (-item2title:, -validateMenuItem:):
Adjust argument types.
* Headers/AppKit/NSMenu.h (-validateMenuItem:): Adjust argument
type.
* Source/NSTextView.m (-sizeToFit): Don't use size uninitialized
if neither resizable flags is set.
(-insertText:): Adjust argument type.
* Headers/AppKit/NSResponder.h, Source/NSResponder.m (-insertText:):
Adjust argument type. Document.
* Headers/AppKit/NSView.h: Change type of ivar _window to NSWindow *.
* Source/GSTitleView.m (-mouseDown:): Always initialize
startWindowOrigin.
* Source/NSApplication.m (-setApplicationIconImage:): Add casts
to avoid warnings.
* Source/NSCell.m (-cellSize): Add default: case.
* Source/NSPasteboard.m
([GSFiltered -pasteboard:provideDataForType:]): Detect and warn if we
can't find a filter that will get us the desired type.
* Source/NSProgressIndicator.m: Comment out unused variable 'images'.
* Source/NSBezierPath.m: Declare GSBezierPath fully before using it.
(-bezierPathByFlatteningPath, -bezierPathByReversingPath): Make sure
variables are always initialized.
* Source/NSMenuView.m,
* Source/NSPrintOperation.m,
* Source/NSSplitView.m,
* Source/NSTableHeaderView.m: Make sure variables are always
initialized.
* Source/NSBox.m,
* Source/NSImageview.m,
* Source/NSText.m,
* Source/NSTextStorage.m: Add missing includes.
* Source/GSKeyBindingTable.m,
* Source/GSLayoutManager.m,
* Source/NSBitmapImageRep+PNM.m,
* Source/NSBundleAdditions.m,
* Source/NSLayoutManager.m,
* Source/nsimage-tiff.h,
* Source/tiff.m,
* Headers/Additions/GNUstepGUI/GSDisplayServer.h,
* Source/GSDisplayServer.m: Change signedness of various variables.
* Source/NSPanel.m (-sendEvent:): Remove.
* Source/NSWindow.m (-becomesKeyOnlyIfNeeded): New method.
(-_sendEvent:becomesKeyOnlyIfNeeded:): Remove. Move code ...
(-sendEvent:): ... here. Use -becomesKeyOnlyIfNeeded instead
of the argument.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@20590 72102866-910b-0410-8b05-ffd578937521
2005-01-21 20:39:18 +00:00
|
|
|
Due to interface brain-damage, both NSResponder and NSMenuView have -menu
|
2003-07-31 23:52:10 +00:00
|
|
|
and -setMenu: methods, but for different menus. Thus, to prevent (future,
|
|
|
|
there have already been some) problems and confusion, this ivar is
|
|
|
|
private (iow, it can't be accidentally used in NSMenuView).
|
|
|
|
*/
|
|
|
|
@private
|
|
|
|
NSMenu *_menu;
|
|
|
|
/*
|
|
|
|
* Flags for internal use by NSResponder and it's subclasses.
|
|
|
|
*/
|
|
|
|
@public
|
|
|
|
struct _rFlagsType {
|
|
|
|
/*
|
|
|
|
* 'flipped_view' is set in NSViews designated initialiser (and other
|
|
|
|
* methods that create views) to be the value returned by [-isFlipped]
|
|
|
|
* This caching assumes that the value returned by [-isFlipped] will
|
|
|
|
* not change during the views lifetime - if it does, the view must
|
|
|
|
* be sure to change the flag accordingly.
|
|
|
|
*/
|
|
|
|
unsigned flipped_view:1;
|
|
|
|
unsigned has_subviews:1; /* The view has subviews. */
|
|
|
|
unsigned has_currects:1; /* The view has cursor rects. */
|
|
|
|
unsigned has_trkrects:1; /* The view has tracking rects. */
|
|
|
|
unsigned has_draginfo:1; /* View/window has drag types. */
|
|
|
|
unsigned opaque_view:1; /* For views whose opacity may */
|
|
|
|
/* change to keep track of it. */
|
|
|
|
unsigned valid_rects:1; /* Some cursor rects may be ok. */
|
|
|
|
unsigned needs_display:1; /* Window/view needs display. */
|
|
|
|
} _rFlags;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Instance methods
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Managing the next responder
|
|
|
|
*/
|
|
|
|
- (NSResponder*) nextResponder;
|
|
|
|
- (void) setNextResponder: (NSResponder*)aResponder;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Determining the first responder
|
|
|
|
*/
|
|
|
|
- (BOOL) acceptsFirstResponder;
|
|
|
|
- (BOOL) becomeFirstResponder;
|
|
|
|
- (BOOL) resignFirstResponder;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Aid event processing
|
|
|
|
*/
|
|
|
|
- (BOOL) performKeyEquivalent: (NSEvent*)theEvent;
|
|
|
|
- (BOOL) tryToPerform: (SEL)anAction with: (id)anObject;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Forwarding event messages
|
|
|
|
*/
|
|
|
|
- (void) flagsChanged: (NSEvent*)theEvent;
|
|
|
|
- (void) helpRequested: (NSEvent*)theEvent;
|
|
|
|
- (void) keyDown: (NSEvent*)theEvent;
|
|
|
|
- (void) keyUp: (NSEvent*)theEvent;
|
|
|
|
- (void) mouseDown: (NSEvent*)theEvent;
|
|
|
|
- (void) mouseDragged: (NSEvent*)theEvent;
|
|
|
|
- (void) mouseEntered: (NSEvent*)theEvent;
|
|
|
|
- (void) mouseExited: (NSEvent*)theEvent;
|
|
|
|
- (void) mouseMoved: (NSEvent*)theEvent;
|
|
|
|
- (void) mouseUp: (NSEvent*)theEvent;
|
|
|
|
- (void) noResponderFor: (SEL)eventSelector;
|
|
|
|
#ifndef STRICT_OPENSTEP
|
|
|
|
- (void) otherMouseDown: (NSEvent*)theEvent;
|
|
|
|
- (void) otherMouseDragged: (NSEvent*)theEvent;
|
|
|
|
- (void) otherMouseUp: (NSEvent*)theEvent;
|
|
|
|
#endif
|
|
|
|
- (void) rightMouseDown: (NSEvent*)theEvent;
|
|
|
|
- (void) rightMouseDragged: (NSEvent*)theEvent;
|
|
|
|
- (void) rightMouseUp: (NSEvent*)theEvent;
|
|
|
|
- (void) scrollWheel: (NSEvent *)theEvent;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Services menu support
|
|
|
|
*/
|
|
|
|
- (id) validRequestorForSendType: (NSString*)typeSent
|
|
|
|
returnType: (NSString*)typeReturned;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* NSCoding protocol
|
|
|
|
*/
|
|
|
|
- (void) encodeWithCoder: (NSCoder*)aCoder;
|
|
|
|
- (id) initWithCoder: (NSCoder*)aDecoder;
|
|
|
|
|
|
|
|
#ifndef STRICT_OPENSTEP
|
|
|
|
- (void) interpretKeyEvents: (NSArray*)eventArray;
|
|
|
|
- (BOOL) performMnemonic: (NSString*)aString;
|
|
|
|
- (void) flushBufferedKeyEvents;
|
|
|
|
- (void) doCommandBySelector: (SEL)aSelector;
|
2005-01-21 21:43 Alexander Malmberg <alexander@malmberg.org>
Various whitespace cleanups, comment type fixes, and changes
to avoid warnings from recent versions of gcc.
* Headers/Additions/GNUstepGUI/GSToolbar.h (-_toolbars): Declare.
* Source/NSWindow+Toolbar.m: Remove conflicting declaration of
[NSToolbar -_toolbars].
* Headers/Additions/GNUstepGUI/GSServicesManager.h,
Source/GSServicesMananger.m (-item2title:, -validateMenuItem:):
Adjust argument types.
* Headers/AppKit/NSMenu.h (-validateMenuItem:): Adjust argument
type.
* Source/NSTextView.m (-sizeToFit): Don't use size uninitialized
if neither resizable flags is set.
(-insertText:): Adjust argument type.
* Headers/AppKit/NSResponder.h, Source/NSResponder.m (-insertText:):
Adjust argument type. Document.
* Headers/AppKit/NSView.h: Change type of ivar _window to NSWindow *.
* Source/GSTitleView.m (-mouseDown:): Always initialize
startWindowOrigin.
* Source/NSApplication.m (-setApplicationIconImage:): Add casts
to avoid warnings.
* Source/NSCell.m (-cellSize): Add default: case.
* Source/NSPasteboard.m
([GSFiltered -pasteboard:provideDataForType:]): Detect and warn if we
can't find a filter that will get us the desired type.
* Source/NSProgressIndicator.m: Comment out unused variable 'images'.
* Source/NSBezierPath.m: Declare GSBezierPath fully before using it.
(-bezierPathByFlatteningPath, -bezierPathByReversingPath): Make sure
variables are always initialized.
* Source/NSMenuView.m,
* Source/NSPrintOperation.m,
* Source/NSSplitView.m,
* Source/NSTableHeaderView.m: Make sure variables are always
initialized.
* Source/NSBox.m,
* Source/NSImageview.m,
* Source/NSText.m,
* Source/NSTextStorage.m: Add missing includes.
* Source/GSKeyBindingTable.m,
* Source/GSLayoutManager.m,
* Source/NSBitmapImageRep+PNM.m,
* Source/NSBundleAdditions.m,
* Source/NSLayoutManager.m,
* Source/nsimage-tiff.h,
* Source/tiff.m,
* Headers/Additions/GNUstepGUI/GSDisplayServer.h,
* Source/GSDisplayServer.m: Change signedness of various variables.
* Source/NSPanel.m (-sendEvent:): Remove.
* Source/NSWindow.m (-becomesKeyOnlyIfNeeded): New method.
(-_sendEvent:becomesKeyOnlyIfNeeded:): Remove. Move code ...
(-sendEvent:): ... here. Use -becomesKeyOnlyIfNeeded instead
of the argument.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@20590 72102866-910b-0410-8b05-ffd578937521
2005-01-21 20:39:18 +00:00
|
|
|
|
|
|
|
/** <p>Tells the receiver to insert the given string. In a text view
|
|
|
|
the text is typically inserted at the insertion point, and replaces
|
|
|
|
any selection.
|
|
|
|
</p><p>
|
|
|
|
Subclasses should override this method. The implementation in
|
|
|
|
NSResponder just sends the message on to the next responder.
|
|
|
|
</p><p>
|
|
|
|
Normally, aString will be an NSString, but in some cases, it might
|
|
|
|
be an NSAttributedString.
|
|
|
|
</p> */
|
|
|
|
- (void) insertText: (id)aString;
|
2003-07-31 23:52:10 +00:00
|
|
|
- (NSUndoManager*) undoManager;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Menu
|
|
|
|
*/
|
|
|
|
- (NSMenu*) menu;
|
|
|
|
- (void) setMenu: (NSMenu*)aMenu;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Setting the interface
|
|
|
|
*/
|
|
|
|
- (NSInterfaceStyle) interfaceStyle;
|
|
|
|
- (void) setInterfaceStyle: (NSInterfaceStyle)aStyle;
|
2005-05-20 12:31:42 +00:00
|
|
|
|
|
|
|
- (BOOL) shouldBeTreatedAsInkEvent: (NSEvent *)theEvent;
|
2003-07-31 23:52:10 +00:00
|
|
|
#endif
|
|
|
|
@end
|
|
|
|
|
|
|
|
#ifndef STRICT_OPENSTEP
|
|
|
|
@interface NSResponder (OptionalActionMethods)
|
|
|
|
- (void) capitalizeWord: (id)sender;
|
|
|
|
- (void) centerSelectionInVisibleArea: (id)sender;
|
|
|
|
- (void) changeCaseOfLetter: (id)sender;
|
|
|
|
- (void) complete: (id)sender;
|
|
|
|
- (void) deleteBackward: (id)sender;
|
|
|
|
- (void) deleteForward: (id)sender;
|
|
|
|
- (void) deleteToBeginningOfLine: (id)sender;
|
|
|
|
- (void) deleteToBeginningOfParagraph: (id)sender;
|
|
|
|
- (void) deleteToEndOfLine: (id)sender;
|
|
|
|
- (void) deleteToEndOfParagraph: (id)sender;
|
|
|
|
- (void) deleteToMark: (id)sender;
|
|
|
|
- (void) deleteWordBackward: (id)sender;
|
|
|
|
- (void) deleteWordForward: (id)sender;
|
|
|
|
- (void) indent: (id)sender;
|
|
|
|
- (void) insertBacktab: (id)sender;
|
|
|
|
- (void) insertNewline: (id)sender;
|
|
|
|
- (void) insertNewlineIgnoringFieldEditor: (id)sender;
|
|
|
|
- (void) insertParagraphSeparator: (id)sender;
|
|
|
|
- (void) insertTab: (id)sender;
|
|
|
|
- (void) insertTabIgnoringFieldEditor: (id)sender;
|
|
|
|
- (void) lowercaseWord: (id)sender;
|
|
|
|
- (void) moveBackward: (id)sender;
|
|
|
|
- (void) moveBackwardAndModifySelection: (id)sender;
|
|
|
|
- (void) moveDown: (id)sender;
|
|
|
|
- (void) moveDownAndModifySelection: (id)sender;
|
|
|
|
- (void) moveForward: (id)sender;
|
|
|
|
- (void) moveForwardAndModifySelection: (id)sender;
|
|
|
|
- (void) moveLeft: (id)sender;
|
|
|
|
- (void) moveRight: (id)sender;
|
|
|
|
- (void) moveToBeginningOfDocument: (id)sender;
|
|
|
|
- (void) moveToBeginningOfLine: (id)sender;
|
|
|
|
- (void) moveToBeginningOfParagraph: (id)sender;
|
|
|
|
- (void) moveToEndOfDocument: (id)sender;
|
|
|
|
- (void) moveToEndOfLine: (id)sender;
|
|
|
|
- (void) moveToEndOfParagraph: (id)sender;
|
|
|
|
- (void) moveUp: (id)sender;
|
|
|
|
- (void) moveUpAndModifySelection: (id)sender;
|
|
|
|
- (void) moveWordBackward: (id)sender;
|
|
|
|
- (void) moveWordBackwardAndModifySelection: (id)sender;
|
|
|
|
- (void) moveWordForward: (id)sender;
|
|
|
|
- (void) moveWordForwardAndModifySelection: (id)sender;
|
|
|
|
- (void) pageDown: (id)sender;
|
|
|
|
- (void) pageUp: (id)sender;
|
|
|
|
- (void) scrollLineDown: (id)sender;
|
|
|
|
- (void) scrollLineUp: (id)sender;
|
|
|
|
- (void) scrollPageDown: (id)sender;
|
|
|
|
- (void) scrollPageUp: (id)sender;
|
|
|
|
- (void) selectAll: (id)sender;
|
|
|
|
- (void) selectLine: (id)sender;
|
|
|
|
- (void) selectParagraph: (id)sender;
|
|
|
|
- (void) selectToMark: (id)sender;
|
|
|
|
- (void) selectWord: (id)sender;
|
|
|
|
- (void) showContextHelp: (id)sender;
|
|
|
|
- (void) swapWithMark: (id)sender;
|
|
|
|
- (void) transpose: (id)sender;
|
|
|
|
- (void) transposeWords: (id)sender;
|
|
|
|
- (void) uppercaseWord: (id)sender;
|
|
|
|
- (void) yank: (id)sender;
|
2005-05-20 12:31:42 +00:00
|
|
|
|
|
|
|
// New in MacOSX 10.3
|
|
|
|
- (void) cancelOperation: (id)sender;
|
|
|
|
- (void) deleteBackwardByDecomposingPreviousCharacter: (id)sender;
|
|
|
|
- (void) moveLeftAndModifySelection: (id)sender;
|
|
|
|
- (void) moveRightAndModifySelection: (id)sender;
|
|
|
|
|
2003-07-31 23:52:10 +00:00
|
|
|
@end
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* _GNUstep_H_NSResponder */
|