mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 16:10:37 +00:00
Add new MacOSX methods. Code mostly by Nikolaus Schaller.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@25270 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
cfff2ce6b4
commit
0a607a5fbe
21 changed files with 831 additions and 84 deletions
|
@ -34,6 +34,7 @@
|
|||
#include <Foundation/NSLock.h>
|
||||
#include <Foundation/NSValue.h>
|
||||
|
||||
#include "AppKit/NSAttributedString.h"
|
||||
#include "AppKit/NSParagraphStyle.h"
|
||||
#include "AppKit/NSTextAttachment.h"
|
||||
#include "AppKit/NSTextContainer.h"
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <Foundation/NSException.h>
|
||||
#include <Foundation/NSValue.h>
|
||||
|
||||
#include "AppKit/NSAttributedString.h"
|
||||
#include "AppKit/NSTextStorage.h"
|
||||
#include "AppKit/NSTextContainer.h"
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <Foundation/NSException.h>
|
||||
|
||||
#include "AppKit/NSApplication.h"
|
||||
#include "AppKit/NSAttributedString.h"
|
||||
#include "AppKit/NSButton.h"
|
||||
#include "AppKit/NSImage.h"
|
||||
#include "AppKit/NSParagraphStyle.h"
|
||||
|
|
|
@ -23,6 +23,10 @@
|
|||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <Foundation/NSDebug.h>
|
||||
#include <Foundation/NSRunLoop.h>
|
||||
|
||||
#include "AppKit/NSAttributedString.h"
|
||||
#include <AppKit/NSView.h>
|
||||
#include <AppKit/NSWindow.h>
|
||||
#include <AppKit/NSPanel.h>
|
||||
|
@ -33,10 +37,6 @@
|
|||
#include <AppKit/NSApplication.h>
|
||||
|
||||
#include <GNUstepGUI/GSTitleView.h>
|
||||
|
||||
#include <Foundation/NSDebug.h>
|
||||
#include <Foundation/NSRunLoop.h>
|
||||
|
||||
#include "GNUstepGUI/GSTheme.h"
|
||||
|
||||
@implementation GSTitleView
|
||||
|
|
|
@ -720,6 +720,101 @@ documentAttributes: (NSDictionary **)dict
|
|||
documentAttributes: dict];
|
||||
}
|
||||
|
||||
- (id) initWithDocFormat: (NSData *)data
|
||||
documentAttributes: (NSDictionary **)dict
|
||||
{
|
||||
// FIXME
|
||||
RELEASE(self);
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (id) initWithHTML: (NSData *)data
|
||||
options: (NSDictionary *)options
|
||||
documentAttributes: (NSDictionary **)dict
|
||||
{
|
||||
// FIXME
|
||||
RELEASE(self);
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (id) initWithData: (NSData *)data
|
||||
options: (NSDictionary *)options
|
||||
documentAttributes: (NSDictionary **)dict
|
||||
error: (NSError **)error
|
||||
{
|
||||
// FIXME
|
||||
RELEASE(self);
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (id) initWithURL: (NSURL *)url
|
||||
options: (NSDictionary *)options
|
||||
documentAttributes: (NSDictionary **)dict
|
||||
error: (NSError **)error
|
||||
{
|
||||
// FIXME
|
||||
RELEASE(self);
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSData *) docFormatFromRange: (NSRange)range
|
||||
documentAttributes: (NSDictionary *)dict
|
||||
{
|
||||
// FIXME
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSData *) dataFromRange: (NSRange)range
|
||||
documentAttributes: (NSDictionary *)dict
|
||||
error: (NSError **)error
|
||||
{
|
||||
// FIXME
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSFileWrapper *) fileWrapperFromRange: (NSRange)range
|
||||
documentAttributes: (NSDictionary *)dict
|
||||
error: (NSError **)error
|
||||
{
|
||||
// FIXME
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (unsigned) lineBreakByHyphenatingBeforeIndex: (unsigned)location
|
||||
withinRange: (NSRange)aRange
|
||||
{
|
||||
// FIXME
|
||||
return NSNotFound;
|
||||
}
|
||||
|
||||
- (NSRange) itemNumberInTextList: (NSTextList *)list
|
||||
atIndex: (unsigned)location
|
||||
{
|
||||
// FIXME
|
||||
return NSMakeRange(NSNotFound, 0);
|
||||
}
|
||||
|
||||
- (NSRange) rangeOfTextBlock: (NSTextBlock *)block
|
||||
atIndex: (unsigned)location
|
||||
{
|
||||
// FIXME
|
||||
return NSMakeRange(NSNotFound, 0);
|
||||
}
|
||||
|
||||
- (NSRange) rangeOfTextList: (NSTextList *)list
|
||||
atIndex: (unsigned)location
|
||||
{
|
||||
// FIXME
|
||||
return NSMakeRange(NSNotFound, 0);
|
||||
}
|
||||
|
||||
- (NSRange) rangeOfTextTable: (NSTextTable *)table
|
||||
atIndex: (unsigned)location
|
||||
{
|
||||
// FIXME
|
||||
return NSMakeRange(NSNotFound, 0);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSMutableAttributedString (AppKit)
|
||||
|
@ -1081,6 +1176,17 @@ documentAttributes: (NSDictionary **)dict
|
|||
- (BOOL) readFromURL: (NSURL *)url
|
||||
options: (NSDictionary *)options
|
||||
documentAttributes: (NSDictionary**)documentAttributes
|
||||
{
|
||||
return [self readFromURL: url
|
||||
options: options
|
||||
documentAttributes: documentAttributes
|
||||
error: NULL];
|
||||
}
|
||||
|
||||
- (BOOL) readFromURL: (NSURL *)url
|
||||
options: (NSDictionary *)options
|
||||
documentAttributes: (NSDictionary **)documentAttributes
|
||||
error: (NSError **)error
|
||||
{
|
||||
NSString *extension;
|
||||
NSString *type;
|
||||
|
@ -1159,4 +1265,32 @@ documentAttributes: (NSDictionary **)dict
|
|||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL) readFromData: (NSData *)data
|
||||
options: (NSDictionary *)options
|
||||
documentAttributes: (NSDictionary **)documentAttributes
|
||||
{
|
||||
return [self readFromData: data
|
||||
options: options
|
||||
documentAttributes: documentAttributes
|
||||
error: NULL];
|
||||
}
|
||||
|
||||
- (BOOL) readFromData: (NSData *)data
|
||||
options: (NSDictionary *)options
|
||||
documentAttributes: (NSDictionary **)documentAttributes
|
||||
error: (NSError **)error
|
||||
{
|
||||
// FIXME
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void) setBaseWritingDirection: (NSWritingDirection)writingDirection
|
||||
range: (NSRange)range
|
||||
{
|
||||
[self setAttributes: [NSDictionary dictionaryWithObject:
|
||||
[NSNumber numberWithInt: writingDirection]
|
||||
forKey: @"WritingDirection"]
|
||||
range: range];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -147,6 +147,27 @@ static Class imageCellClass;
|
|||
return [_cell isEditable];
|
||||
}
|
||||
|
||||
- (BOOL) animates
|
||||
{
|
||||
// FIXME: Should be passed on to cell.
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void) setAnimates: (BOOL) flag
|
||||
{
|
||||
// FIXME: Should be passed on to cell.
|
||||
}
|
||||
|
||||
- (BOOL) allowsCutCopyPaste
|
||||
{
|
||||
return _allowsCutCopyPaste;
|
||||
}
|
||||
|
||||
- (void) setAllowsCutCopyPaste: (BOOL)flag
|
||||
{
|
||||
_allowsCutCopyPaste = flag;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSImageView (NSDraggingDestination)
|
||||
|
|
|
@ -108,6 +108,7 @@ first. Remaining cases, highest priority first:
|
|||
#include "GNUstepGUI/GSLayoutManager_internal.h"
|
||||
|
||||
#include <Foundation/NSException.h>
|
||||
#include "AppKit/NSAttributedString.h"
|
||||
#include "AppKit/NSColor.h"
|
||||
#include "AppKit/NSImage.h"
|
||||
#include "AppKit/NSParagraphStyle.h"
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include <Foundation/NSString.h>
|
||||
#include <Foundation/NSUserDefaults.h>
|
||||
|
||||
#include "AppKit/NSAttributedString.h"
|
||||
#include "AppKit/NSColor.h"
|
||||
#include "AppKit/NSFont.h"
|
||||
#include "AppKit/NSGraphics.h"
|
||||
|
|
|
@ -35,21 +35,92 @@
|
|||
|
||||
@implementation NSTextTab
|
||||
|
||||
- (id) copyWithZone: (NSZone*)aZone
|
||||
{
|
||||
if (NSShouldRetainWithZone(self, aZone) == YES)
|
||||
return RETAIN(self);
|
||||
return NSCopyObject(self, 0, aZone);
|
||||
}
|
||||
|
||||
- (id) initWithType: (NSTextTabType)type location: (float)loc
|
||||
{
|
||||
self = [super init];
|
||||
_tabStopType = type;
|
||||
_location = loc;
|
||||
if ((self = [super init]))
|
||||
{
|
||||
_tabStopType = type;
|
||||
_location = loc;
|
||||
switch (type)
|
||||
{
|
||||
default:
|
||||
case NSLeftTabStopType:
|
||||
_alignment = NSLeftTextAlignment;
|
||||
break;
|
||||
case NSRightTabStopType:
|
||||
_alignment = NSRightTextAlignment;
|
||||
break;
|
||||
case NSCenterTabStopType:
|
||||
_alignment = NSCenterTextAlignment;
|
||||
break;
|
||||
case NSDecimalTabStopType:
|
||||
_alignment = NSRightTextAlignment;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id) initWithTextAlignment: (NSTextAlignment)align
|
||||
location: (float)loc
|
||||
options: (NSDictionary *)options
|
||||
{
|
||||
NSTextTabType type;
|
||||
|
||||
switch (align)
|
||||
{
|
||||
default:
|
||||
case NSLeftTextAlignment:
|
||||
type = NSLeftTabStopType;
|
||||
break;
|
||||
case NSRightTextAlignment:
|
||||
if ([options objectForKey: NSTabColumnTerminatorsAttributeName] != nil)
|
||||
{
|
||||
type = NSDecimalTabStopType;
|
||||
}
|
||||
else
|
||||
{
|
||||
type = NSRightTabStopType;
|
||||
}
|
||||
break;
|
||||
case NSCenterTextAlignment:
|
||||
type = NSCenterTabStopType;
|
||||
break;
|
||||
case NSJustifiedTextAlignment:
|
||||
type = NSLeftTabStopType;
|
||||
break;
|
||||
case NSNaturalTextAlignment:
|
||||
// FIXME: Get from language user setting
|
||||
type = YES ? NSLeftTabStopType : NSRightTabStopType;
|
||||
break;
|
||||
}
|
||||
|
||||
if ((self = [self initWithType: type location: loc]))
|
||||
{
|
||||
_alignment = align;
|
||||
ASSIGN(_options, options);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc;
|
||||
{
|
||||
RELEASE(_options);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (id) copyWithZone: (NSZone*)aZone
|
||||
{
|
||||
NSTextTab *copy;
|
||||
|
||||
if (NSShouldRetainWithZone(self, aZone) == YES)
|
||||
return RETAIN(self);
|
||||
|
||||
copy = (NSTextTab *)NSCopyObject(self, 0, aZone);
|
||||
copy->_options = [_options copyWithZone: aZone];
|
||||
return copy;
|
||||
}
|
||||
|
||||
- (NSComparisonResult) compare: (id)anObject
|
||||
{
|
||||
float loc;
|
||||
|
@ -97,6 +168,41 @@
|
|||
{
|
||||
return _tabStopType;
|
||||
}
|
||||
- (NSTextAlignment) alignment
|
||||
{
|
||||
return _alignment;
|
||||
}
|
||||
|
||||
- (NSDictionary *) options
|
||||
{
|
||||
return _options;
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder *)aCoder
|
||||
{
|
||||
if ([aCoder allowsKeyedCoding])
|
||||
{
|
||||
_location = [aCoder decodeFloatForKey: @"NSLocation"];
|
||||
}
|
||||
else
|
||||
{
|
||||
// FIXME
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) encodeWithCoder: (NSCoder *)aCoder
|
||||
{
|
||||
if ([aCoder allowsKeyedCoding])
|
||||
{
|
||||
[aCoder encodeFloat: _location forKey: @"NSLocation"];
|
||||
}
|
||||
else
|
||||
{
|
||||
// FIXME
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
@ -177,25 +283,29 @@ static NSParagraphStyle *defaultStyle = nil;
|
|||
NSLog(@"Argh - attempt to dealloc the default paragraph style!");
|
||||
return;
|
||||
}
|
||||
RELEASE (_tabStops);
|
||||
RELEASE(_tabStops);
|
||||
RELEASE(_textBlocks);
|
||||
RELEASE(_textLists);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (id) init
|
||||
{
|
||||
self = [super init];
|
||||
_alignment = NSNaturalTextAlignment;
|
||||
_firstLineHeadIndent = 0.0;
|
||||
_headIndent = 0.0;
|
||||
_lineBreakMode = NSLineBreakByWordWrapping;
|
||||
_lineSpacing = 0.0;
|
||||
_maximumLineHeight = 0.0;
|
||||
_minimumLineHeight = 0.0;
|
||||
_paragraphSpacing = 0.0;
|
||||
_tailIndent = 0.0;
|
||||
_baseDirection = NSWritingDirectionNaturalDirection;
|
||||
_tabStops = [[NSMutableArray allocWithZone: [self zone]]
|
||||
initWithCapacity: 12];
|
||||
if ((self = [super init]))
|
||||
{
|
||||
_alignment = NSNaturalTextAlignment;
|
||||
//_firstLineHeadIndent = 0.0;
|
||||
//_headIndent = 0.0;
|
||||
_lineBreakMode = NSLineBreakByWordWrapping;
|
||||
//_lineSpacing = 0.0;
|
||||
//_maximumLineHeight = 0.0;
|
||||
//_minimumLineHeight = 0.0;
|
||||
//_paragraphSpacing = 0.0;
|
||||
//_tailIndent = 0.0;
|
||||
_baseDirection = NSWritingDirectionNaturalDirection;
|
||||
_tabStops = [[NSMutableArray allocWithZone: [self zone]]
|
||||
initWithCapacity: 12];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -289,6 +399,46 @@ static NSParagraphStyle *defaultStyle = nil;
|
|||
return _baseDirection;
|
||||
}
|
||||
|
||||
- (float) defaultTabInterval
|
||||
{
|
||||
return _defaultTabInterval;
|
||||
}
|
||||
|
||||
- (float) lineHeightMultiple
|
||||
{
|
||||
return _lineHeightMultiple;
|
||||
}
|
||||
|
||||
- (float) paragraphSpacingBefore
|
||||
{
|
||||
return _paragraphSpacingBefore;
|
||||
}
|
||||
|
||||
- (int) headerLevel;
|
||||
{
|
||||
return _headerLevel;
|
||||
}
|
||||
|
||||
- (float) hyphenationFactor;
|
||||
{
|
||||
return _hyphenationFactor;
|
||||
}
|
||||
|
||||
- (NSArray *) textBlocks;
|
||||
{
|
||||
return _textBlocks;
|
||||
}
|
||||
|
||||
- (NSArray *) textLists;
|
||||
{
|
||||
return _textLists;
|
||||
}
|
||||
|
||||
- (float) tighteningFactorForTruncation;
|
||||
{
|
||||
return _tighteningFactorForTruncation;
|
||||
}
|
||||
|
||||
- (id) copyWithZone: (NSZone*)aZone
|
||||
{
|
||||
if (NSShouldRetainWithZone (self, aZone) == YES)
|
||||
|
@ -339,33 +489,34 @@ static NSParagraphStyle *defaultStyle = nil;
|
|||
[aCoder decodeValueOfObjCType: @encode(unsigned) at: &count];
|
||||
_tabStops = [[NSMutableArray alloc] initWithCapacity: count];
|
||||
if (count > 0)
|
||||
{
|
||||
float locations[count];
|
||||
NSTextTabType types[count];
|
||||
unsigned i;
|
||||
|
||||
[aCoder decodeArrayOfObjCType: @encode(float)
|
||||
count: count
|
||||
at: locations];
|
||||
[aCoder decodeArrayOfObjCType: @encode(NSTextTabType)
|
||||
count: count
|
||||
at: types];
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
NSTextTab *tab;
|
||||
|
||||
tab = [NSTextTab alloc];
|
||||
tab = [tab initWithType: types[i] location: locations[i]];
|
||||
[_tabStops addObject: tab];
|
||||
RELEASE (tab);
|
||||
}
|
||||
}
|
||||
{
|
||||
float locations[count];
|
||||
NSTextTabType types[count];
|
||||
unsigned i;
|
||||
|
||||
[aCoder decodeArrayOfObjCType: @encode(float)
|
||||
count: count
|
||||
at: locations];
|
||||
[aCoder decodeArrayOfObjCType: @encode(NSTextTabType)
|
||||
count: count
|
||||
at: types];
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
NSTextTab *tab;
|
||||
|
||||
tab = [[NSTextTab alloc] initWithType: types[i]
|
||||
location: locations[i]];
|
||||
[_tabStops addObject: tab];
|
||||
RELEASE(tab);
|
||||
}
|
||||
}
|
||||
|
||||
if ([aCoder versionForClassName: @"NSParagraphStyle"] >= 2)
|
||||
{
|
||||
[aCoder decodeValueOfObjCType: @encode(int) at: &_baseDirection];
|
||||
}
|
||||
{
|
||||
[aCoder decodeValueOfObjCType: @encode(int) at: &_baseDirection];
|
||||
}
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -396,25 +547,25 @@ static NSParagraphStyle *defaultStyle = nil;
|
|||
count = [_tabStops count];
|
||||
[aCoder encodeValueOfObjCType: @encode(unsigned) at: &count];
|
||||
if (count > 0)
|
||||
{
|
||||
float locations[count];
|
||||
NSTextTabType types[count];
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
NSTextTab *tab = [_tabStops objectAtIndex: i];
|
||||
|
||||
locations[i] = [tab location];
|
||||
types[i] = [tab tabStopType];
|
||||
}
|
||||
[aCoder encodeArrayOfObjCType: @encode(float)
|
||||
count: count
|
||||
at: locations];
|
||||
[aCoder encodeArrayOfObjCType: @encode(NSTextTabType)
|
||||
count: count
|
||||
at: types];
|
||||
}
|
||||
{
|
||||
float locations[count];
|
||||
NSTextTabType types[count];
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
NSTextTab *tab = [_tabStops objectAtIndex: i];
|
||||
|
||||
locations[i] = [tab location];
|
||||
types[i] = [tab tabStopType];
|
||||
}
|
||||
[aCoder encodeArrayOfObjCType: @encode(float)
|
||||
count: count
|
||||
at: locations];
|
||||
[aCoder encodeArrayOfObjCType: @encode(NSTextTabType)
|
||||
count: count
|
||||
at: types];
|
||||
}
|
||||
|
||||
[aCoder encodeValueOfObjCType: @encode(int) at: &_baseDirection];
|
||||
}
|
||||
|
@ -438,7 +589,12 @@ static NSParagraphStyle *defaultStyle = nil;
|
|||
C(_maximumLineHeight);
|
||||
C(_alignment);
|
||||
C(_lineBreakMode);
|
||||
C(_baseDirection);
|
||||
C(_paragraphSpacingBefore);
|
||||
C(_defaultTabInterval);
|
||||
C(_hyphenationFactor);
|
||||
C(_lineHeightMultiple);
|
||||
C(_tighteningFactorForTruncation);
|
||||
C(_headerLevel);
|
||||
#undef C
|
||||
|
||||
return [_tabStops isEqualToArray: other->_tabStops];
|
||||
|
@ -530,6 +686,46 @@ static NSParagraphStyle *defaultStyle = nil;
|
|||
_baseDirection = direction;
|
||||
}
|
||||
|
||||
- (void) setDefaultTabInterval: (float)interval
|
||||
{
|
||||
_defaultTabInterval = interval;
|
||||
}
|
||||
|
||||
- (void) setLineHeightMultiple: (float)factor
|
||||
{
|
||||
_lineHeightMultiple = factor;
|
||||
}
|
||||
|
||||
- (void) setParagraphSpacingBefore: (float)spacing
|
||||
{
|
||||
_paragraphSpacingBefore = spacing;
|
||||
}
|
||||
|
||||
- (void) setHeaderLevel: (int)level
|
||||
{
|
||||
_headerLevel = level;
|
||||
}
|
||||
|
||||
- (void) setHyphenationFactor: (float)factor
|
||||
{
|
||||
_hyphenationFactor = factor;
|
||||
}
|
||||
|
||||
- (void) setTextBlocks: (NSArray *)blocks
|
||||
{
|
||||
ASSIGN(_textBlocks, blocks);
|
||||
}
|
||||
|
||||
- (void) setTextLists: (NSArray *)lists
|
||||
{
|
||||
ASSIGN(_textLists, lists);
|
||||
}
|
||||
|
||||
- (void) setTighteningFactorForTruncation: (float)factor
|
||||
{
|
||||
_tighteningFactorForTruncation = factor;
|
||||
}
|
||||
|
||||
- (void) addTabStop: (NSTextTab*)anObject
|
||||
{
|
||||
unsigned count = [_tabStops count];
|
||||
|
@ -594,6 +790,12 @@ static NSParagraphStyle *defaultStyle = nil;
|
|||
_paragraphSpacing = p->_paragraphSpacing;
|
||||
_tailIndent = p->_tailIndent;
|
||||
_baseDirection = p->_baseDirection;
|
||||
_paragraphSpacingBefore = p->_paragraphSpacingBefore;
|
||||
_defaultTabInterval = p->_defaultTabInterval;
|
||||
_hyphenationFactor = p->_hyphenationFactor;
|
||||
_lineHeightMultiple = p->_lineHeightMultiple;
|
||||
_tighteningFactorForTruncation = p->_tighteningFactorForTruncation;
|
||||
_headerLevel = p->_headerLevel;
|
||||
}
|
||||
|
||||
- (id) copyWithZone: (NSZone*)aZone
|
||||
|
|
|
@ -487,6 +487,13 @@ glyphs to be drawn upside-down, so we need to tell NSFont to flip the fonts.
|
|||
}
|
||||
}
|
||||
|
||||
- (void) drawWithRect:(NSRect)rect
|
||||
options:(NSStringDrawingOptions)options
|
||||
{
|
||||
// FIXME: This ignores options
|
||||
[self drawInRect: rect];
|
||||
}
|
||||
|
||||
- (NSSize) size
|
||||
{
|
||||
int ci;
|
||||
|
@ -499,6 +506,21 @@ glyphs to be drawn upside-down, so we need to tell NSFont to flip the fonts.
|
|||
return cache[ci].usedRect.size;
|
||||
}
|
||||
|
||||
- (NSRect) boundingRectWithSize: (NSSize)size
|
||||
options: (NSStringDrawingOptions)options
|
||||
{
|
||||
int ci;
|
||||
|
||||
// FIXME: This ignores options
|
||||
ci = cache_lookup_attributed_string(self, 1, size, 1);
|
||||
/*
|
||||
An argument could be made for using NSMaxX/NSMaxY here, but that fails
|
||||
horribly on right-aligned strings. For now, we handle that case in a
|
||||
useful way and ignore indents.
|
||||
*/
|
||||
return cache[ci].usedRect;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
/*
|
||||
|
@ -614,6 +636,14 @@ NSAttributedString to do the job.
|
|||
}
|
||||
}
|
||||
|
||||
- (void) drawWithRect: (NSRect)rect
|
||||
options: (NSStringDrawingOptions)options
|
||||
attributes: (NSDictionary *)attributes
|
||||
{
|
||||
// FIXME: This ignores options
|
||||
[self drawInRect: rect withAttributes: attributes];
|
||||
}
|
||||
|
||||
- (NSSize) sizeWithAttributes: (NSDictionary *)attrs
|
||||
{
|
||||
int ci;
|
||||
|
@ -626,6 +656,22 @@ NSAttributedString to do the job.
|
|||
return cache[ci].usedRect.size;
|
||||
}
|
||||
|
||||
- (NSRect) boundingRectWithSize: (NSSize)size
|
||||
options: (NSStringDrawingOptions)options
|
||||
attributes: (NSDictionary *)attributes
|
||||
{
|
||||
int ci;
|
||||
|
||||
// FIXME: This ignores options
|
||||
ci = cache_lookup_string(self, attributes, 1, size, 1);
|
||||
/*
|
||||
An argument could be made for using NSMaxX/NSMaxY here, but that fails
|
||||
horribly on right-aligned strings (which may be the right thing). For now,
|
||||
we handle that case in a useful way and ignore indents.
|
||||
*/
|
||||
return cache[ci].usedRect;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
|
||||
#include "AppKit/NSText.h"
|
||||
|
||||
#include "AppKit/NSAttributedString.h"
|
||||
#include "AppKit/NSPanel.h"
|
||||
#include "AppKit/NSSpellChecker.h"
|
||||
#include "AppKit/NSTextView.h"
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
#include <Foundation/NSUndoManager.h>
|
||||
#include <Foundation/NSValue.h>
|
||||
#include "AppKit/NSApplication.h"
|
||||
#include "AppKit/NSAttributedString.h"
|
||||
#include "AppKit/NSClipView.h"
|
||||
#include "AppKit/NSColor.h"
|
||||
#include "AppKit/NSColorPanel.h"
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
|
||||
#include <Foundation/NSNotification.h>
|
||||
#include <Foundation/NSValue.h>
|
||||
#include "AppKit/NSAttributedString.h"
|
||||
#include "AppKit/NSGraphics.h"
|
||||
#include "AppKit/NSLayoutManager.h"
|
||||
#include "AppKit/NSScrollView.h"
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include <Foundation/NSException.h>
|
||||
#include <Foundation/NSString.h>
|
||||
#include "AppKit/NSApplication.h"
|
||||
#include "AppKit/NSAttributedString.h"
|
||||
#include "AppKit/NSButton.h"
|
||||
#include "AppKit/NSButtonCell.h"
|
||||
#include "AppKit/NSDragging.h"
|
||||
|
|
|
@ -453,6 +453,62 @@ NSString *NSToolTipAttributeName = @"NSToolTipAttributeName";
|
|||
NSString *NSUnderlineColorAttributeName = @"NSUnderlineColorAttributeName";
|
||||
NSString *NSUnderlineStyleAttributeName = @"NSUnderlineStyleAttributeName";
|
||||
|
||||
NSString *NSCharacterShapeAttributeName = @"CharacterShape";
|
||||
NSString *NSGlyphInfoAttributeName = @"GlyphInfo";
|
||||
|
||||
NSString *NSPaperSizeDocumentAttribute = @"PaperSize";
|
||||
NSString *NSLeftMarginDocumentAttribute = @"LeftMargin";
|
||||
NSString *NSRightMarginDocumentAttribute = @"RightMargin";
|
||||
NSString *NSTopMarginDocumentAttribute = @"TopMargin";
|
||||
NSString *NSBottomMarginDocumentAttribute = @"BottomMargin";
|
||||
NSString *NSHyphenationFactorDocumentAttribute = @"HyphenationFactor";
|
||||
NSString *NSDocumentTypeDocumentAttribute = @"DocumentType";
|
||||
NSString *NSCharacterEncodingDocumentAttribute = @"CharacterEncoding";
|
||||
NSString *NSViewSizeDocumentAttribute = @"ViewSize";
|
||||
NSString *NSViewZoomDocumentAttribute = @"ViewZoom";
|
||||
NSString *NSViewModeDocumentAttribute = @"ViewMode";
|
||||
NSString *NSBackgroundColorDocumentAttribute = @"BackgroundColor";
|
||||
NSString *NSCocoaVersionDocumentAttribute = @"CocoaVersion";
|
||||
NSString *NSReadOnlyDocumentAttribute = @"ReadOnly";
|
||||
NSString *NSConvertedDocumentAttribute = @"Converted";
|
||||
NSString *NSDefaultTabIntervalDocumentAttribute = @"DefaultTabInterval";
|
||||
NSString *NSTitleDocumentAttribute = @"Title";
|
||||
NSString *NSCompanyDocumentAttribute = @"Company";
|
||||
NSString *NSCopyrightDocumentAttribute = @"Copyright";
|
||||
NSString *NSSubjectDocumentAttribute = @"Subject";
|
||||
NSString *NSAuthorDocumentAttribute = @"Author";
|
||||
NSString *NSKeywordsDocumentAttribute = @"Keywords";
|
||||
NSString *NSCommentDocumentAttribute = @"Comment";
|
||||
NSString *NSEditorDocumentAttribute = @"Editor";
|
||||
NSString *NSCreationTimeDocumentAttribute = @"CreationTime";
|
||||
NSString *NSModificationTimeDocumentAttribute = @"ModificationTime";
|
||||
|
||||
const unsigned NSUnderlineByWordMask = 0x01;
|
||||
|
||||
NSString *NSPlainTextDocumentType = @"PlainText";
|
||||
NSString *NSRTFTextDocumentType = @"RTF";
|
||||
NSString *NSRTFDTextDocumentType = @"RTFD";
|
||||
NSString *NSMacSimpleTextDocumentType = @"SimpleText";
|
||||
NSString *NSHTMLTextDocumentType = @"HTML";
|
||||
NSString *NSDocFormatTextDocumentType = @"Doc";
|
||||
NSString *NSWordMLTextDocumentType = @"WordML";
|
||||
|
||||
NSString *NSExcludedElementsDocumentAttribute = @"ExcludedElements";
|
||||
NSString *NSTextEncodingNameDocumentAttribute = @"TextEncoding";
|
||||
NSString *NSPrefixSpacesDocumentAttribute = @"PrefixSpaces";
|
||||
|
||||
NSString *NSBaseURLDocumentOption = @"BaseURL";
|
||||
NSString *NSCharacterEncodingDocumentOption = @"CharacterEncoding";
|
||||
NSString *NSDefaultAttributesDocumentOption = @"DefaultAttributes";
|
||||
NSString *NSDocumentTypeDocumentOption = @"DocumentType";
|
||||
NSString *NSTextEncodingNameDocumentOption = @"TextEncoding";
|
||||
NSString *NSTextSizeMultiplierDocumentOption = @"TextSizeMultiplier";
|
||||
NSString *NSTimeoutDocumentOption = @"Timeout";
|
||||
NSString *NSWebPreferencesDocumentOption = @"WebPreferences";
|
||||
NSString *NSWebResourceLoadDelegateDocumentOption = @"WebResourceLoadDelegate";
|
||||
|
||||
// NSTextTab
|
||||
NSString *NSTabColumnTerminatorsAttributeName = @"TabColumnTerminatorsAttributeName";
|
||||
|
||||
// NSToolbar notifications
|
||||
NSString *NSToolbarDidRemoveItemNotification = @"NSToolbarDidRemoveItemNotification";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue