Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Unified Diff: ios/chrome/browser/ui/fade_truncated_label.h

Issue 2588713002: Upstream Chrome on iOS source code [4/11]. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/chrome/browser/ui/external_file_remover.mm ('k') | ios/chrome/browser/ui/fade_truncated_label.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_
« no previous file with comments | « ios/chrome/browser/ui/external_file_remover.mm ('k') | ios/chrome/browser/ui/fade_truncated_label.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698