/usr/include/GNUstep/AppKit/NSTextAttachment.h is in libgnustep-gui-dev 0.20.0-3+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | /*
NSTextAttachment.h
Classes to represent text attachments.
Copyright (C) 1996 Free Software Foundation, Inc.
Author: Daniel Böhringer <boehring@biomed.ruhr-uni-bochum.de>
Date: August 1998
Source by Daniel Böhringer integrated into GNUstep gui
by Felipe A. Rodriguez <far@ix.netcom.com>
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 Lesser 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
/**
NSTextAttachment is used to represent text attachments. When inline,
text attachments appear as the value of the NSAttachmentAttributeName
attached to the special character NSAttachmentCharacter.
NSTextAttachment uses an object obeying the NSTextAttachmentCell
protocol to get input from the user and to display an image.
NSTextAttachmentCell is a simple subclass of NSCell which provides
the NSTextAttachment protocol.
*/
#ifndef _GNUstep_H_NSTextAttachment
#define _GNUstep_H_NSTextAttachment
#import <GNUstepBase/GSVersionMacros.h>
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
#import <Foundation/NSAttributedString.h>
#import <Foundation/NSGeometry.h>
#import <Foundation/NSObject.h>
#import <AppKit/NSCell.h>
@class NSFileWrapper;
@class NSLayoutManager;
@class NSTextAttachment;
@class NSTextContainer;
enum {
NSAttachmentCharacter = 0xfffc /* To denote attachments. */
};
/*
These are the only methods required of cells in text attachments...
The default NSCell class implements most of these; the NSTextAttachmentCell
class is a subclass which implements all and provides some additional
functionality.
*/
@protocol NSTextAttachmentCell <NSObject>
- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView;
- (void)drawWithFrame:(NSRect)cellFrame
inView:(NSView *)controlView
characterIndex:(unsigned)charIndex;
- (void)drawWithFrame:(NSRect)cellFrame
inView:(NSView *)controlView
characterIndex:(unsigned)charIndex
layoutManager:(NSLayoutManager *)layoutManager;
- (void)highlight:(BOOL)flag
withFrame:(NSRect)cellFrame
inView:(NSView *)controlView;
/** The old way of placing the cell. The text system will never call
these directly (TODO: make sure it doesn't), but other things might. The
class implements the new method by calling these, so subclasses can
easily change behavior by overriding these. **/
- (NSSize)cellSize;
/* Returns the offset from the current point when typesetting to the lower
left corner of the cell. The class returns (0,0). Positive y is probably
up. (TODO) */
- (NSPoint)cellBaselineOffset;
/** The new way of placing the cell. **/
/* Returns the rectangle in which the cell should be drawn. The rectangle
is relative to the current point when typesetting. Positive y is up.
lineFrag is the line frag rect that this cell might be placed in, and
position is the current position in that line frag rect (positive y is
up). Note that the line frag rect and glyph position may not be where
the cell is actually placed.
Note that this might be called many times for the same attachment. Eg. if
you return a rectangle that won't fit in the proposed line frag rect, the
typesetter might try to adjust things so it will fit. It will then send
this message with a new proposed line frag rect and glyph position. Thus,
great care must be taken when using the line frag rect to calculate the
returned rectangle to prevent the typesetting process from getting stuck.
The class uses -cellSize and -cellBaselineOffset to return a rect.
*/
-(NSRect) cellFrameForTextContainer: (NSTextContainer *)textContainer
proposedLineFragment: (NSRect)lineFrag
glyphPosition: (NSPoint)position
characterIndex: (unsigned int)charIndex;
- (BOOL)wantsToTrackMouse;
- (BOOL)wantsToTrackMouseForEvent:(NSEvent *)theEvent
inRect:(NSRect)cellFrame
ofView:(NSView *)controlView
atCharacterIndex:(unsigned)charIndex;
- (BOOL)trackMouse:(NSEvent *)theEvent
inRect:(NSRect)cellFrame
ofView:(NSView *)controlView
untilMouseUp:(BOOL)flag;
- (BOOL)trackMouse:(NSEvent *)theEvent
inRect:(NSRect)cellFrame
ofView:(NSView *)controlView
atCharacterIndex:(unsigned)charIndex
untilMouseUp:(BOOL)flag;
- (void)setAttachment:(NSTextAttachment *)anObject;
- (NSTextAttachment *)attachment;
@end
/*
Simple class to provide basic attachment cell functionality.
By default this class causes NSTextView to send out delegate
messages when the attachment is clicked on or dragged.
*/
@interface NSTextAttachmentCell : NSCell <NSTextAttachmentCell> {
NSTextAttachment *_attachment;
}
@end
@interface NSTextAttachment : NSObject <NSCoding> {
NSFileWrapper *_fileWrapper;
id <NSTextAttachmentCell>_cell;
}
/*
Designated initializer.
*/
- (id)initWithFileWrapper:(NSFileWrapper *)fileWrapper;
/*
The fileWrapper is the meat of most types of attachment.
It can be set or queried with these methods. An NSTextAttachment
usually has a fileWrapper. setFileWrapper does not update the
attachment's cell in any way.
*/
- (void)setFileWrapper:(NSFileWrapper *)fileWrapper;
- (NSFileWrapper *)fileWrapper;
/*
The cell which handles user interaction.
By default an instance of NSTextAttachmentCell is used.
*/
- (id <NSTextAttachmentCell>)attachmentCell;
- (void)setAttachmentCell:(id <NSTextAttachmentCell>)cell;
@end
@interface NSAttributedString (NSTextAttachment)
+ (NSAttributedString*) attributedStringWithAttachment:
(NSTextAttachment*)attachment;
- (BOOL) containsAttachments;
@end
@interface NSMutableAttributedString (NSTextAttachment)
- (void) updateAttachmentsFromPath: (NSString *)path;
@end
#endif
#endif /* _GNUstep_H_NSTextAttachment */
|