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>
* Source/NSButtonCell.m: ([-drawWithFrame:inView:]) and

View file

@ -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,70 +30,74 @@
#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
//
- (BOOL)acceptsFirstResponder;
- (BOOL)becomeFirstResponder;
- (BOOL)resignFirstResponder;
/*
* Determining the first responder
*/
- (BOOL) acceptsFirstResponder;
- (BOOL) becomeFirstResponder;
- (BOOL) resignFirstResponder;
//
// Aid event processing
//
- (BOOL)performKeyEquivalent:(NSEvent *)theEvent;
- (BOOL)tryToPerform:(SEL)anAction with:anObject;
/*
* 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;
- (void)rightMouseDown:(NSEvent *)theEvent;
- (void)rightMouseDragged:(NSEvent *)theEvent;
- (void)rightMouseUp:(NSEvent *)theEvent;
/*
* 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;
- (void) rightMouseDown: (NSEvent *)theEvent;
- (void) rightMouseDragged: (NSEvent *)theEvent;
- (void) rightMouseUp: (NSEvent *)theEvent;
//
// Services menu support
//
- validRequestorForSendType:(NSString *)typeSent
returnType:(NSString *)typeReturned;
/*
* 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 */

View file

@ -1,22 +1,24 @@
/*
/*
NSWindow.h
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.
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
@ -26,7 +28,7 @@
License along with this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
*/
#ifndef _GNUstep_H_NSWindow
#define _GNUstep_H_NSWindow
@ -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,365 +73,411 @@ 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;
NSSize increments;
id content_view;
id first_responder;
id original_responder;
id delegate;
id _fieldEditor;
int window_num;
NSColor *background_color;
NSString *represented_filename;
NSString *miniaturized_title;
NSImage *miniaturized_image;
NSString *window_title;
NSPoint last_point;
NSRect frame;
NSSize minimum_size;
NSSize maximum_size;
NSSize increments;
id content_view;
id first_responder;
id original_responder;
id delegate;
id _fieldEditor;
int window_num;
int gstate;
NSColor *background_color;
NSString *represented_filename;
NSString *miniaturized_title;
NSImage *miniaturized_image;
NSString *window_title;
NSPoint last_point;
NSBackingStoreType backing_type;
unsigned int style_mask;
int window_level;
NSRect rectBeingDrawn;
NSRect rectNeedingFlush;
unsigned style_mask;
int window_level;
NSRect rectBeingDrawn;
NSRect rectNeedingFlush;
BOOL is_one_shot;
BOOL needs_display;
BOOL needs_flush;
BOOL is_autodisplay;
BOOL optimize_drawing;
BOOL views_need_display;
BOOL is_one_shot;
BOOL needs_display;
BOOL needs_flush;
BOOL is_autodisplay;
BOOL optimize_drawing;
BOOL views_need_display;
NSWindowDepth depth_limit;
BOOL dynamic_depth_limit;
BOOL dynamic_depth_limit;
BOOL cursor_rects_enabled;
BOOL cursor_rects_valid;
BOOL cursor_rects_enabled;
BOOL cursor_rects_valid;
BOOL visible;
BOOL is_key;
BOOL is_main;
BOOL is_edited;
BOOL is_released_when_closed;
BOOL is_miniaturized;
BOOL disable_flush_window;
BOOL menu_exclude;
BOOL hides_on_deactivate;
BOOL accepts_mouse_moved;
BOOL visible;
BOOL is_key;
BOOL is_main;
BOOL is_edited;
BOOL is_released_when_closed;
BOOL is_miniaturized;
BOOL disable_flush_window;
BOOL menu_exclude;
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
//
+ (NSRect)contentRectForFrameRect:(NSRect)aRect
styleMask:(unsigned int)aStyle;
/*
* Class methods
*/
+ (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
styleMask:(unsigned int)aStyle;
+ (NSRect) frameRectForContentRect: (NSRect)aRect
styleMask: (unsigned int)aStyle;
//
// Saving and restoring the frame
//
+ (void)removeFrameUsingName:(NSString *)name;
+ (NSRect) minFrameWidthWithTitle: (NSString *)aTitle
styleMask: (unsigned int)aStyle;
//
// Initializing and getting a new NSWindow object
//
- initWithContentRect:(NSRect)contentRect
styleMask:(unsigned int)aStyle
backing:(NSBackingStoreType)bufferingType
defer:(BOOL)flag;
/*
* Saving and restoring the frame
*/
+ (void) removeFrameUsingName: (NSString *)name;
- initWithContentRect:(NSRect)contentRect
styleMask:(unsigned int)aStyle
backing:(NSBackingStoreType)bufferingType
defer:(BOOL)flag
screen:(NSScreen*)aScreen;
/*
* Initializing and getting a new NSWindow object
*/
- (id) initWithContentRect: (NSRect)contentRect
styleMask: (unsigned int)aStyle
backing: (NSBackingStoreType)bufferingType
defer: (BOOL)flag;
//
// Accessing the content view
//
- (id) initWithContentRect: (NSRect)contentRect
styleMask: (unsigned int)aStyle
backing: (NSBackingStoreType)bufferingType
defer: (BOOL)flag
screen: (NSScreen*)aScreen;
/*
* Accessing the content view
*/
- contentView;
- (void)setContentView:(NSView *)aView;
- (void) setContentView: (NSView *)aView;
//
// Window graphics
//
- (NSColor *)backgroundColor;
- (NSString *)representedFilename;
- (void)setBackgroundColor:(NSColor *)color;
- (void)setRepresentedFilename:(NSString *)aString;
- (void)setTitle:(NSString *)aString;
- (void)setTitleWithRepresentedFilename:(NSString *)aString;
- (unsigned int)styleMask;
- (NSString *)title;
/*
* Window graphics
*/
- (NSColor *) backgroundColor;
- (NSString *) representedFilename;
- (void) setBackgroundColor: (NSColor *)color;
- (void) setRepresentedFilename: (NSString *)aString;
- (void) setTitle: (NSString *)aString;
- (void) setTitleWithRepresentedFilename: (NSString *)aString;
- (unsigned int) styleMask;
- (NSString *) title;
//
// Window device attributes
//
- (NSBackingStoreType)backingType;
- (NSDictionary *)deviceDescription;
- (int)gState;
- (BOOL)isOneShot;
- (void)setBackingType:(NSBackingStoreType)type;
- (void)setOneShot:(BOOL)flag;
- (int)windowNumber;
- (void)setWindowNumber:(int)windowNum;
/*
* Window device attributes
*/
- (NSBackingStoreType) backingType;
- (NSDictionary *) deviceDescription;
- (int) gState;
- (BOOL) isOneShot;
- (void) setBackingType: (NSBackingStoreType)type;
- (void) setOneShot: (BOOL)flag;
- (int) windowNumber;
//
// The miniwindow
//
- (NSImage *)miniwindowImage;
- (NSString *)miniwindowTitle;
- (void)setMiniwindowImage:(NSImage *)image;
- (void)setMiniwindowTitle:(NSString *)title;
/*
* The miniwindow
*/
- (NSImage *) miniwindowImage;
- (NSString *) miniwindowTitle;
- (void) setMiniwindowImage: (NSImage *)image;
- (void) setMiniwindowTitle: (NSString *)title;
//
// The field editor
//
- (void)endEditingFor:anObject;
- (NSText *)fieldEditor:(BOOL)createFlag
forObject:anObject;
/*
* The field editor
*/
- (void) endEditingFor: anObject;
- (NSText *) fieldEditor: (BOOL)createFlag
forObject: anObject;
//
// Window status and ordering
//
- (void)becomeKeyWindow;
- (void)becomeMainWindow;
- (BOOL)canBecomeKeyWindow;
- (BOOL)canBecomeMainWindow;
- (BOOL)hidesOnDeactivate;
- (BOOL)isKeyWindow;
- (BOOL)isMainWindow;
- (BOOL)isMiniaturized;
- (BOOL)isVisible;
- (int)level;
- (void)makeKeyAndOrderFront:sender;
- (void)makeKeyWindow;
- (void)makeMainWindow;
- (void)orderBack:sender;
- (void)orderFront:sender;
- (void)orderFrontRegardless;
- (void)orderOut:sender;
- (void)orderWindow:(NSWindowOrderingMode)place
relativeTo:(int)otherWin;
- (void)resignKeyWindow;
- (void)resignMainWindow;
- (void)setHidesOnDeactivate:(BOOL)flag;
- (void)setLevel:(int)newLevel;
/*
* Window status and ordering
*/
- (void) becomeKeyWindow;
- (void) becomeMainWindow;
- (BOOL) canBecomeKeyWindow;
- (BOOL) canBecomeMainWindow;
- (BOOL) hidesOnDeactivate;
- (BOOL) isKeyWindow;
- (BOOL) isMainWindow;
- (BOOL) isMiniaturized;
- (BOOL) isVisible;
- (int) level;
- (void) makeKeyAndOrderFront: sender;
- (void) makeKeyWindow;
- (void) makeMainWindow;
- (void) orderBack: sender;
- (void) orderFront: sender;
- (void) orderFrontRegardless;
- (void) orderOut: sender;
- (void) orderWindow: (NSWindowOrderingMode)place
relativeTo: (int)otherWin;
- (void) resignKeyWindow;
- (void) resignMainWindow;
- (void) setHidesOnDeactivate: (BOOL)flag;
- (void) setLevel: (int)newLevel;
//
// Moving and resizing the window
//
- (NSPoint)cascadeTopLeftFromPoint:(NSPoint)topLeftPoint;
- (void)center;
- (NSRect)constrainFrameRect:(NSRect)frameRect
toScreen:screen;
- (NSRect)frame;
- (NSSize)minSize;
- (NSSize)maxSize;
- (void)setContentSize:(NSSize)aSize;
- (void)setFrame:(NSRect)frameRect
display:(BOOL)flag;
- (void)setFrameOrigin:(NSPoint)aPoint;
- (void)setFrameTopLeftPoint:(NSPoint)aPoint;
- (void)setMinSize:(NSSize)aSize;
- (void)setMaxSize:(NSSize)aSize;
- (void)setResizeIncrements:(NSSize)aSize;
/*
* Moving and resizing the window
*/
- (NSPoint) cascadeTopLeftFromPoint: (NSPoint)topLeftPoint;
- (void) center;
- (NSRect) constrainFrameRect: (NSRect)frameRect
toScreen: screen;
- (NSRect) frame;
- (NSSize) minSize;
- (NSSize) maxSize;
- (void) setContentSize: (NSSize)aSize;
- (void) setFrame: (NSRect)frameRect
display: (BOOL)flag;
- (void) setFrameOrigin: (NSPoint)aPoint;
- (void) setFrameTopLeftPoint: (NSPoint)aPoint;
- (void) setMinSize: (NSSize)aSize;
- (void) setMaxSize: (NSSize)aSize;
//
// Converting coordinates
//
- (NSPoint)convertBaseToScreen:(NSPoint)aPoint;
- (NSPoint)convertScreenToBase:(NSPoint)aPoint;
/*
* Converting coordinates
*/
- (NSPoint) convertBaseToScreen: (NSPoint)aPoint;
- (NSPoint) convertScreenToBase: (NSPoint)aPoint;
//
// Managing the display
//
- (void)display;
- (void)disableFlushWindow;
- (void)displayIfNeeded;
- (void)enableFlushWindow;
- (void)flushWindow;
- (void)flushWindowIfNeeded;
- (BOOL)isAutodisplay;
- (BOOL)isFlushWindowDisabled;
- (void)setAutodisplay:(BOOL)flag;
- (void)setViewsNeedDisplay:(BOOL)flag;
- (void)update;
- (void)useOptimizedDrawing:(BOOL)flag;
- (BOOL)viewsNeedDisplay;
/*
* Managing the display
*/
- (void) display;
- (void) disableFlushWindow;
- (void) displayIfNeeded;
- (void) enableFlushWindow;
- (void) flushWindow;
- (void) flushWindowIfNeeded;
- (BOOL) isAutodisplay;
- (BOOL) isFlushWindowDisabled;
- (void) setAutodisplay: (BOOL)flag;
- (void) setViewsNeedDisplay: (BOOL)flag;
- (void) update;
- (void) useOptimizedDrawing: (BOOL)flag;
- (BOOL) viewsNeedDisplay;
//
// Screens and window depths
//
+ (NSWindowDepth)defaultDepthLimit;
- (BOOL)canStoreColor;
- (NSScreen *)deepestScreen;
- (NSWindowDepth)depthLimit;
- (BOOL)hasDynamicDepthLimit;
- (NSScreen *)screen;
- (void)setDepthLimit:(NSWindowDepth)limit;
- (void)setDynamicDepthLimit:(BOOL)flag;
/*
* Screens and window depths
*/
+ (NSWindowDepth) defaultDepthLimit;
- (BOOL) canStoreColor;
- (NSScreen *) deepestScreen;
- (NSWindowDepth) depthLimit;
- (BOOL) hasDynamicDepthLimit;
- (NSScreen *) screen;
- (void) setDepthLimit: (NSWindowDepth)limit;
- (void) setDynamicDepthLimit: (BOOL)flag;
//
// Cursor management
//
- (BOOL)areCursorRectsEnabled;
- (void)disableCursorRects;
- (void)discardCursorRects;
- (void)enableCursorRects;
- (void)invalidateCursorRectsForView:(NSView *)aView;
- (void)resetCursorRects;
/*
* Cursor management
*/
- (BOOL) areCursorRectsEnabled;
- (void) disableCursorRects;
- (void) discardCursorRects;
- (void) enableCursorRects;
- (void) invalidateCursorRectsForView: (NSView *)aView;
- (void) resetCursorRects;
//
// Handling user actions and events
//
- (void)close;
- (void)deminiaturize:sender;
- (BOOL)isDocumentEdited;
- (BOOL)isReleasedWhenClosed;
- (void)miniaturize:sender;
- (void)performClose:sender;
- (void)performMiniaturize:sender;
- (int)resizeFlags;
- (void)setDocumentEdited:(BOOL)flag;
- (void)setReleasedWhenClosed:(BOOL)flag;
/*
* Handling user actions and events
*/
- (void) close;
- (void) deminiaturize: sender;
- (BOOL) isDocumentEdited;
- (BOOL) isReleasedWhenClosed;
- (void) miniaturize: sender;
- (void) performClose: sender;
- (void) performMiniaturize: sender;
- (int) resizeFlags;
- (void) setDocumentEdited: (BOOL)flag;
- (void) setReleasedWhenClosed: (BOOL)flag;
//
// Aiding event handling
//
- (BOOL)acceptsMouseMovedEvents;
- (NSEvent *)currentEvent;
- (void)discardEventsMatchingMask:(unsigned int)mask
beforeEvent:(NSEvent *)lastEvent;
- (NSResponder *)firstResponder;
- (BOOL)makeFirstResponder:(NSResponder *)aResponder;
- (NSPoint)mouseLocationOutsideOfEventStream;
- (NSEvent *)nextEventMatchingMask:(unsigned int)mask;
- (NSEvent *)nextEventMatchingMask:(unsigned int)mask
untilDate:(NSDate *)expiration
inMode:(NSString *)mode
dequeue:(BOOL)deqFlag;
- (void)postEvent:(NSEvent *)event
atStart:(BOOL)flag;
- (void)setAcceptsMouseMovedEvents:(BOOL)flag;
- (void)sendEvent:(NSEvent *)theEvent;
- (BOOL)tryToPerform:(SEL)anAction with:anObject;
- (BOOL)worksWhenModal;
/*
* 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;
- (NSEvent *) nextEventMatchingMask: (unsigned int)mask
untilDate: (NSDate *)expiration
inMode: (NSString *)mode
dequeue: (BOOL)deqFlag;
- (void) postEvent: (NSEvent *)event
atStart: (BOOL)flag;
- (void) setAcceptsMouseMovedEvents: (BOOL)flag;
- (void) sendEvent: (NSEvent *)theEvent;
- (BOOL) tryToPerform: (SEL)anAction with: anObject;
- (BOOL) worksWhenModal;
//
// Dragging
//
- (void)dragImage:(NSImage *)anImage
at:(NSPoint)baseLocation
offset:(NSSize)initialOffset
event:(NSEvent *)event
pasteboard:(NSPasteboard *)pboard
source:sourceObject
slideBack:(BOOL)slideFlag;
- (void)registerForDraggedTypes:(NSArray *)newTypes;
- (void)unregisterDraggedTypes;
/*
* Dragging
*/
- (void) dragImage: (NSImage *)anImage
at: (NSPoint)baseLocation
offset: (NSSize)initialOffset
event: (NSEvent *)event
pasteboard: (NSPasteboard *)pboard
source: sourceObject
slideBack: (BOOL)slideFlag;
- (void) registerForDraggedTypes: (NSArray *)newTypes;
- (void) unregisterDraggedTypes;
//
// Services and windows menu support
//
- (BOOL)isExcludedFromWindowsMenu;
- (void)setExcludedFromWindowsMenu:(BOOL)flag;
- validRequestorForSendType:(NSString *)sendType
returnType:(NSString *)returnType;
/*
* Services and windows menu support
*/
- (BOOL) isExcludedFromWindowsMenu;
- (void) setExcludedFromWindowsMenu: (BOOL)flag;
- (id) validRequestorForSendType: (NSString *)sendType
returnType: (NSString *)returnType;
//
// Saving and restoring the frame
//
- (NSString *)frameAutosaveName;
- (void)saveFrameUsingName:(NSString *)name;
- (BOOL)setFrameAutosaveName:(NSString *)name;
- (void)setFrameFromString:(NSString *)string;
- (BOOL)setFrameUsingName:(NSString *)name;
- (NSString *)stringWithSavedFrame;
/*
* Saving and restoring the frame
*/
- (NSString *) frameAutosaveName;
- (void) saveFrameUsingName: (NSString *)name;
- (BOOL) setFrameAutosaveName: (NSString *)name;
- (void) setFrameFromString: (NSString *)string;
- (BOOL) setFrameUsingName: (NSString *)name;
- (NSString *) stringWithSavedFrame;
//
// Printing and postscript
//
- (NSData *)dataWithEPSInsideRect:(NSRect)rect;
- (void)fax:sender;
- (void)print:sender;
/*
* Printing and postscript
*/
- (NSData *) dataWithEPSInsideRect: (NSRect)rect;
- (void) fax: sender;
- (void) print: sender;
//
// Assigning a delegate
//
- delegate;
- (void)setDelegate:anObject;
/*
* Assigning a delegate
*/
- (id) delegate;
- (void) setDelegate: anObject;
//
// Implemented by the delegate
//
- (BOOL)windowShouldClose:sender;
- (NSSize)windowWillResize:(NSWindow *)sender
toSize:(NSSize)frameSize;
- windowWillReturnFieldEditor:(NSWindow *)sender
toObject:client;
- (void)windowDidBecomeKey:(NSNotification *)aNotification;
- (void)windowDidBecomeMain:(NSNotification *)aNotification;
- (void)windowDidChangeScreen:(NSNotification *)aNotification;
- (void)windowDidDeminiaturize:(NSNotification *)aNotification;
- (void)windowDidExpose:(NSNotification *)aNotification;
- (void)windowDidMiniaturize:(NSNotification *)aNotification;
- (void)windowDidMove:(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;
/*
* 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;
- (id) windowWillReturnFieldEditor: (NSWindow *)sender
toObject: client;
- (void) windowDidBecomeKey: (NSNotification *)aNotification;
- (void) windowDidBecomeMain: (NSNotification *)aNotification;
- (void) windowDidChangeScreen: (NSNotification *)aNotification;
- (void) windowDidDeminiaturize: (NSNotification *)aNotification;
- (void) windowDidExpose: (NSNotification *)aNotification;
- (void) windowDidMiniaturize: (NSNotification *)aNotification;
- (void) windowDidMove: (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
//
- (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;
+ (NSWindow*) _windowWithTag: (int)windowNumber;
//
// Mouse capture/release
//
- (void)_captureMouse: sender;
- (void)_releaseMouse: sender;
- (void) setWindowNumber: (int)windowNum;
// Allow subclasses to init without the backend class
// attempting to create an actual window
- (void)initDefaults;
- cleanInit;
/*
* Mouse capture/release
*/
- (void) _captureMouse: sender;
- (void) _releaseMouse: sender;
- (void)performDeminiaturize:sender;
- (void)performHide:sender;
- (void)performUnhide:sender;
/*
* Allow subclasses to init without the backend class
* attempting to create an actual window
*/
- (void) initDefaults;
- (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 */

View file

@ -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,210 +34,209 @@
@implementation NSResponder
//
// Class methods
//
+ (void)initialize
/*
* Class methods
*/
+ (void) initialize
{
if (self == [NSResponder class])
{
NSDebugLog(@"Initialize NSResponder class\n");
// Initial version
[self setVersion:1];
[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
//
- (BOOL)acceptsFirstResponder
/*
* Determining the first responder
*/
- (BOOL) acceptsFirstResponder
{
return NO;
}
- (BOOL)becomeFirstResponder
- (BOOL) becomeFirstResponder
{
return YES;
}
- (BOOL)resignFirstResponder
- (BOOL) resignFirstResponder
{
return YES;
}
//
// Aid event processing
//
- (BOOL)performKeyEquivalent:(NSEvent *)theEvent
/*
* 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
if ([self respondsToSelector:anAction])
/* Can we perform the action -then do it */
if ([self respondsToSelector: anAction])
{
[self performSelector:anAction withObject:anObject];
[self performSelector: anAction withObject: anObject];
return YES;
}
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
return [next_responder tryToPerform:anAction with:anObject];
return [next_responder tryToPerform: anAction with: anObject];
}
}
//
// Forwarding event messages
//
- (void)flagsChanged:(NSEvent *)theEvent
/*
* Forwarding event messages
*/
- (void) flagsChanged: (NSEvent *)theEvent
{
if (next_responder)
return [next_responder flagsChanged:theEvent];
return [next_responder flagsChanged: theEvent];
else
return [self noResponderFor:@selector(flagsChanged:)];
return [self noResponderFor: @selector(flagsChanged: )];
}
- (void)helpRequested:(NSEvent *)theEvent
- (void) helpRequested: (NSEvent *)theEvent
{
if (next_responder)
return [next_responder helpRequested:theEvent];
return [next_responder helpRequested: theEvent];
else
return [self noResponderFor:@selector(helpRequested:)];
return [self noResponderFor: @selector(helpRequested: )];
}
- (void)keyDown:(NSEvent *)theEvent
- (void) keyDown: (NSEvent *)theEvent
{
if (next_responder)
return [next_responder keyDown:theEvent];
return [next_responder keyDown: theEvent];
else
return [self noResponderFor:@selector(keyDown:)];
return [self noResponderFor: @selector(keyDown: )];
}
- (void)keyUp:(NSEvent *)theEvent
- (void) keyUp: (NSEvent *)theEvent
{
if (next_responder)
return [next_responder keyUp:theEvent];
return [next_responder keyUp: theEvent];
else
return [self noResponderFor:@selector(keyUp:)];
return [self noResponderFor: @selector(keyUp: )];
}
- (void)mouseDown:(NSEvent *)theEvent
- (void) mouseDown: (NSEvent *)theEvent
{
if (next_responder)
return [next_responder mouseDown:theEvent];
return [next_responder mouseDown: theEvent];
else
return [self noResponderFor:@selector(mouseDown:)];
return [self noResponderFor: @selector(mouseDown: )];
}
- (void)mouseDragged:(NSEvent *)theEvent
- (void) mouseDragged: (NSEvent *)theEvent
{
if (next_responder)
return [next_responder mouseDragged:theEvent];
return [next_responder mouseDragged: theEvent];
else
return [self noResponderFor:@selector(mouseDragged:)];
return [self noResponderFor: @selector(mouseDragged: )];
}
- (void)mouseEntered:(NSEvent *)theEvent
- (void) mouseEntered: (NSEvent *)theEvent
{
if (next_responder)
return [next_responder mouseEntered:theEvent];
return [next_responder mouseEntered: theEvent];
else
return [self noResponderFor:@selector(mouseEntered:)];
return [self noResponderFor: @selector(mouseEntered: )];
}
- (void)mouseExited:(NSEvent *)theEvent
- (void) mouseExited: (NSEvent *)theEvent
{
if (next_responder)
return [next_responder mouseExited:theEvent];
return [next_responder mouseExited: theEvent];
else
return [self noResponderFor:@selector(mouseExited:)];
return [self noResponderFor: @selector(mouseExited: )];
}
- (void)mouseMoved:(NSEvent *)theEvent
- (void) mouseMoved: (NSEvent *)theEvent
{
if (next_responder)
return [next_responder mouseMoved:theEvent];
return [next_responder mouseMoved: theEvent];
else
return [self noResponderFor:@selector(mouseMoved:)];
return [self noResponderFor: @selector(mouseMoved: )];
}
- (void)mouseUp:(NSEvent *)theEvent
- (void) mouseUp: (NSEvent *)theEvent
{
if (next_responder)
return [next_responder mouseUp:theEvent];
return [next_responder mouseUp: theEvent];
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
if (sel_eq(eventSelector, @selector(keyDown:)))
/* Only beep for key down events */
if (sel_eq(eventSelector, @selector(keyDown: )))
NSBeep();
}
- (void)rightMouseDown:(NSEvent *)theEvent
- (void) rightMouseDown: (NSEvent *)theEvent
{
if (next_responder)
return [next_responder rightMouseDown:theEvent];
return [next_responder rightMouseDown: theEvent];
else
return [self noResponderFor:@selector(rightMouseDown:)];
return [self noResponderFor: @selector(rightMouseDown: )];
}
- (void)rightMouseDragged:(NSEvent *)theEvent
- (void) rightMouseDragged: (NSEvent *)theEvent
{
if (next_responder)
return [next_responder rightMouseDragged:theEvent];
return [next_responder rightMouseDragged: theEvent];
else
return [self noResponderFor:@selector(rightMouseDragged:)];
return [self noResponderFor: @selector(rightMouseDragged: )];
}
- (void)rightMouseUp:(NSEvent *)theEvent
- (void) rightMouseUp: (NSEvent *)theEvent
{
if (next_responder)
return [next_responder rightMouseUp:theEvent];
return [next_responder rightMouseUp: theEvent];
else
return [self noResponderFor:@selector(rightMouseUp:)];
return [self noResponderFor: @selector(rightMouseUp: )];
}
//
// Services menu support
//
- validRequestorForSendType:(NSString *)typeSent
returnType:(NSString *)typeReturned
/*
* Services menu support
*/
- (id) validRequestorForSendType: (NSString *)typeSent
returnType: (NSString *)typeReturned
{
if (next_responder)
return [next_responder validRequestorForSendType:typeSent
returnType:typeReturned];
return [next_responder validRequestorForSendType: typeSent
returnType: typeReturned];
else
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

View file

@ -110,13 +110,13 @@
}
+ (NSRect) frameRectForContentRect: (NSRect)aRect
styleMask: (unsigned int)aStyle
styleMask: (unsigned int)aStyle
{
return aRect;
}
+ (NSRect) minFrameWidthWithTitle: (NSString *)aTitle
styleMask: (unsigned int)aStyle
styleMask: (unsigned int)aStyle
{
return NSZeroRect;
}
@ -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,38 +1691,42 @@
- (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
delegate = nil;
window_num = 0;
background_color = [[NSColor lightGrayColor] retain];
represented_filename = @"Window";
miniaturized_title = @"Window";
miniaturized_image = nil;
window_title = @"Window";
last_point = NSZeroPoint;
window_level = NSNormalWindowLevel;
/*
* 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 controlColor] retain];
represented_filename = @"Window";
miniaturized_title = @"Window";
miniaturized_image = nil;
window_title = @"Window";
last_point = NSZeroPoint;
window_level = NSNormalWindowLevel;
is_one_shot = NO;
needs_display = NO;
is_autodisplay = YES;
optimize_drawing = YES;
views_need_display = NO;
depth_limit = 8;
dynamic_depth_limit = YES;
cursor_rects_enabled = NO;
visible = NO;
is_key = NO;
is_main = NO;
is_edited = NO;
is_released_when_closed = YES;
is_miniaturized = NO;
disable_flush_window = NO;
menu_exclude = NO;
hides_on_deactivate = NO;
accepts_mouse_moved = NO;
is_one_shot = NO;
needs_display = NO;
is_autodisplay = YES;
optimize_drawing = YES;
views_need_display = NO;
depth_limit = 8;
dynamic_depth_limit = YES;
cursor_rects_enabled = NO;
visible = NO;
is_key = NO;
is_main = NO;
is_edited = NO;
is_released_when_closed = YES;
is_miniaturized = NO;
disable_flush_window = NO;
menu_exclude = NO;
hides_on_deactivate = NO;
accepts_mouse_moved = NO;
}
- (id) cleanInit