| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef IOS_CHROME_BROWSER_UI_OMNIBOX_TRUNCATING_ATTRIBUTED_LABEL_H_ | 5 #ifndef IOS_CHROME_BROWSER_UI_OMNIBOX_TRUNCATING_ATTRIBUTED_LABEL_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_OMNIBOX_TRUNCATING_ATTRIBUTED_LABEL_H_ | 6 #define IOS_CHROME_BROWSER_UI_OMNIBOX_TRUNCATING_ATTRIBUTED_LABEL_H_ |
| 7 | 7 |
| 8 #import <CoreText/CoreText.h> | |
| 9 #import <QuartzCore/QuartzCore.h> | |
| 10 #import <UIKit/UIKit.h> | 8 #import <UIKit/UIKit.h> |
| 11 | 9 |
| 12 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
| 13 | 11 |
| 14 typedef enum { | 12 typedef enum { |
| 15 OmniboxPopupTruncatingTail = 0x1, | 13 OmniboxPopupTruncatingTail = 0x1, |
| 16 OmniboxPopupTruncatingHead = 0x2, | 14 OmniboxPopupTruncatingHead = 0x2, |
| 17 OmniboxPopupTruncatingHeadAndTail = | 15 OmniboxPopupTruncatingHeadAndTail = |
| 18 OmniboxPopupTruncatingHead | OmniboxPopupTruncatingTail | 16 OmniboxPopupTruncatingHead | OmniboxPopupTruncatingTail |
| 19 } OmniboxPopupTruncatingMode; | 17 } OmniboxPopupTruncatingMode; |
| 20 | 18 |
| 21 // This is a copy of GTMFadeTruncatingLabel that supports | 19 // A label which applies a fade-to-background color gradient to one or both ends |
| 22 // NSMutableAttributedString to change font (face and size), and color by using | 20 // of the string if it is too large to fit the available area. It is based on |
| 23 // CATextLayer. Unlike GTMFadeTruncatingLabel, it's not based on a UILabel, so | 21 // GTMFadeTruncatingLabel but uses the attributedText property of UILabel rather |
| 24 // it does not support shadowOffset and shadowColor, baselineAdjustment, | 22 // than the text and font properties. |
| 25 // highlighted, minimumFontSize, and numberOfLines. | 23 @interface OmniboxPopupTruncatingLabel : UILabel |
| 26 @interface OmniboxPopupTruncatingLabel : UIView | |
| 27 | 24 |
| 28 // Which side(s) to truncate. | 25 // Which side(s) to truncate. |
| 29 @property(nonatomic, assign) OmniboxPopupTruncatingMode truncateMode; | 26 @property(nonatomic, assign) OmniboxPopupTruncatingMode truncateMode; |
| 30 | 27 |
| 31 // Text alignment. | |
| 32 @property(nonatomic, assign) NSTextAlignment textAlignment; | |
| 33 | |
| 34 // For display of an attributed string. | |
| 35 @property(nonatomic, retain) NSMutableAttributedString* attributedText; | |
| 36 | |
| 37 // Set the label highlight state. | |
| 38 @property(nonatomic, assign) BOOL highlighted; | |
| 39 | |
| 40 // Set the label highlight color. | |
| 41 @property(nonatomic, retain) NSMutableAttributedString* highlightedText; | |
| 42 | |
| 43 @end | 28 @end |
| 44 | 29 |
| 45 #endif // IOS_CHROME_BROWSER_UI_OMNIBOX_TRUNCATING_ATTRIBUTED_LABEL_H_ | 30 #endif // IOS_CHROME_BROWSER_UI_OMNIBOX_TRUNCATING_ATTRIBUTED_LABEL_H_ |
| OLD | NEW |