mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-26 07:50:58 +00:00
Various header updates for MacOS-X compat
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4194 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
198f9549f5
commit
19ddb94e5b
5 changed files with 628 additions and 516 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
Tue May 4 14:40:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
Updates from information supplied by Marc Champesme to make NSWindow
|
||||
header have all the MacOS-X stuff in it.
|
||||
* Headers/AppKit/NSResponder.h: include NSInterfaceStyle and fix a
|
||||
few method prototypes;
|
||||
* Headers/AppKit/NSWindow.h: Added a whole load of MacOS-X methods.
|
||||
* Source/NSResponder.m: Fixed a few method prototypes and added
|
||||
interface style stuff.
|
||||
* Source/NSWindow.m: Fixed a few method prototypes and added
|
||||
interface style stuff and gState implementation.
|
||||
|
||||
Mon May 3 18:55:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
* Source/NSButtonCell.m: ([-drawWithFrame:inView:]) and
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
Abstract class which is basis of command and event processing
|
||||
|
||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
Copyright (C) 1996,1999 Free Software Foundation, Inc.
|
||||
|
||||
Author: Scott Christley <scottc@net-community.com>
|
||||
Date: 1996
|
||||
|
@ -30,43 +30,43 @@
|
|||
#define _GNUstep_H_NSResponder
|
||||
|
||||
#include <Foundation/NSCoder.h>
|
||||
#include <AppKit/NSInterfaceStyle.h>
|
||||
|
||||
@class NSString;
|
||||
@class NSEvent;
|
||||
|
||||
@interface NSResponder : NSObject <NSCoding>
|
||||
{
|
||||
// Attributes
|
||||
int interface_style;
|
||||
id next_responder;
|
||||
NSInterfaceStyle interface_style;
|
||||
NSResponder *next_responder;
|
||||
}
|
||||
|
||||
//
|
||||
// Instance methods
|
||||
//
|
||||
/*
|
||||
* Instance methods
|
||||
*/
|
||||
|
||||
//
|
||||
// Managing the next responder
|
||||
//
|
||||
- nextResponder;
|
||||
- (void)setNextResponder:aResponder;
|
||||
/*
|
||||
* Managing the next responder
|
||||
*/
|
||||
- (NSResponder*) nextResponder;
|
||||
- (void) setNextResponder: (NSResponder*)aResponder;
|
||||
|
||||
//
|
||||
// Determining the first responder
|
||||
//
|
||||
/*
|
||||
* Determining the first responder
|
||||
*/
|
||||
- (BOOL) acceptsFirstResponder;
|
||||
- (BOOL) becomeFirstResponder;
|
||||
- (BOOL) resignFirstResponder;
|
||||
|
||||
//
|
||||
// Aid event processing
|
||||
//
|
||||
/*
|
||||
* Aid event processing
|
||||
*/
|
||||
- (BOOL) performKeyEquivalent: (NSEvent *)theEvent;
|
||||
- (BOOL)tryToPerform:(SEL)anAction with:anObject;
|
||||
- (BOOL) tryToPerform: (SEL)anAction with: (id)anObject;
|
||||
|
||||
//
|
||||
// Forwarding event messages
|
||||
//
|
||||
/*
|
||||
* Forwarding event messages
|
||||
*/
|
||||
- (void) flagsChanged: (NSEvent *)theEvent;
|
||||
- (void) helpRequested: (NSEvent *)theEvent;
|
||||
- (void) keyDown: (NSEvent *)theEvent;
|
||||
|
@ -82,18 +82,22 @@
|
|||
- (void) rightMouseDragged: (NSEvent *)theEvent;
|
||||
- (void) rightMouseUp: (NSEvent *)theEvent;
|
||||
|
||||
//
|
||||
// Services menu support
|
||||
//
|
||||
- validRequestorForSendType:(NSString *)typeSent
|
||||
/*
|
||||
* Services menu support
|
||||
*/
|
||||
- (id) validRequestorForSendType: (NSString *)typeSent
|
||||
returnType: (NSString *)typeReturned;
|
||||
|
||||
//
|
||||
// NSCoding protocol
|
||||
//
|
||||
- (void)encodeWithCoder:aCoder;
|
||||
- initWithCoder:aDecoder;
|
||||
/*
|
||||
* NSCoding protocol
|
||||
*/
|
||||
- (void) encodeWithCoder: (NSCoder*)aCoder;
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder;
|
||||
|
||||
#ifndef STRICT_OPENSTEP
|
||||
- (NSInterfaceStyle) interfaceStyle;
|
||||
- (void) setInterfaceStyle: (NSInterfaceStyle)aStyle;
|
||||
#endif
|
||||
@end
|
||||
|
||||
#endif // _GNUstep_H_NSResponder
|
||||
#endif /* _GNUstep_H_NSResponder */
|
||||
|
|
|
@ -3,12 +3,14 @@
|
|||
|
||||
The window class
|
||||
|
||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
Copyright (C) 1996,1999 Free Software Foundation, Inc.
|
||||
|
||||
Author: Scott Christley <scottc@net-community.com>
|
||||
Date: 1996
|
||||
Author: Felipe A. Rodriguez <far@ix.netcom.com>
|
||||
Modified: Felipe A. Rodriguez <far@ix.netcom.com>
|
||||
Date: June 1998
|
||||
Modified: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
Date: 1998,1999
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
|
@ -36,22 +38,24 @@
|
|||
#include <AppKit/NSResponder.h>
|
||||
#include <AppKit/NSEvent.h>
|
||||
|
||||
@class NSString;
|
||||
@class NSArray;
|
||||
@class NSMutableArray;
|
||||
@class NSData;
|
||||
@class NSDictionary;
|
||||
@class NSNotification;
|
||||
@class NSDate;
|
||||
@class NSDictionary;
|
||||
@class NSMutableArray;
|
||||
@class NSNotification;
|
||||
@class NSString;
|
||||
|
||||
@class NSButtonCell;
|
||||
@class NSColor;
|
||||
@class NSImage;
|
||||
@class NSScreen;
|
||||
@class NSEvent;
|
||||
@class NSImage;
|
||||
@class NSMenu;
|
||||
@class NSPasteboard;
|
||||
@class NSView;
|
||||
@class NSText;
|
||||
@class NSScreen;
|
||||
@class NSScreen;
|
||||
@class NSText;
|
||||
@class NSView;
|
||||
|
||||
enum {
|
||||
NSNormalWindowLevel = 0,
|
||||
|
@ -69,12 +73,19 @@ enum {
|
|||
NSResizableWindowMask = 8
|
||||
};
|
||||
|
||||
#ifndef STRICT_OPENSTEP
|
||||
typedef enum _NSSelectionDirection {
|
||||
NSDirectSelection,
|
||||
NSSelectingNext,
|
||||
NSSelectingPrevious
|
||||
} NSSelectionDirection;
|
||||
#endif
|
||||
|
||||
extern NSSize NSIconSize;
|
||||
extern NSSize NSTokenSize;
|
||||
|
||||
@interface NSWindow : NSResponder <NSCoding>
|
||||
{
|
||||
// Attributes
|
||||
NSRect frame;
|
||||
NSSize minimum_size;
|
||||
NSSize maximum_size;
|
||||
|
@ -85,6 +96,7 @@ extern NSSize NSTokenSize;
|
|||
id delegate;
|
||||
id _fieldEditor;
|
||||
int window_num;
|
||||
int gstate;
|
||||
NSColor *background_color;
|
||||
NSString *represented_filename;
|
||||
NSString *miniaturized_title;
|
||||
|
@ -92,7 +104,7 @@ extern NSSize NSTokenSize;
|
|||
NSString *window_title;
|
||||
NSPoint last_point;
|
||||
NSBackingStoreType backing_type;
|
||||
unsigned int style_mask;
|
||||
unsigned style_mask;
|
||||
int window_level;
|
||||
NSRect rectBeingDrawn;
|
||||
NSRect rectNeedingFlush;
|
||||
|
@ -120,16 +132,17 @@ extern NSSize NSTokenSize;
|
|||
BOOL hides_on_deactivate;
|
||||
BOOL accepts_mouse_moved;
|
||||
|
||||
// Reserved for back-end use
|
||||
/* Reserved for back-end use */
|
||||
void *be_wind_reserved;
|
||||
}
|
||||
|
||||
//
|
||||
// Class methods
|
||||
//
|
||||
//
|
||||
// Computing frame and content rectangles
|
||||
//
|
||||
/*
|
||||
* Class methods
|
||||
*/
|
||||
|
||||
/*
|
||||
* Computing frame and content rectangles
|
||||
*/
|
||||
+ (NSRect) contentRectForFrameRect: (NSRect)aRect
|
||||
styleMask: (unsigned int)aStyle;
|
||||
|
||||
|
@ -139,34 +152,34 @@ extern NSSize NSTokenSize;
|
|||
+ (NSRect) minFrameWidthWithTitle: (NSString *)aTitle
|
||||
styleMask: (unsigned int)aStyle;
|
||||
|
||||
//
|
||||
// Saving and restoring the frame
|
||||
//
|
||||
/*
|
||||
* Saving and restoring the frame
|
||||
*/
|
||||
+ (void) removeFrameUsingName: (NSString *)name;
|
||||
|
||||
//
|
||||
// Initializing and getting a new NSWindow object
|
||||
//
|
||||
- initWithContentRect:(NSRect)contentRect
|
||||
/*
|
||||
* Initializing and getting a new NSWindow object
|
||||
*/
|
||||
- (id) initWithContentRect: (NSRect)contentRect
|
||||
styleMask: (unsigned int)aStyle
|
||||
backing: (NSBackingStoreType)bufferingType
|
||||
defer: (BOOL)flag;
|
||||
|
||||
- initWithContentRect:(NSRect)contentRect
|
||||
- (id) initWithContentRect: (NSRect)contentRect
|
||||
styleMask: (unsigned int)aStyle
|
||||
backing: (NSBackingStoreType)bufferingType
|
||||
defer: (BOOL)flag
|
||||
screen: (NSScreen*)aScreen;
|
||||
|
||||
//
|
||||
// Accessing the content view
|
||||
//
|
||||
/*
|
||||
* Accessing the content view
|
||||
*/
|
||||
- contentView;
|
||||
- (void) setContentView: (NSView *)aView;
|
||||
|
||||
//
|
||||
// Window graphics
|
||||
//
|
||||
/*
|
||||
* Window graphics
|
||||
*/
|
||||
- (NSColor *) backgroundColor;
|
||||
- (NSString *) representedFilename;
|
||||
- (void) setBackgroundColor: (NSColor *)color;
|
||||
|
@ -176,9 +189,9 @@ extern NSSize NSTokenSize;
|
|||
- (unsigned int) styleMask;
|
||||
- (NSString *) title;
|
||||
|
||||
//
|
||||
// Window device attributes
|
||||
//
|
||||
/*
|
||||
* Window device attributes
|
||||
*/
|
||||
- (NSBackingStoreType) backingType;
|
||||
- (NSDictionary *) deviceDescription;
|
||||
- (int) gState;
|
||||
|
@ -186,26 +199,25 @@ extern NSSize NSTokenSize;
|
|||
- (void) setBackingType: (NSBackingStoreType)type;
|
||||
- (void) setOneShot: (BOOL)flag;
|
||||
- (int) windowNumber;
|
||||
- (void)setWindowNumber:(int)windowNum;
|
||||
|
||||
//
|
||||
// The miniwindow
|
||||
//
|
||||
/*
|
||||
* The miniwindow
|
||||
*/
|
||||
- (NSImage *) miniwindowImage;
|
||||
- (NSString *) miniwindowTitle;
|
||||
- (void) setMiniwindowImage: (NSImage *)image;
|
||||
- (void) setMiniwindowTitle: (NSString *)title;
|
||||
|
||||
//
|
||||
// The field editor
|
||||
//
|
||||
/*
|
||||
* The field editor
|
||||
*/
|
||||
- (void) endEditingFor: anObject;
|
||||
- (NSText *) fieldEditor: (BOOL)createFlag
|
||||
forObject: anObject;
|
||||
|
||||
//
|
||||
// Window status and ordering
|
||||
//
|
||||
/*
|
||||
* Window status and ordering
|
||||
*/
|
||||
- (void) becomeKeyWindow;
|
||||
- (void) becomeMainWindow;
|
||||
- (BOOL) canBecomeKeyWindow;
|
||||
|
@ -230,9 +242,9 @@ extern NSSize NSTokenSize;
|
|||
- (void) setHidesOnDeactivate: (BOOL)flag;
|
||||
- (void) setLevel: (int)newLevel;
|
||||
|
||||
//
|
||||
// Moving and resizing the window
|
||||
//
|
||||
/*
|
||||
* Moving and resizing the window
|
||||
*/
|
||||
- (NSPoint) cascadeTopLeftFromPoint: (NSPoint)topLeftPoint;
|
||||
- (void) center;
|
||||
- (NSRect) constrainFrameRect: (NSRect)frameRect
|
||||
|
@ -247,17 +259,16 @@ extern NSSize NSTokenSize;
|
|||
- (void) setFrameTopLeftPoint: (NSPoint)aPoint;
|
||||
- (void) setMinSize: (NSSize)aSize;
|
||||
- (void) setMaxSize: (NSSize)aSize;
|
||||
- (void)setResizeIncrements:(NSSize)aSize;
|
||||
|
||||
//
|
||||
// Converting coordinates
|
||||
//
|
||||
/*
|
||||
* Converting coordinates
|
||||
*/
|
||||
- (NSPoint) convertBaseToScreen: (NSPoint)aPoint;
|
||||
- (NSPoint) convertScreenToBase: (NSPoint)aPoint;
|
||||
|
||||
//
|
||||
// Managing the display
|
||||
//
|
||||
/*
|
||||
* Managing the display
|
||||
*/
|
||||
- (void) display;
|
||||
- (void) disableFlushWindow;
|
||||
- (void) displayIfNeeded;
|
||||
|
@ -272,9 +283,9 @@ extern NSSize NSTokenSize;
|
|||
- (void) useOptimizedDrawing: (BOOL)flag;
|
||||
- (BOOL) viewsNeedDisplay;
|
||||
|
||||
//
|
||||
// Screens and window depths
|
||||
//
|
||||
/*
|
||||
* Screens and window depths
|
||||
*/
|
||||
+ (NSWindowDepth) defaultDepthLimit;
|
||||
- (BOOL) canStoreColor;
|
||||
- (NSScreen *) deepestScreen;
|
||||
|
@ -284,9 +295,9 @@ extern NSSize NSTokenSize;
|
|||
- (void) setDepthLimit: (NSWindowDepth)limit;
|
||||
- (void) setDynamicDepthLimit: (BOOL)flag;
|
||||
|
||||
//
|
||||
// Cursor management
|
||||
//
|
||||
/*
|
||||
* Cursor management
|
||||
*/
|
||||
- (BOOL) areCursorRectsEnabled;
|
||||
- (void) disableCursorRects;
|
||||
- (void) discardCursorRects;
|
||||
|
@ -294,9 +305,9 @@ extern NSSize NSTokenSize;
|
|||
- (void) invalidateCursorRectsForView: (NSView *)aView;
|
||||
- (void) resetCursorRects;
|
||||
|
||||
//
|
||||
// Handling user actions and events
|
||||
//
|
||||
/*
|
||||
* Handling user actions and events
|
||||
*/
|
||||
- (void) close;
|
||||
- (void) deminiaturize: sender;
|
||||
- (BOOL) isDocumentEdited;
|
||||
|
@ -308,14 +319,15 @@ extern NSSize NSTokenSize;
|
|||
- (void) setDocumentEdited: (BOOL)flag;
|
||||
- (void) setReleasedWhenClosed: (BOOL)flag;
|
||||
|
||||
//
|
||||
// Aiding event handling
|
||||
//
|
||||
/*
|
||||
* Aiding event handling
|
||||
*/
|
||||
- (BOOL) acceptsMouseMovedEvents;
|
||||
- (NSEvent *) currentEvent;
|
||||
- (void) discardEventsMatchingMask: (unsigned int)mask
|
||||
beforeEvent: (NSEvent *)lastEvent;
|
||||
- (NSResponder *) firstResponder;
|
||||
- (void) keyDown: (NSEvent *)theEvent;
|
||||
- (BOOL) makeFirstResponder: (NSResponder *)aResponder;
|
||||
- (NSPoint) mouseLocationOutsideOfEventStream;
|
||||
- (NSEvent *) nextEventMatchingMask: (unsigned int)mask;
|
||||
|
@ -330,9 +342,9 @@ extern NSSize NSTokenSize;
|
|||
- (BOOL) tryToPerform: (SEL)anAction with: anObject;
|
||||
- (BOOL) worksWhenModal;
|
||||
|
||||
//
|
||||
// Dragging
|
||||
//
|
||||
/*
|
||||
* Dragging
|
||||
*/
|
||||
- (void) dragImage: (NSImage *)anImage
|
||||
at: (NSPoint)baseLocation
|
||||
offset: (NSSize)initialOffset
|
||||
|
@ -343,17 +355,17 @@ extern NSSize NSTokenSize;
|
|||
- (void) registerForDraggedTypes: (NSArray *)newTypes;
|
||||
- (void) unregisterDraggedTypes;
|
||||
|
||||
//
|
||||
// Services and windows menu support
|
||||
//
|
||||
/*
|
||||
* Services and windows menu support
|
||||
*/
|
||||
- (BOOL) isExcludedFromWindowsMenu;
|
||||
- (void) setExcludedFromWindowsMenu: (BOOL)flag;
|
||||
- validRequestorForSendType:(NSString *)sendType
|
||||
- (id) validRequestorForSendType: (NSString *)sendType
|
||||
returnType: (NSString *)returnType;
|
||||
|
||||
//
|
||||
// Saving and restoring the frame
|
||||
//
|
||||
/*
|
||||
* Saving and restoring the frame
|
||||
*/
|
||||
- (NSString *) frameAutosaveName;
|
||||
- (void) saveFrameUsingName: (NSString *)name;
|
||||
- (BOOL) setFrameAutosaveName: (NSString *)name;
|
||||
|
@ -361,26 +373,32 @@ extern NSSize NSTokenSize;
|
|||
- (BOOL) setFrameUsingName: (NSString *)name;
|
||||
- (NSString *) stringWithSavedFrame;
|
||||
|
||||
//
|
||||
// Printing and postscript
|
||||
//
|
||||
/*
|
||||
* Printing and postscript
|
||||
*/
|
||||
- (NSData *) dataWithEPSInsideRect: (NSRect)rect;
|
||||
- (void) fax: sender;
|
||||
- (void) print: sender;
|
||||
|
||||
//
|
||||
// Assigning a delegate
|
||||
//
|
||||
- delegate;
|
||||
/*
|
||||
* Assigning a delegate
|
||||
*/
|
||||
- (id) delegate;
|
||||
- (void) setDelegate: anObject;
|
||||
|
||||
//
|
||||
// Implemented by the delegate
|
||||
//
|
||||
/*
|
||||
* Implemented by the delegate
|
||||
*/
|
||||
- (BOOL) windowShouldClose: sender;
|
||||
#ifndef STRICT_OPENSTEP
|
||||
- (BOOL) windowShouldZoom: (NSWindow*)sender
|
||||
toFrame: (NSRect)aFrame;
|
||||
- (NSRect) windowWillUseStandardFrame: (NSWindow*)sender
|
||||
defaultFrame: (NSRect)aFrame;
|
||||
#endif
|
||||
- (NSSize) windowWillResize: (NSWindow *)sender
|
||||
toSize: (NSSize)frameSize;
|
||||
- windowWillReturnFieldEditor:(NSWindow *)sender
|
||||
- (id) windowWillReturnFieldEditor: (NSWindow *)sender
|
||||
toObject: client;
|
||||
- (void) windowDidBecomeKey: (NSNotification *)aNotification;
|
||||
- (void) windowDidBecomeMain: (NSNotification *)aNotification;
|
||||
|
@ -397,37 +415,69 @@ extern NSSize NSTokenSize;
|
|||
- (void) windowWillMiniaturize: (NSNotification *)aNotification;
|
||||
- (void) windowWillMove: (NSNotification *)aNotification;
|
||||
|
||||
//
|
||||
// NSCoding methods
|
||||
//
|
||||
- (void)encodeWithCoder:aCoder;
|
||||
- initWithCoder:aDecoder;
|
||||
/*
|
||||
* NSCoding methods
|
||||
*/
|
||||
- (void) encodeWithCoder: (NSCoder*)aCoder;
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder;
|
||||
|
||||
#ifndef STRICT_OPENSTEP
|
||||
+ (void) menuChanged: (NSMenu *)aMenu;
|
||||
|
||||
- (NSSize) aspectRatio;
|
||||
- (void) cacheImageInRect: (NSRect)aRect;
|
||||
- (NSButtonCell*) defaultButtonCell;
|
||||
- (void) disableKeyEquivalentForDefaultButtonCell;
|
||||
- (void) discardCachedImage;
|
||||
- (void) enableKeyEquivalentForDefaultButtonCell;
|
||||
- (NSView*) initialFirstResponder;
|
||||
- (NSInterfaceStyle) interfaceStyle;
|
||||
- (NSSelectionDirection) keyViewSelectionDirection;
|
||||
- (void) performZoom: (id)sender;
|
||||
- (NSSize) resizeIncrements;
|
||||
- (void) restoreCachedImage;
|
||||
- (void) selectKeyViewFollowingView: (NSView *)aView;
|
||||
- (void) selectKeyViewPrecedingView: (NSView *)aView;
|
||||
- (void) selectNextKeyView: (id)sender;
|
||||
- (void) selectPreviousKeyView: (id)sender;
|
||||
- (void) setAspectRatio: (NSSize)ratio;
|
||||
- (void) setDefaultButtonCell: (NSButtonCell*)aCell;
|
||||
- (void) setInitialFirstResponder: (NSView*)aView;
|
||||
- (void) setInterfaceStyle: (NSInterfaceStyle)aStyle;
|
||||
- (void) setResizeIncrements: (NSSize)aSize;
|
||||
- (void) zoom: (id)sender;
|
||||
#endif
|
||||
@end
|
||||
|
||||
//
|
||||
// GNUstep backend methods
|
||||
//
|
||||
#ifndef NO_GNUSTEP
|
||||
/*
|
||||
* GNUstep backend methods
|
||||
*/
|
||||
@interface NSWindow (GNUstepBackend)
|
||||
|
||||
+ (NSWindow*) _windowWithTag: (int)windowNumber;
|
||||
|
||||
//
|
||||
// Mouse capture/release
|
||||
//
|
||||
- (void) setWindowNumber: (int)windowNum;
|
||||
|
||||
/*
|
||||
* Mouse capture/release
|
||||
*/
|
||||
- (void) _captureMouse: sender;
|
||||
- (void) _releaseMouse: sender;
|
||||
|
||||
// Allow subclasses to init without the backend class
|
||||
// attempting to create an actual window
|
||||
/*
|
||||
* Allow subclasses to init without the backend class
|
||||
* attempting to create an actual window
|
||||
*/
|
||||
- (void) initDefaults;
|
||||
- cleanInit;
|
||||
- (id) cleanInit;
|
||||
|
||||
- (void) performDeminiaturize: sender;
|
||||
- (void) performHide: sender;
|
||||
- (void) performUnhide: sender;
|
||||
|
||||
@end
|
||||
#endif
|
||||
|
||||
/* Notifications */
|
||||
extern NSString *NSWindowDidBecomeKeyNotification;
|
||||
|
@ -445,4 +495,4 @@ extern NSString *NSWindowWillCloseNotification;
|
|||
extern NSString *NSWindowWillMiniaturizeNotification;
|
||||
extern NSString *NSWindowWillMoveNotification;
|
||||
|
||||
#endif // _GNUstep_H_NSWindow
|
||||
#endif /* _GNUstep_H_NSWindow */
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
Abstract class which is basis of command and event processing
|
||||
|
||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
Copyright (C) 1996,1999 Free Software Foundation, Inc.
|
||||
|
||||
Author: Scott Christley <scottc@net-community.com>
|
||||
Date: 1996
|
||||
|
@ -34,39 +34,38 @@
|
|||
|
||||
@implementation NSResponder
|
||||
|
||||
//
|
||||
// Class methods
|
||||
//
|
||||
/*
|
||||
* Class methods
|
||||
*/
|
||||
+ (void) initialize
|
||||
{
|
||||
if (self == [NSResponder class])
|
||||
{
|
||||
NSDebugLog(@"Initialize NSResponder class\n");
|
||||
|
||||
// Initial version
|
||||
[self setVersion: 1];
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Instance methods
|
||||
//
|
||||
//
|
||||
// Managing the next responder
|
||||
//
|
||||
- nextResponder
|
||||
/*
|
||||
* Instance methods
|
||||
*/
|
||||
/*
|
||||
* Managing the next responder
|
||||
*/
|
||||
- (id) nextResponder
|
||||
{
|
||||
return next_responder;
|
||||
}
|
||||
|
||||
- (void)setNextResponder:aResponder
|
||||
- (void) setNextResponder: (NSResponder*)aResponder
|
||||
{
|
||||
next_responder = aResponder;
|
||||
}
|
||||
|
||||
//
|
||||
// Determining the first responder
|
||||
//
|
||||
/*
|
||||
* Determining the first responder
|
||||
*/
|
||||
- (BOOL) acceptsFirstResponder
|
||||
{
|
||||
return NO;
|
||||
|
@ -82,17 +81,17 @@
|
|||
return YES;
|
||||
}
|
||||
|
||||
//
|
||||
// Aid event processing
|
||||
//
|
||||
/*
|
||||
* Aid event processing
|
||||
*/
|
||||
- (BOOL) performKeyEquivalent: (NSEvent *)theEvent
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL)tryToPerform:(SEL)anAction with:anObject
|
||||
- (BOOL) tryToPerform: (SEL)anAction with: (id)anObject
|
||||
{
|
||||
// Can we perform the action -then do it
|
||||
/* Can we perform the action -then do it */
|
||||
if ([self respondsToSelector: anAction])
|
||||
{
|
||||
[self performSelector: anAction withObject: anObject];
|
||||
|
@ -100,7 +99,7 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
// If we cannot perform then try the next responder
|
||||
/* If we cannot perform then try the next responder */
|
||||
if (!next_responder)
|
||||
return NO;
|
||||
else
|
||||
|
@ -108,9 +107,9 @@
|
|||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Forwarding event messages
|
||||
//
|
||||
/*
|
||||
* Forwarding event messages
|
||||
*/
|
||||
- (void) flagsChanged: (NSEvent *)theEvent
|
||||
{
|
||||
if (next_responder)
|
||||
|
@ -193,7 +192,7 @@
|
|||
|
||||
- (void) noResponderFor: (SEL)eventSelector
|
||||
{
|
||||
// Only beep for key down events
|
||||
/* Only beep for key down events */
|
||||
if (sel_eq(eventSelector, @selector(keyDown: )))
|
||||
NSBeep();
|
||||
}
|
||||
|
@ -222,10 +221,10 @@
|
|||
return [self noResponderFor: @selector(rightMouseUp: )];
|
||||
}
|
||||
|
||||
//
|
||||
// Services menu support
|
||||
//
|
||||
- validRequestorForSendType:(NSString *)typeSent
|
||||
/*
|
||||
* Services menu support
|
||||
*/
|
||||
- (id) validRequestorForSendType: (NSString *)typeSent
|
||||
returnType: (NSString *)typeReturned
|
||||
{
|
||||
if (next_responder)
|
||||
|
@ -235,9 +234,9 @@
|
|||
return nil;
|
||||
}
|
||||
|
||||
//
|
||||
// NSCoding protocol
|
||||
//
|
||||
/*
|
||||
* NSCoding protocol
|
||||
*/
|
||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
[aCoder encodeConditionalObject: next_responder];
|
||||
|
@ -246,8 +245,17 @@
|
|||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
{
|
||||
next_responder = [aDecoder decodeObject];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSInterfaceStyle) interfaceStyle
|
||||
{
|
||||
return interface_style;
|
||||
}
|
||||
|
||||
- (void) setInterfaceStyle: (NSInterfaceStyle)aStyle
|
||||
{
|
||||
interface_style = aStyle;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -226,7 +226,10 @@
|
|||
//
|
||||
// Accessing the content view
|
||||
//
|
||||
- contentView { return content_view; }
|
||||
- (id) contentView
|
||||
{
|
||||
return content_view;
|
||||
}
|
||||
|
||||
- (void) setContentView: (NSView *)aView
|
||||
{
|
||||
|
@ -328,7 +331,7 @@
|
|||
|
||||
- (int) gState
|
||||
{
|
||||
return 0;
|
||||
return gstate;
|
||||
}
|
||||
|
||||
- (BOOL) isOneShot
|
||||
|
@ -351,11 +354,6 @@
|
|||
return window_num;
|
||||
}
|
||||
|
||||
- (void) setWindowNumber: (int)windowNum
|
||||
{
|
||||
window_num = windowNum;
|
||||
}
|
||||
|
||||
//
|
||||
// The miniwindow
|
||||
//
|
||||
|
@ -618,6 +616,11 @@
|
|||
maximum_size = aSize;
|
||||
}
|
||||
|
||||
- (NSSize) resizeIncrements
|
||||
{
|
||||
return increments;
|
||||
}
|
||||
|
||||
- (void) setResizeIncrements: (NSSize)aSize
|
||||
{
|
||||
increments = aSize;
|
||||
|
@ -879,8 +882,15 @@
|
|||
[nc postNotificationName: NSWindowDidDeminiaturizeNotification object: self];
|
||||
}
|
||||
|
||||
- (BOOL) isDocumentEdited { return is_edited; }
|
||||
- (BOOL) isReleasedWhenClosed { return is_released_when_closed; }
|
||||
- (BOOL) isDocumentEdited
|
||||
{
|
||||
return is_edited;
|
||||
}
|
||||
|
||||
- (BOOL) isReleasedWhenClosed
|
||||
{
|
||||
return is_released_when_closed;
|
||||
}
|
||||
|
||||
- (void) miniaturize: sender
|
||||
{
|
||||
|
@ -894,33 +904,42 @@
|
|||
|
||||
- (void) performClose: sender
|
||||
{
|
||||
/* self must have a close button in order to be closed */
|
||||
if (!([self styleMask] & NSClosableWindowMask))
|
||||
{ // self must have a close
|
||||
NSBeep(); // button in order to be
|
||||
return; // closed
|
||||
{
|
||||
NSBeep();
|
||||
return;
|
||||
}
|
||||
|
||||
if ([delegate respondsToSelector: @selector(windowShouldClose:)])
|
||||
{ // if delegate responds to
|
||||
if (![delegate windowShouldClose: self]) // windowShouldClose query
|
||||
{ // it to see if it's ok to
|
||||
NSBeep(); // close the window
|
||||
{
|
||||
/*
|
||||
* if delegate responds to windowShouldClose query it to see if
|
||||
* it's ok to close the window
|
||||
*/
|
||||
if (![delegate windowShouldClose: self])
|
||||
{
|
||||
NSBeep();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* else if self responds to windowShouldClose query
|
||||
* self to see if it's ok to close self
|
||||
*/
|
||||
if ([self respondsToSelector: @selector(windowShouldClose:)])
|
||||
{ // else if self responds to
|
||||
if (![self windowShouldClose: self]) // windowShouldClose query
|
||||
{ // self to see if it's ok
|
||||
NSBeep(); // to close self
|
||||
{
|
||||
if (![self windowShouldClose: self])
|
||||
{
|
||||
NSBeep();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[self close]; // it's ok to close self
|
||||
[self close];
|
||||
}
|
||||
|
||||
- (void) performMiniaturize: (id)sender
|
||||
|
@ -1635,6 +1654,16 @@
|
|||
return self;
|
||||
}
|
||||
|
||||
- (NSInterfaceStyle) interfaceStyle
|
||||
{
|
||||
return interface_style;
|
||||
}
|
||||
|
||||
- (void) setInterfaceStyle: (NSInterfaceStyle)aStyle
|
||||
{
|
||||
interface_style = aStyle;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
//
|
||||
|
@ -1647,6 +1676,11 @@
|
|||
return nil;
|
||||
}
|
||||
|
||||
- (void) setWindowNumber: (int)windowNum
|
||||
{
|
||||
window_num = windowNum;
|
||||
}
|
||||
|
||||
//
|
||||
// Mouse capture/release
|
||||
//
|
||||
|
@ -1657,13 +1691,17 @@
|
|||
- (void) performHide: sender {}
|
||||
- (void) performUnhide: sender {}
|
||||
|
||||
- (void) initDefaults // Allow subclasses to init
|
||||
{ // without the backend
|
||||
first_responder = nil; // class attempting to
|
||||
original_responder = nil; // create an actual window
|
||||
/*
|
||||
* Allow subclasses to init without the backend
|
||||
* class attempting to create an actual window
|
||||
*/
|
||||
- (void) initDefaults
|
||||
{
|
||||
first_responder = nil;
|
||||
original_responder = nil;
|
||||
delegate = nil;
|
||||
window_num = 0;
|
||||
background_color = [[NSColor lightGrayColor] retain];
|
||||
background_color = [[NSColor controlColor] retain];
|
||||
represented_filename = @"Window";
|
||||
miniaturized_title = @"Window";
|
||||
miniaturized_image = nil;
|
||||
|
|
Loading…
Reference in a new issue