1 /* 2 NSStringDrawing.h 3 4 Categories which add measure capabilities to NSAttributedString 5 and NSString. 6 7 Copyright (C) 1997 Free Software Foundation, Inc. 8 9 Author: Felipe A. Rodriguez <far@ix.netcom.com> 10 Date: Aug 1998 11 Rewrite: Richard Frith-Macdonald <richard@brainstorm.co.uk> 12 Date: Mar 1999 13 14 This file is part of the GNUstep GUI Library. 15 16 This library is free software; you can redistribute it and/or 17 modify it under the terms of the GNU Lesser General Public 18 License as published by the Free Software Foundation; either 19 version 2 of the License, or (at your option) any later version. 20 21 This library is distributed in the hope that it will be useful, 22 but WITHOUT ANY WARRANTY; without even the implied warranty of 23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 24 Lesser General Public License for more details. 25 26 You should have received a copy of the GNU Lesser General Public 27 License along with this library; see the file COPYING.LIB. 28 If not, see <http://www.gnu.org/licenses/> or write to the 29 Free Software Foundation, 51 Franklin Street, Fifth Floor, 30 Boston, MA 02110-1301, USA. 31 */ 32 33 #ifndef _GNUstep_H_NSStringDrawing 34 #define _GNUstep_H_NSStringDrawing 35 #import <GNUstepBase/GSVersionMacros.h> 36 37 #if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST) 38 39 #import <Foundation/NSAttributedString.h> 40 #import <Foundation/NSGeometry.h> 41 #import <Foundation/NSString.h> 42 43 @class NSDictionary; 44 45 #if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST) 46 typedef enum 47 { 48 NSStringDrawingUsesLineFragmentOrigin=0x01, 49 NSStringDrawingUsesFontLeading=0x02, 50 NSStringDrawingDisableScreenFontSubstitution=0x04, 51 NSStringDrawingUsesDeviceMetrics=0x08, 52 NSStringDrawingOneShot=0x10 53 } NSStringDrawingOptions; 54 #endif 55 56 @interface NSString (NSStringDrawing) 57 58 - (void) drawAtPoint: (NSPoint)point withAttributes: (NSDictionary*)attrs; 59 - (void) drawInRect: (NSRect)rect withAttributes: (NSDictionary*)attrs; 60 - (NSSize) sizeWithAttributes: (NSDictionary*)attrs; 61 62 #if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST) 63 - (NSRect) boundingRectWithSize: (NSSize)size 64 options: (NSStringDrawingOptions)options 65 attributes: (NSDictionary *)attributes; 66 - (void) drawWithRect: (NSRect)rect 67 options: (NSStringDrawingOptions)options 68 attributes: (NSDictionary *)attributes; 69 #endif 70 71 @end 72 73 @interface NSAttributedString (NSStringDrawing) 74 75 - (NSSize) size; 76 - (void) drawAtPoint: (NSPoint)point; 77 - (void) drawInRect: (NSRect)rect; 78 79 #if OS_API_VERSION(MAC_OS_X_VERSION_10_4, GS_API_LATEST) 80 - (NSRect) boundingRectWithSize: (NSSize)size 81 options: (NSStringDrawingOptions)options; 82 - (void) drawWithRect: (NSRect)rect 83 options: (NSStringDrawingOptions)options; 84 #endif 85 86 @end 87 88 #else 89 @class NSAttributedString; 90 #endif 91 92 #endif /* _GNUstep_H_NSStringDrawing */ 93