| Index: ios/chrome/browser/ui/fade_truncated_label.h
|
| diff --git a/ios/chrome/browser/ui/fade_truncated_label.h b/ios/chrome/browser/ui/fade_truncated_label.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..088099c49008a0f734bafa21723e95d9655b7684
|
| --- /dev/null
|
| +++ b/ios/chrome/browser/ui/fade_truncated_label.h
|
| @@ -0,0 +1,39 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef IOS_CHROME_BROWSER_UI_FADE_TRUNCATED_LABEL_H_
|
| +#define IOS_CHROME_BROWSER_UI_FADE_TRUNCATED_LABEL_H_
|
| +
|
| +#import <UIKit/UIKit.h>
|
| +
|
| +// A label class that applies a gradient fade to the end of a label whose bounds
|
| +// are too small to draw the entire string. This class uses a CAGradientLayer
|
| +// as a mask instead of clipping the drawing context of the label.
|
| +@interface FadeTruncatedLabel : UILabel
|
| +
|
| +// Returns a CAGadientLayer to use as a label's masking layer that will apply
|
| +// a fade truncation if |text| takes up more space than |bounds| when drawn
|
| +// with |attributes|.
|
| ++ (CAGradientLayer*)maskLayerForText:(NSString*)text
|
| + withAttributes:(NSDictionary*)attributes
|
| + inBounds:(CGRect)bounds;
|
| +
|
| +// Adds animations from |beginFrame| to |endFrame| using the provided |duration|
|
| +// and |timingFunction|.
|
| +- (void)animateFromBeginFrame:(CGRect)beginFrame
|
| + toEndFrame:(CGRect)endFrame
|
| + duration:(CFTimeInterval)duration
|
| + timingFunction:(CAMediaTimingFunction*)timingFunction;
|
| +
|
| +// Reverses animations added by
|
| +// |-animateFromBeginFrame:toEndFrame:duration:timingFunction:|.
|
| +- (void)reverseAnimations;
|
| +
|
| +// Removes animations added by
|
| +// |-animateFromBeginFrame:toEndFrame:duration:timingFunction:|.
|
| +- (void)cleanUpAnimations;
|
| +
|
| +@end
|
| +
|
| +#endif // IOS_CHROME_BROWSER_UI_FADE_TRUNCATED_LABEL_H_
|
|
|