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:
richard 1999-05-04 13:17:26 +00:00
parent 198f9549f5
commit 19ddb94e5b
5 changed files with 628 additions and 516 deletions

View file

@ -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> Mon May 3 18:55:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/NSButtonCell.m: ([-drawWithFrame:inView:]) and * Source/NSButtonCell.m: ([-drawWithFrame:inView:]) and

View file

@ -3,7 +3,7 @@
Abstract class which is basis of command and event processing 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> Author: Scott Christley <scottc@net-community.com>
Date: 1996 Date: 1996
@ -30,70 +30,74 @@
#define _GNUstep_H_NSResponder #define _GNUstep_H_NSResponder
#include <Foundation/NSCoder.h> #include <Foundation/NSCoder.h>
#include <AppKit/NSInterfaceStyle.h>
@class NSString; @class NSString;
@class NSEvent; @class NSEvent;
@interface NSResponder : NSObject <NSCoding> @interface NSResponder : NSObject <NSCoding>
{ {
// Attributes NSInterfaceStyle interface_style;
int interface_style; NSResponder *next_responder;
id next_responder;
} }
// /*
// Instance methods * Instance methods
// */
// /*
// Managing the next responder * Managing the next responder
// */
- nextResponder; - (NSResponder*) nextResponder;
- (void)setNextResponder:aResponder; - (void) setNextResponder: (NSResponder*)aResponder;
// /*
// Determining the first responder * Determining the first responder
// */
- (BOOL)acceptsFirstResponder; - (BOOL) acceptsFirstResponder;
- (BOOL)becomeFirstResponder; - (BOOL) becomeFirstResponder;
- (BOOL)resignFirstResponder; - (BOOL) resignFirstResponder;
// /*
// Aid event processing * Aid event processing
// */
- (BOOL)performKeyEquivalent:(NSEvent *)theEvent; - (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) flagsChanged: (NSEvent *)theEvent;
- (void)helpRequested:(NSEvent *)theEvent; - (void) helpRequested: (NSEvent *)theEvent;
- (void)keyDown:(NSEvent *)theEvent; - (void) keyDown: (NSEvent *)theEvent;
- (void)keyUp:(NSEvent *)theEvent; - (void) keyUp: (NSEvent *)theEvent;
- (void)mouseDown:(NSEvent *)theEvent; - (void) mouseDown: (NSEvent *)theEvent;
- (void)mouseDragged:(NSEvent *)theEvent; - (void) mouseDragged: (NSEvent *)theEvent;
- (void)mouseEntered:(NSEvent *)theEvent; - (void) mouseEntered: (NSEvent *)theEvent;
- (void)mouseExited:(NSEvent *)theEvent; - (void) mouseExited: (NSEvent *)theEvent;
- (void)mouseMoved:(NSEvent *)theEvent; - (void) mouseMoved: (NSEvent *)theEvent;
- (void)mouseUp:(NSEvent *)theEvent; - (void) mouseUp: (NSEvent *)theEvent;
- (void)noResponderFor:(SEL)eventSelector; - (void) noResponderFor: (SEL)eventSelector;
- (void)rightMouseDown:(NSEvent *)theEvent; - (void) rightMouseDown: (NSEvent *)theEvent;
- (void)rightMouseDragged:(NSEvent *)theEvent; - (void) rightMouseDragged: (NSEvent *)theEvent;
- (void)rightMouseUp:(NSEvent *)theEvent; - (void) rightMouseUp: (NSEvent *)theEvent;
// /*
// Services menu support * Services menu support
// */
- validRequestorForSendType:(NSString *)typeSent - (id) validRequestorForSendType: (NSString *)typeSent
returnType:(NSString *)typeReturned; returnType: (NSString *)typeReturned;
// /*
// NSCoding protocol * NSCoding protocol
// */
- (void)encodeWithCoder:aCoder; - (void) encodeWithCoder: (NSCoder*)aCoder;
- initWithCoder:aDecoder; - (id) initWithCoder: (NSCoder*)aDecoder;
#ifndef STRICT_OPENSTEP
- (NSInterfaceStyle) interfaceStyle;
- (void) setInterfaceStyle: (NSInterfaceStyle)aStyle;
#endif
@end @end
#endif // _GNUstep_H_NSResponder #endif /* _GNUstep_H_NSResponder */

View file

