This is NSGeometry.h in view mode; [Download] [Up]
/*
NSGeometry.h
Copyright (C) 1995, 1996 Ovidiu Predescu and Mircea Oancea.
All rights reserved.
Author: Mircea Oancea <mircea@jupiter.elcom.pub.ro>
This file is part of libFoundation.
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted, provided
that the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
We disclaim all warranties with regard to this software, including all
implied warranties of merchantability and fitness, in no event shall
we be liable for any special, indirect or consequential damages or any
damages whatsoever resulting from loss of use, data or profits, whether in
an action of contract, negligence or other tortious action, arising out of
or in connection with the use or performance of this software.
*/
#ifndef __NSGeometry_h__
#define __NSGeometry_h__
#include <objc/objc.h>
/* Geometry */
@class NSString;
typedef struct _NSPoint {float x; float y;} NSPoint;
typedef struct _NSSize {float width; float height;} NSSize;
typedef struct _NSRect {NSPoint origin;NSSize size;} NSRect;
typedef enum {NSMinXEdge, NSMinYEdge, NSMaxXEdge, NSMaxYEdge} NSRectEdge;
// Constants
#define NSZeroPoint ((NSPoint){0,0})
#define NSZeroRect ((NSRect){{0,0},{0,0}})
#define NSZeroSize ((NSSize){0,0})
// Create Basic Structures
extern NSPoint NSMakePoint(float x, float y);
extern NSSize NSMakeSize(float w, float h);
extern NSRect NSMakeRect(float x, float y, float w, float h);
// Get a Rectangle's Coordinates
extern float NSMaxX(NSRect aRect);
extern float NSMaxY(NSRect aRect);
extern float NSMidX(NSRect aRect);
extern float NSMidY(NSRect aRect);
extern float NSMinX(NSRect aRect);
extern float NSMinY(NSRect aRect);
extern float NSWidth(NSRect aRect);
extern float NSHeight(NSRect aRect);
// Modify a Copy of a Rectangle
extern NSRect NSInsetRect(NSRect aRect, float dX, float dY);
extern NSRect NSOffsetRect(NSRect aRect, float dx, float dy);
extern void NSDivideRect(NSRect aRect, NSRect *slice, NSRect *remainder,
float amount, NSRectEdge edge);
extern NSRect NSIntegralRect(NSRect aRect);
// Compute a Third Rectangle from Two Rectangles
extern NSRect NSUnionRect(NSRect aRect, NSRect bRect);
extern NSRect NSIntersectionRect (NSRect aRect, NSRect bRect);
// Test Geometric Relationships
extern BOOL NSEqualRects(NSRect aRect, NSRect bRect);
extern BOOL NSEqualSizes(NSSize aSize, NSSize bSize);
extern BOOL NSEqualPoints(NSPoint aPoint, NSPoint bPoint);
extern BOOL NSIsEmptyRect(NSRect aRect);
extern BOOL NSMouseInRect(NSPoint aPoint, NSRect aRect, BOOL flipped);
extern BOOL NSPointInRect(NSPoint aPoint, NSRect aRect);
extern BOOL NSContainsRect(NSRect aRect, NSRect bRect);
extern BOOL NSIntersectsRect(NSRect aRect, NSRect bRect);
// Get a String Representation
extern NSString* NSStringFromPoint(NSPoint aPoint);
extern NSString* NSStringFromRect(NSRect aRect);
extern NSString* NSStringFromSize(NSSize aSize);
// Make from String Representation
extern NSPoint NSPointFromString(NSString* string);
extern NSSize NSSizeFromString(NSString* string);
extern NSRect NSRectFromString(NSString* string);
#endif /* __NSGeometry_h__ */
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.