From fb696efd169db17e8169d0d0cfd1caf0728c0722 Mon Sep 17 00:00:00 2001 From: "gtm.daemon" Date: Fri, 18 Mar 2011 21:00:21 +0000 Subject: [Author: sail] Currently GTMFadeTruncatingTextFieldCell only supports truncating the tail of a string. It should also allow the head of a string to be truncated. I'd like to use this in Chromium. See http://crbug.com/69304 R=thomasvl APPROVED=thomasvl DELTA=238 (197 added, 17 deleted, 24 changed) --- AppKit/GTMFadeTruncatingTextFieldCell.h | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'AppKit/GTMFadeTruncatingTextFieldCell.h') diff --git a/AppKit/GTMFadeTruncatingTextFieldCell.h b/AppKit/GTMFadeTruncatingTextFieldCell.h index 76e7b1c..267d4b8 100644 --- a/AppKit/GTMFadeTruncatingTextFieldCell.h +++ b/AppKit/GTMFadeTruncatingTextFieldCell.h @@ -21,8 +21,26 @@ #if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 -// A simple text field cell that truncates the right hand edge using a gradient -@interface GTMFadeTruncatingTextFieldCell : NSTextFieldCell +typedef enum { + GTMFadeTruncatingTail, + GTMFadeTruncatingHead, + GTMFadeTruncatingHeadAndTail, +} GTMFadeTruncateMode; + +// A simple text field cell that can truncate at the beginning or the end +// using a gradient. By default it truncates the end. +@interface GTMFadeTruncatingTextFieldCell : NSTextFieldCell { + @private + NSUInteger desiredCharactersToTruncateFromHead_; + GTMFadeTruncateMode truncateMode_; +} + +@property (nonatomic) GTMFadeTruncateMode truncateMode; + +// When truncating the head this specifies the maximum number of characters +// that can be truncated. Setting this to 0 means that there is no maximum. +@property (nonatomic) NSUInteger desiredCharactersToTruncateFromHead; + @end #endif -- cgit v1.2.3