@ -3,12 +3,14 @@
The window class 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> Author: Scott Christley <scottc@net-community.com>
Date: 1996 Date: 1996
Author: Felipe A. Rodriguez <far@ix.netcom.com> Modified: Felipe A. Rodriguez <far@ix.netcom.com>
Date: June 1998 Date: June 1998
Modified: Richard Frith-Macdonald <richard@brainstorm.co.uk>
Date: 1998,1999
This file is part of the GNUstep GUI Library. This file is part of the GNUstep GUI Library.
@ -36,22 +38,24 @@
#include <AppKit/NSResponder.h> #include <AppKit/NSResponder.h>
#include <AppKit/NSEvent.h> #include <AppKit/NSEvent.h>
@class NSString;
@class NSArray; @class NSArray;
@class NSMutableArray;
@class NSData; @class NSData;
@class NSDictionary;
@class NSNotification;
@class NSDate; @class NSDate;
@class NSDictionary;
@class NSMutableArray;
@class NSNotification;
@class NSString;
@class NSButtonCell;
@class NSColor; @class NSColor;
@class NSImage;
@class NSScreen;
@class NSEvent; @class NSEvent;
@class NSImage;
@class NSMenu;
@class NSPasteboard; @class NSPasteboard;
@class NSView;
@class NSText;
@class NSScreen; @class NSScreen;
@class NSScreen;
@class NSText;
@class NSView;
enum { enum {
NSNormalWindowLevel = 0, NSNormalWindowLevel = 0,
@ -69,12 +73,19 @@ enum {
NSResizableWindowMask = 8 NSResizableWindowMask = 8
}; };
#ifndef STRICT_OPENSTEP
typedef enum _NSSelectionDirection {
NSDirectSelection,
NSSelectingNext,
NSSelectingPrevious
} NSSelectionDirection;
#endif
extern NSSize NSIconSize; extern NSSize NSIconSize;
extern NSSize NSTokenSize; extern NSSize NSTokenSize;
@interface NSWindow : NSResponder <NSCoding> @interface NSWindow : NSResponder <NSCoding>
{ {
// Attributes
NSRect frame; NSRect frame;
NSSize minimum_size; NSSize minimum_size;
NSSize maximum_size; NSSize maximum_size;
@ -85,6 +96,7 @@ extern NSSize NSTokenSize;
id delegate; id delegate;
id _fieldEditor; id _fieldEditor;
int window_num; int window_num;
int gstate;
NSColor *background_color; NSColor *background_color;
NSString *represented_filename; NSString *represented_filename;
NSString *miniaturized_title; NSString *miniaturized_title;
@ -92,7 +104,7 @@ extern NSSize NSTokenSize;
NSString *window_title; NSString *window_title;
NSPoint last_point; NSPoint last_point;
NSBackingStoreType backing_type; NSBackingStoreType backing_type;
unsigned int style_mask; unsigned style_mask;
int window_level; int window_level;
NSRect rectBeingDrawn; NSRect rectBeingDrawn;
NSRect rectNeedingFlush; NSRect rectNeedingFlush;
@ -120,314 +132,352 @@ extern NSSize NSTokenSize;
BOOL hides_on_deactivate; BOOL hides_on_deactivate;
BOOL accepts_mouse_moved; BOOL accepts_mouse_moved;
// Reserved for back-end use /* Reserved for back-end use */
void *be_wind_reserved; void *be_wind_reserved;
} }
// /*
// Class methods * Class methods
// */
//
// Computing frame and content rectangles
//
+ (NSRect)contentRectForFrameRect:(NSRect)aRect
styleMask:(unsigned int)aStyle;
+ (NSRect)frameRectForContentRect:(NSRect)aRect /*
styleMask:(unsigned int)aStyle; * Computing frame and content rectangles
*/
+ (NSRect) contentRectForFrameRect: (NSRect)aRect
styleMask: (unsigned int)aStyle;
+ (NSRect)minFrameWidthWithTitle:(NSString *)aTitle + (NSRect) frameRectForContentRect: (NSRect)aRect
styleMask:(unsigned int)aStyle; styleMask: (unsigned int)aStyle;
// + (NSRect) minFrameWidthWithTitle: (NSString *)aTitle
// Saving and restoring the frame styleMask: (unsigned int)aStyle;
//
+ (void)removeFrameUsingName:(NSString *)name;
// /*
// Initializing and getting a new NSWindow object * Saving and restoring the frame
// */
- initWithContentRect:(NSRect)contentRect + (void) removeFrameUsingName: (NSString *)name;
styleMask:(unsigned int)aStyle
backing:(NSBackingStoreType)bufferingType
defer:(BOOL)flag;
- initWithContentRect:(NSRect)contentRect /*
styleMask:(unsigned int)aStyle * Initializing and getting a new NSWindow object
backing:(NSBackingStoreType)bufferingType */
defer:(BOOL)flag - (id) initWithContentRect: (NSRect)contentRect
screen:(NSScreen*)aScreen; styleMask: (unsigned int)aStyle
backing: (NSBackingStoreType)bufferingType
defer: (BOOL)flag;
// - (id) initWithContentRect: (NSRect)contentRect
// Accessing the content view styleMask: (unsigned int)aStyle
// backing: (NSBackingStoreType)bufferingType
defer: (BOOL)flag
screen: (NSScreen*)aScreen;
/*
* Accessing the content view
*/
- contentView; - contentView;
- (void)setContentView:(NSView *)aView; - (void) setContentView: (NSView *)aView;
// /*
// Window graphics * Window graphics
// */
- (NSColor *)backgroundColor; - (NSColor *) backgroundColor;
- (NSString *)representedFilename; - (NSString *) representedFilename;
- (void)setBackgroundColor:(NSColor *)color; - (void) setBackgroundColor: (NSColor *)color;
- (void)setRepresentedFilename:(NSString *)aString; - (void) setRepresentedFilename: (NSString *)aString;
- (void)setTitle:(NSString *)aString; - (void) setTitle: (NSString *)aString;
- (void)setTitleWithRepresentedFilename:(NSString *)aString; - (void) setTitleWithRepresentedFilename: (NSString *)aString;
- (unsigned int)styleMask; - (unsigned int) styleMask;
- (NSString *)title; - (NSString *) title;
// /*
// Window device attributes * Window device attributes
// */
- (NSBackingStoreType)backingType; - (NSBackingStoreType) backingType;
- (NSDictionary *)deviceDescription; - (NSDictionary *) deviceDescription;
- (int)gState; - (int) gState;
- (BOOL)isOneShot; - (BOOL) isOneShot;
- (void)setBackingType:(NSBackingStoreType)type; - (void) setBackingType: (NSBackingStoreType)type;
- (void)setOneShot:(BOOL)flag; - (void) setOneShot: (BOOL)flag;
- (int)windowNumber; - (int) windowNumber;
- (void)setWindowNumber:(int)windowNum;
// /*
// The miniwindow * The miniwindow
// */
- (NSImage *)miniwindowImage; - (NSImage *) miniwindowImage;
- (NSString *)miniwindowTitle; - (NSString *) miniwindowTitle;
- (void)setMiniwindowImage:(NSImage *)image; - (void) setMiniwindowImage: (NSImage *)image;
- (void)setMiniwindowTitle:(NSString *)title; - (void) setMiniwindowTitle: (NSString *)title;
// /*
// The field editor * The field editor
// */
- (void)endEditingFor:anObject; - (void) endEditingFor: anObject;
- (NSText *)fieldEditor:(BOOL)createFlag - (NSText *) fieldEditor: (BOOL)createFlag
forObject:anObject; forObject: anObject;
// /*
// Window status and ordering * Window status and ordering
// */
- (void)becomeKeyWindow; - (void) becomeKeyWindow;
- (void)becomeMainWindow; - (void) becomeMainWindow;
- (BOOL)canBecomeKeyWindow; - (BOOL) canBecomeKeyWindow;
- (BOOL)canBecomeMainWindow; - (BOOL) canBecomeMainWindow;
- (BOOL)hidesOnDeactivate; - (BOOL) hidesOnDeactivate;
- (BOOL)isKeyWindow; - (BOOL) isKeyWindow;
- (BOOL)isMainWindow; - (BOOL) isMainWindow;
- (BOOL)isMiniaturized; - (BOOL) isMiniaturized;
- (BOOL)isVisible; - (BOOL) isVisible;
- (int)level; - (int) level;
- (void)makeKeyAndOrderFront:sender; - (void) makeKeyAndOrderFront: sender;
- (void)makeKeyWindow; - (void) makeKeyWindow;
- (void)makeMainWindow; - (void) makeMainWindow;
- (void)orderBack:sender; - (void) orderBack: sender;
- (void)orderFront:sender; - (void) orderFront: sender;
- (void)orderFrontRegardless; - (void) orderFrontRegardless;
- (void)orderOut:sender; - (void) orderOut: sender;
- (void)orderWindow:(NSWindowOrderingMode)place - (void) orderWindow: (NSWindowOrderingMode)place
relativeTo:(int)otherWin; relativeTo: (int)otherWin;
- (void)resignKeyWindow; - (void) resignKeyWindow;
- (void)resignMainWindow; - (void) resignMainWindow;
- (void)setHidesOnDeactivate:(BOOL)flag; - (void) setHidesOnDeactivate: (BOOL)flag;
- (void)setLevel:(int)newLevel; - (void) setLevel: (int)newLevel;
// /*
// Moving and resizing the window * Moving and resizing the window
// */
- (NSPoint)cascadeTopLeftFromPoint:(NSPoint)topLeftPoint; - (NSPoint) cascadeTopLeftFromPoint: (NSPoint)topLeftPoint;
- (void)center; - (void) center;
- (NSRect)constrainFrameRect:(NSRect)frameRect - (NSRect) constrainFrameRect: (NSRect)frameRect
toScreen:screen; toScreen: screen;
- (NSRect)frame; - (NSRect) frame;
- (NSSize)minSize; - (NSSize) minSize;
- (NSSize)maxSize; - (NSSize) maxSize;
- (void)setContentSize:(NSSize)aSize; - (void) setContentSize: (NSSize)aSize;
- (void)setFrame:(NSRect)frameRect - (void) setFrame: (NSRect)frameRect
display:(BOOL)flag; display: (BOOL)flag;
- (void)setFrameOrigin:(NSPoint)aPoint; - (void) setFrameOrigin: (NSPoint)aPoint;
- (void)setFrameTopLeftPoint:(NSPoint)aPoint; - (void) setFrameTopLeftPoint: (NSPoint)aPoint;
- (void)setMinSize:(NSSize)aSize; - (void) setMinSize: (NSSize)aSize;
- (void)setMaxSize:(NSSize)aSize; - (void) setMaxSize: (NSSize)aSize;
- (void)setResizeIncrements:(NSSize)aSize;
// /*
// Converting coordinates * Converting coordinates
// */
- (NSPoint)convertBaseToScreen:(NSPoint)aPoint; - (NSPoint) convertBaseToScreen: (NSPoint)aPoint;
- (NSPoint)convertScreenToBase:(NSPoint)aPoint; - (NSPoint) convertScreenToBase: (NSPoint)aPoint;
// /*
// Managing the display * Managing the display
// */
- (void)display; - (void) display;
- (void)disableFlushWindow; - (void) disableFlushWindow;
- (void)displayIfNeeded; - (void) displayIfNeeded;
- (void)enableFlushWindow; - (void) enableFlushWindow;
- (void)flushWindow; - (void) flushWindow;
- (void)flushWindowIfNeeded; - (void) flushWindowIfNeeded;
- (BOOL)isAutodisplay; - (BOOL) isAutodisplay;
- (BOOL)isFlushWindowDisabled; - (BOOL) isFlushWindowDisabled;
- (void)setAutodisplay:(BOOL)flag; - (void) setAutodisplay: (BOOL)flag;
- (void)setViewsNeedDisplay:(BOOL)flag; - (void) setViewsNeedDisplay: (BOOL)flag;
- (void)update; - (void) update;
- (void)useOptimizedDrawing:(BOOL)flag; - (void) useOptimizedDrawing: (BOOL)flag;
- (BOOL)viewsNeedDisplay; - (BOOL) viewsNeedDisplay;
// /*
// Screens and window depths * Screens and window depths
// */
+ (NSWindowDepth)defaultDepthLimit; + (NSWindowDepth) defaultDepthLimit;
- (BOOL)canStoreColor; - (BOOL) canStoreColor;
- (NSScreen *)deepestScreen; - (NSScreen *) deepestScreen;
- (NSWindowDepth)depthLimit; - (NSWindowDepth) depthLimit;
- (BOOL)hasDynamicDepthLimit; - (BOOL) hasDynamicDepthLimit;
- (NSScreen *)screen; - (NSScreen *) screen;
- (void)setDepthLimit:(NSWindowDepth)limit; - (void) setDepthLimit: (NSWindowDepth)limit;
- (void)setDynamicDepthLimit:(BOOL)flag; - (void) setDynamicDepthLimit: (BOOL)flag;
// /*
// Cursor management * Cursor management
// */
- (BOOL)areCursorRectsEnabled; - (BOOL) areCursorRectsEnabled;
- (void)disableCursorRects; - (void) disableCursorRects;
- (void)discardCursorRects; - (void) discardCursorRects;
- (void)enableCursorRects; - (void) enableCursorRects;
- (void)invalidateCursorRectsForView:(NSView *)aView; - (void) invalidateCursorRectsForView: (NSView *)aView;
- (void)resetCursorRects; - (void) resetCursorRects;
// /*
// Handling user actions and events * Handling user actions and events
// */
- (void)close; - (void) close;
- (void)deminiaturize:sender; - (void) deminiaturize: sender;
- (BOOL)isDocumentEdited; - (BOOL) isDocumentEdited;
- (BOOL)isReleasedWhenClosed; - (BOOL) isReleasedWhenClosed;
- (void)miniaturize:sender; - (void) miniaturize: sender;
- (void)performClose:sender; - (void) performClose: sender;
- (void)performMiniaturize:sender; - (void) performMiniaturize: sender;
- (int)resizeFlags; - (int) resizeFlags;
- (void)setDocumentEdited:(BOOL)flag; - (void) setDocumentEdited: (BOOL)flag;
- (void)setReleasedWhenClosed:(BOOL)flag; - (void) setReleasedWhenClosed: (BOOL)flag;
// /*
// Aiding event handling * Aiding event handling
// */
- (BOOL)acceptsMouseMovedEvents; - (BOOL) acceptsMouseMovedEvents;
- (NSEvent *)currentEvent; - (NSEvent *) currentEvent;
- (void)discardEventsMatchingMask:(unsigned int)mask - (void) discardEventsMatchingMask: (unsigned int)mask
beforeEvent:(NSEvent *)lastEvent; beforeEvent: (NSEvent *)lastEvent;
- (NSResponder *)firstResponder; - (NSResponder *) firstResponder;
- (BOOL)makeFirstResponder:(NSResponder *)aResponder; - (void) keyDown: (NSEvent *)theEvent;
- (NSPoint)mouseLocationOutsideOfEventStream; - (BOOL) makeFirstResponder: (NSResponder *)aResponder;
- (NSEvent *)nextEventMatchingMask:(unsigned int)mask; - (NSPoint) mouseLocationOutsideOfEventStream;
- (NSEvent *)nextEventMatchingMask:(unsigned int)mask - (NSEvent *) nextEventMatchingMask: (unsigned int)mask;
untilDate:(NSDate *)expiration - (NSEvent *) nextEventMatchingMask: (unsigned int)mask
inMode:(NSString *)mode untilDate: (NSDate *)expiration
dequeue:(BOOL)deqFlag; inMode: (NSString *)mode
- (void)postEvent:(NSEvent *)event dequeue: (BOOL)deqFlag;
atStart:(BOOL)flag; - (void) postEvent: (NSEvent *)event
- (void)setAcceptsMouseMovedEvents:(BOOL)flag; atStart: (BOOL)flag;
- (void)sendEvent:(NSEvent *)theEvent; - (void) setAcceptsMouseMovedEvents: (BOOL)flag;
- (BOOL)tryToPerform:(SEL)anAction with:anObject; - (void) sendEvent: (NSEvent *)theEvent;
- (BOOL)worksWhenModal; - (BOOL) tryToPerform: (SEL)anAction with: anObject;
- (BOOL) worksWhenModal;
// /*
// Dragging * Dragging
// */
- (void)dragImage:(NSImage *)anImage - (void) dragImage: (NSImage *)anImage
at:(NSPoint)baseLocation at: (NSPoint)baseLocation
offset:(NSSize)initialOffset offset: (NSSize)initialOffset
event:(NSEvent *)event event: (NSEvent *)event
pasteboard:(NSPasteboard *)pboard pasteboard: (NSPasteboard *)pboard
source:sourceObject source: sourceObject
slideBack:(BOOL)slideFlag; slideBack: (BOOL)slideFlag;
- (void)registerForDraggedTypes:(NSArray *)newTypes; - (void) registerForDraggedTypes: (NSArray *)newTypes;
- (void)unregisterDraggedTypes; - (void) unregisterDraggedTypes;
// /*
// Services and windows menu support * Services and windows menu support
// */
- (BOOL)isExcludedFromWindowsMenu; - (BOOL) isExcludedFromWindowsMenu;
- (void)setExcludedFromWindowsMenu:(BOOL)flag; - (void) setExcludedFromWindowsMenu: (BOOL)flag;
- validRequestorForSendType:(NSString *)sendType - (id) validRequestorForSendType: (NSString *)sendType
returnType:(NSString *)returnType; returnType: (NSString *)returnType;
// /*
// Saving and restoring the frame * Saving and restoring the frame
// */
- (NSString *)frameAutosaveName; - (NSString *) frameAutosaveName;
- (void)saveFrameUsingName:(NSString *)name; - (void) saveFrameUsingName: (NSString *)name;
- (BOOL)setFrameAutosaveName:(NSString *)name; - (BOOL) setFrameAutosaveName: (NSString *)name;
- (void)setFrameFromString:(NSString *)string; - (void) setFrameFromString: (NSString *)string;
- (BOOL)setFrameUsingName:(NSString *)name; - (BOOL) setFrameUsingName: (NSString *)name;
- (NSString *)stringWithSavedFrame; - (NSString *) stringWithSavedFrame;
// /*
// Printing and postscript * Printing and postscript
// */
- (NSData *)dataWithEPSInsideRect:(NSRect)rect; - (NSData *) dataWithEPSInsideRect: (NSRect)rect;
- (void)fax:sender; - (void) fax: sender;
- (void)print:sender; - (void) print: sender;
// /*
// Assigning a delegate * Assigning a delegate
// */
- delegate; - (id) delegate;
- (void)setDelegate:anObject; - (void) setDelegate: anObject;
// /*
// Implemented by the delegate * Implemented by the delegate
// */
- (BOOL)windowShouldClose:sender; - (BOOL) windowShouldClose: sender;
- (NSSize)windowWillResize:(NSWindow *)sender #ifndef STRICT_OPENSTEP
toSize:(NSSize)frameSize; - (BOOL) windowShouldZoom: (NSWindow*)sender
- windowWillReturnFieldEditor:(NSWindow *)sender toFrame: (NSRect)aFrame;
toObject:client; - (NSRect) windowWillUseStandardFrame: (NSWindow*)sender
- (void)windowDidBecomeKey:(NSNotification *)aNotification; defaultFrame: (NSRect)aFrame;
- (void)windowDidBecomeMain:(NSNotification *)aNotification; #endif
- (void)windowDidChangeScreen:(NSNotification *)aNotification; - (NSSize) windowWillResize: (NSWindow *)sender
- (void)windowDidDeminiaturize:(NSNotification *)aNotification; toSize: (NSSize)frameSize;
- (void)windowDidExpose:(NSNotification *)aNotification; - (id) windowWillReturnFieldEditor: (NSWindow *)sender
- (void)windowDidMiniaturize:(NSNotification *)aNotification; toObject: client;
- (void)windowDidMove:(NSNotification *)aNotification; - (void) windowDidBecomeKey: (NSNotification *)aNotification;
- (void)windowDidResignKey:(NSNotification *)aNotification; - (void) windowDidBecomeMain: (NSNotification *)aNotification;
- (void)windowDidResignMain:(NSNotification *)aNotification; - (void) windowDidChangeScreen: (NSNotification *)aNotification;
- (void)windowDidResize:(NSNotification *)aNotification; - (void) windowDidDeminiaturize: (NSNotification *)aNotification;
- (void)windowDidUpdate:(NSNotification *)aNotification; - (void) windowDidExpose: (NSNotification *)aNotification;
- (void)windowWillClose:(NSNotification *)aNotification; - (void) windowDidMiniaturize: (NSNotification *)aNotification;
- (void)windowWillMiniaturize:(NSNotification *)aNotification; - (void) windowDidMove: (NSNotification *)aNotification;
- (void)windowWillMove:(NSNotification *)aNotification; - (void) windowDidResignKey: (NSNotification *)aNotification;
- (void) windowDidResignMain: (NSNotification *)aNotification;
- (void) windowDidResize: (NSNotification *)aNotification;
- (void) windowDidUpdate: (NSNotification *)aNotification;
- (void) windowWillClose: (NSNotification *)aNotification;
- (void) windowWillMiniaturize: (NSNotification *)aNotification;
- (void) windowWillMove: (NSNotification *)aNotification;
// /*
// NSCoding methods * NSCoding methods
// */
- (void)encodeWithCoder:aCoder; - (void) encodeWithCoder: (NSCoder*)aCoder;
- initWithCoder:aDecoder; - (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 @end
// #ifndef NO_GNUSTEP
// GNUstep backend methods /*
// * GNUstep backend methods
*/
@interface NSWindow (GNUstepBackend) @interface NSWindow (GNUstepBackend)
+ (NSWindow*)_windowWithTag:(int)windowNumber; + (NSWindow*) _windowWithTag: (int)windowNumber;
// - (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 * Mouse capture/release
- (void)initDefaults; */
- cleanInit; - (void) _captureMouse: sender;
- (void) _releaseMouse: sender;
- (void)performDeminiaturize:sender; /*
- (void)performHide:sender; * Allow subclasses to init without the backend class
- (void)performUnhide:sender; * attempting to create an actual window
*/
- (void) initDefaults;
- (id) cleanInit;
- (void) performDeminiaturize: sender;
- (void) performHide: sender;
- (void) performUnhide: sender;
@end @end
#endif
/* Notifications */ /* Notifications */
extern NSString *NSWindowDidBecomeKeyNotification; extern NSString *NSWindowDidBecomeKeyNotification;
@ -445,4 +495,4 @@ extern NSString *NSWindowWillCloseNotification;
extern NSString *NSWindowWillMiniaturizeNotification; extern NSString *NSWindowWillMiniaturizeNotification;
extern NSString *NSWindowWillMoveNotification; extern NSString *NSWindowWillMoveNotification;
#endif // _GNUstep_H_NSWindow #endif /* _GNUstep_H_NSWindow */

View file

@ -3,7 +3,7 @@
Abstract class which is basis of command and event processing 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> Author: Scott Christley <scottc@net-community.com>
Date: 1996 Date: 1996
@ -34,210 +34,209 @@
@implementation NSResponder @implementation NSResponder
// /*
// Class methods * Class methods
// */
+ (void)initialize + (void) initialize
{ {
if (self == [NSResponder class]) if (self == [NSResponder class])
{ {
NSDebugLog(@"Initialize NSResponder class\n"); NSDebugLog(@"Initialize NSResponder class\n");
// Initial version [self setVersion: 1];
[self setVersion:1];
} }
} }
// /*
// Instance methods * Instance methods
// */
// /*
// Managing the next responder * Managing the next responder
// */
- nextResponder - (id) nextResponder
{ {
return next_responder; return next_responder;
} }
- (void)setNextResponder:aResponder - (void) setNextResponder: (NSResponder*)aResponder
{ {
next_responder = aResponder; next_responder = aResponder;
} }
// /*
// Determining the first responder * Determining the first responder
// */
- (BOOL)acceptsFirstResponder - (BOOL) acceptsFirstResponder
{ {
return NO; return NO;
} }
- (BOOL)becomeFirstResponder - (BOOL) becomeFirstResponder
{ {
return YES; return YES;
} }
- (BOOL)resignFirstResponder - (BOOL) resignFirstResponder
{ {
return YES; return YES;
} }
// /*
// Aid event processing * Aid event processing
// */
- (BOOL)performKeyEquivalent:(NSEvent *)theEvent - (BOOL) performKeyEquivalent: (NSEvent *)theEvent
{ {
return NO; 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]) if ([self respondsToSelector: anAction])
{ {
[self performSelector:anAction withObject:anObject]; [self performSelector: anAction withObject: anObject];
return YES; return YES;
} }
else else
{ {
// If we cannot perform then try the next responder /* If we cannot perform then try the next responder */
if (!next_responder) if (!next_responder)
return NO; return NO;
else else
return [next_responder tryToPerform:anAction with:anObject]; return [next_responder tryToPerform: anAction with: anObject];
} }
} }
// /*
// Forwarding event messages * Forwarding event messages
// */
- (void)flagsChanged:(NSEvent *)theEvent - (void) flagsChanged: (NSEvent *)theEvent
{ {
if (next_responder) if (next_responder)
return [next_responder flagsChanged:theEvent]; return [next_responder flagsChanged: theEvent];
else else
return [self noResponderFor:@selector(flagsChanged:)]; return [self noResponderFor: @selector(flagsChanged: )];
} }
- (void)helpRequested:(NSEvent *)theEvent - (void) helpRequested: (NSEvent *)theEvent
{ {
if (next_responder) if (next_responder)
return [next_responder helpRequested:theEvent]; return [next_responder helpRequested: theEvent];
else else
return [self noResponderFor:@selector(helpRequested:)]; return [self noResponderFor: @selector(helpRequested: )];
} }
- (void)keyDown:(NSEvent *)theEvent - (void) keyDown: (NSEvent *)theEvent
{ {
if (next_responder) if (next_responder)
return [next_responder keyDown:theEvent]; return [next_responder keyDown: theEvent];
else else
return [self noResponderFor:@selector(keyDown:)]; return [self noResponderFor: @selector(keyDown: )];
} }
- (void)keyUp:(NSEvent *)theEvent - (void) keyUp: (NSEvent *)theEvent
{ {
if (next_responder) if (next_responder)
return [next_responder keyUp:theEvent]; return [next_responder keyUp: theEvent];
else else
return [self noResponderFor:@selector(keyUp:)]; return [self noResponderFor: @selector(keyUp: )];
} }
- (void)mouseDown:(NSEvent *)theEvent - (void) mouseDown: (NSEvent *)theEvent
{ {
if (next_responder) if (next_responder)
return [next_responder mouseDown:theEvent]; return [next_responder mouseDown: theEvent];
else else
return [self noResponderFor:@selector(mouseDown:)]; return [self noResponderFor: @selector(mouseDown: )];
} }
- (void)mouseDragged:(NSEvent *)theEvent - (void) mouseDragged: (NSEvent *)theEvent
{ {
if (next_responder) if (next_responder)
return [next_responder mouseDragged:theEvent]; return [next_responder mouseDragged: theEvent];
else else
return [self noResponderFor:@selector(mouseDragged:)]; return [self noResponderFor: @selector(mouseDragged: )];
} }
- (void)mouseEntered:(NSEvent *)theEvent - (void) mouseEntered: (NSEvent *)theEvent
{ {
if (next_responder) if (next_responder)
return [next_responder mouseEntered:theEvent]; return [next_responder mouseEntered: theEvent];
else else
return [self noResponderFor:@selector(mouseEntered:)]; return [self noResponderFor: @selector(mouseEntered: )];
} }
- (void)mouseExited:(NSEvent *)theEvent - (void) mouseExited: (NSEvent *)theEvent
{ {
if (next_responder) if (next_responder)
return [next_responder mouseExited:theEvent]; return [next_responder mouseExited: theEvent];
else else
return [self noResponderFor:@selector(mouseExited:)]; return [self noResponderFor: @selector(mouseExited: )];
} }
- (void)mouseMoved:(NSEvent *)theEvent - (void) mouseMoved: (NSEvent *)theEvent
{ {
if (next_responder) if (next_responder)
return [next_responder mouseMoved:theEvent]; return [next_responder mouseMoved: theEvent];
else else
return [self noResponderFor:@selector(mouseMoved:)]; return [self noResponderFor: @selector(mouseMoved: )];
} }
- (void)mouseUp:(NSEvent *)theEvent - (void) mouseUp: (NSEvent *)theEvent
{ {
if (next_responder) if (next_responder)
return [next_responder mouseUp:theEvent]; return [next_responder mouseUp: theEvent];
else else
return [self noResponderFor:@selector(mouseUp:)]; return [self noResponderFor: @selector(mouseUp: )];
} }
- (void)noResponderFor:(SEL)eventSelector - (void) noResponderFor: (SEL)eventSelector
{ {
// Only beep for key down events /* Only beep for key down events */
if (sel_eq(eventSelector, @selector(keyDown:))) if (sel_eq(eventSelector, @selector(keyDown: )))
NSBeep(); NSBeep();
} }
- (void)rightMouseDown:(NSEvent *)theEvent - (void) rightMouseDown: (NSEvent *)theEvent
{ {
if (next_responder) if (next_responder)
return [next_responder rightMouseDown:theEvent]; return [next_responder rightMouseDown: theEvent];
else else
return [self noResponderFor:@selector(rightMouseDown:)]; return [self noResponderFor: @selector(rightMouseDown: )];
} }
- (void)rightMouseDragged:(NSEvent *)theEvent - (void) rightMouseDragged: (NSEvent *)theEvent
{ {
if (next_responder) if (next_responder)
return [next_responder rightMouseDragged:theEvent]; return [next_responder rightMouseDragged: theEvent];
else else
return [self noResponderFor:@selector(rightMouseDragged:)]; return [self noResponderFor: @selector(rightMouseDragged: )];
} }
- (void)rightMouseUp:(NSEvent *)theEvent - (void) rightMouseUp: (NSEvent *)theEvent
{ {
if (next_responder) if (next_responder)
return [next_responder rightMouseUp:theEvent]; return [next_responder rightMouseUp: theEvent];
else else
return [self noResponderFor:@selector(rightMouseUp:)]; return [self noResponderFor: @selector(rightMouseUp: )];
} }
// /*
// Services menu support * Services menu support
// */
- validRequestorForSendType:(NSString *)typeSent - (id) validRequestorForSendType: (NSString *)typeSent
returnType:(NSString *)typeReturned returnType: (NSString *)typeReturned
{ {
if (next_responder) if (next_responder)
return [next_responder validRequestorForSendType:typeSent return [next_responder validRequestorForSendType: typeSent
returnType:typeReturned]; returnType: typeReturned];
else else
return nil; return nil;
} }
// /*
// NSCoding protocol * NSCoding protocol
// */
- (void) encodeWithCoder: (NSCoder*)aCoder - (void) encodeWithCoder: (NSCoder*)aCoder
{ {
[aCoder encodeConditionalObject: next_responder]; [aCoder encodeConditionalObject: next_responder];
@ -246,8 +245,17 @@
- (id) initWithCoder: (NSCoder*)aDecoder - (id) initWithCoder: (NSCoder*)aDecoder
{ {
next_responder = [aDecoder decodeObject]; next_responder = [aDecoder decodeObject];
return self; return self;
} }
- (NSInterfaceStyle) interfaceStyle
{
return interface_style;
}
- (void) setInterfaceStyle: (NSInterfaceStyle)aStyle
{
interface_style = aStyle;
}
@end @end

View file

@ -226,7 +226,10 @@
// //
// Accessing the content view // Accessing the content view
// //
- contentView { return content_view; } - (id) contentView
{
return content_view;
}
- (void) setContentView: (NSView *)aView - (void) setContentView: (NSView *)aView
{ {
@ -328,7 +331,7 @@
- (int) gState - (int) gState
{ {
return 0; return gstate;
} }
- (BOOL) isOneShot - (BOOL) isOneShot
@ -351,11 +354,6 @@
return window_num; return window_num;
} }
- (void) setWindowNumber: (int)windowNum
{
window_num = windowNum;
}
// //
// The miniwindow // The miniwindow
// //
@ -618,6 +616,11 @@
maximum_size = aSize; maximum_size = aSize;
} }
- (NSSize) resizeIncrements
{
return increments;
}
- (void) setResizeIncrements: (NSSize)aSize - (void) setResizeIncrements: (NSSize)aSize
{ {
increments = aSize; increments = aSize;
@ -879,8 +882,15 @@
[nc postNotificationName: NSWindowDidDeminiaturizeNotification object: self]; [nc postNotificationName: NSWindowDidDeminiaturizeNotification object: self];
} }
- (BOOL) isDocumentEdited { return is_edited; } - (BOOL) isDocumentEdited
- (BOOL) isReleasedWhenClosed { return is_released_when_closed; } {
return is_edited;
}
- (BOOL) isReleasedWhenClosed
{
return is_released_when_closed;
}
- (void) miniaturize: sender - (void) miniaturize: sender
{ {
@ -894,33 +904,42 @@
- (void) performClose: sender - (void) performClose: sender
{ {
/* self must have a close button in order to be closed */
if (!([self styleMask] & NSClosableWindowMask)) if (!([self styleMask] & NSClosableWindowMask))
{ // self must have a close {
NSBeep(); // button in order to be NSBeep();
return; // closed return;
} }
if ([delegate respondsToSelector: @selector(windowShouldClose:)]) if ([delegate respondsToSelector: @selector(windowShouldClose:)])
{ // if delegate responds to {
if (![delegate windowShouldClose: self]) // windowShouldClose query /*
{ // it to see if it's ok to * if delegate responds to windowShouldClose query it to see if
NSBeep(); // close the window * it's ok to close the window
*/
if (![delegate windowShouldClose: self])
{
NSBeep();
return; return;
} }
} }
else else
{ {
/*
* else if self responds to windowShouldClose query
* self to see if it's ok to close self
*/
if ([self respondsToSelector: @selector(windowShouldClose:)]) if ([self respondsToSelector: @selector(windowShouldClose:)])
{ // else if self responds to {
if (![self windowShouldClose: self]) // windowShouldClose query if (![self windowShouldClose: self])
{ // self to see if it's ok {
NSBeep(); // to close self NSBeep();
return; return;
} }
} }
} }
[self close]; // it's ok to close self [self close];
} }
- (void) performMiniaturize: (id)sender - (void) performMiniaturize: (id)sender
@ -1635,6 +1654,16 @@
return self; return self;
} }
- (NSInterfaceStyle) interfaceStyle
{
return interface_style;
}
- (void) setInterfaceStyle: (NSInterfaceStyle)aStyle
{
interface_style = aStyle;
}
@end @end
// //
@ -1647,6 +1676,11 @@
return nil; return nil;
} }
- (void) setWindowNumber: (int)windowNum
{
window_num = windowNum;
}
// //
// Mouse capture/release // Mouse capture/release
// //
@ -1657,13 +1691,17 @@
- (void) performHide: sender {} - (void) performHide: sender {}
- (void) performUnhide: sender {} - (void) performUnhide: sender {}
- (void) initDefaults // Allow subclasses to init /*
{ // without the backend * Allow subclasses to init without the backend
first_responder = nil; // class attempting to * class attempting to create an actual window
original_responder = nil; // create an actual window */
- (void) initDefaults
{
first_responder = nil;
original_responder = nil;
delegate = nil; delegate = nil;
window_num = 0; window_num = 0;
background_color = [[NSColor lightGrayColor] retain]; background_color = [[NSColor controlColor] retain];
represented_filename = @"Window"; represented_filename = @"Window";
miniaturized_title = @"Window"; miniaturized_title = @"Window";
miniaturized_image = nil; miniaturized_image = nil;