| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 UI_VIEWS_CONTROLS_STYLED_LABEL_H_ | 5 #ifndef UI_VIEWS_CONTROLS_STYLED_LABEL_H_ |
| 6 #define UI_VIEWS_CONTROLS_STYLED_LABEL_H_ | 6 #define UI_VIEWS_CONTROLS_STYLED_LABEL_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 void SetBaseFontList(const gfx::FontList& font_list); | 66 void SetBaseFontList(const gfx::FontList& font_list); |
| 67 | 67 |
| 68 // Marks the given range within |text_| with style defined by |style_info|. | 68 // Marks the given range within |text_| with style defined by |style_info|. |
| 69 // |range| must be contained in |text_|. | 69 // |range| must be contained in |text_|. |
| 70 void AddStyleRange(const gfx::Range& range, const RangeStyleInfo& style_info); | 70 void AddStyleRange(const gfx::Range& range, const RangeStyleInfo& style_info); |
| 71 | 71 |
| 72 // Sets the default style to use for any part of the text that isn't within | 72 // Sets the default style to use for any part of the text that isn't within |
| 73 // a range set by AddStyleRange. | 73 // a range set by AddStyleRange. |
| 74 void SetDefaultStyle(const RangeStyleInfo& style_info); | 74 void SetDefaultStyle(const RangeStyleInfo& style_info); |
| 75 | 75 |
| 76 // Get or set the distance in pixels between baselines of multi-line text. |
| 77 // Default is 0, indicating the distance between lines should be the standard |
| 78 // one for the label's text, font list, and platform. |
| 79 void SetLineHeight(int height); |
| 80 |
| 76 // Sets the color of the background on which the label is drawn. This won't | 81 // Sets the color of the background on which the label is drawn. This won't |
| 77 // be explicitly drawn, but the label will force the text color to be | 82 // be explicitly drawn, but the label will force the text color to be |
| 78 // readable over it. | 83 // readable over it. |
| 79 void SetDisplayedOnBackgroundColor(SkColor color); | 84 void SetDisplayedOnBackgroundColor(SkColor color); |
| 80 SkColor displayed_on_background_color() const { | 85 SkColor displayed_on_background_color() const { |
| 81 return displayed_on_background_color_; | 86 return displayed_on_background_color_; |
| 82 } | 87 } |
| 83 | 88 |
| 84 void set_auto_color_readability_enabled(bool auto_color_readability) { | 89 void set_auto_color_readability_enabled(bool auto_color_readability) { |
| 85 auto_color_readability_enabled_ = auto_color_readability; | 90 auto_color_readability_enabled_ = auto_color_readability; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 115 // has to work with. If |dry_run| is true, the view hierarchy is not touched. | 120 // has to work with. If |dry_run| is true, the view hierarchy is not touched. |
| 116 // The return value is the necessary size. | 121 // The return value is the necessary size. |
| 117 gfx::Size CalculateAndDoLayout(int width, bool dry_run); | 122 gfx::Size CalculateAndDoLayout(int width, bool dry_run); |
| 118 | 123 |
| 119 // The text to display. | 124 // The text to display. |
| 120 base::string16 text_; | 125 base::string16 text_; |
| 121 | 126 |
| 122 // Fonts used to display text. Can be augmented by RangeStyleInfo. | 127 // Fonts used to display text. Can be augmented by RangeStyleInfo. |
| 123 gfx::FontList font_list_; | 128 gfx::FontList font_list_; |
| 124 | 129 |
| 130 // Line height. |
| 131 int specified_line_height_; |
| 132 |
| 125 // The default style to use for any part of the text that isn't within | 133 // The default style to use for any part of the text that isn't within |
| 126 // a range in |style_ranges_|. | 134 // a range in |style_ranges_|. |
| 127 RangeStyleInfo default_style_info_; | 135 RangeStyleInfo default_style_info_; |
| 128 | 136 |
| 129 // The listener that will be informed of link clicks. | 137 // The listener that will be informed of link clicks. |
| 130 StyledLabelListener* listener_; | 138 StyledLabelListener* listener_; |
| 131 | 139 |
| 132 // The ranges that should be linkified, sorted by start position. | 140 // The ranges that should be linkified, sorted by start position. |
| 133 StyleRanges style_ranges_; | 141 StyleRanges style_ranges_; |
| 134 | 142 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 147 // Controls whether the text is automatically re-colored to be readable on the | 155 // Controls whether the text is automatically re-colored to be readable on the |
| 148 // background. | 156 // background. |
| 149 bool auto_color_readability_enabled_; | 157 bool auto_color_readability_enabled_; |
| 150 | 158 |
| 151 DISALLOW_COPY_AND_ASSIGN(StyledLabel); | 159 DISALLOW_COPY_AND_ASSIGN(StyledLabel); |
| 152 }; | 160 }; |
| 153 | 161 |
| 154 } // namespace views | 162 } // namespace views |
| 155 | 163 |
| 156 #endif // UI_VIEWS_CONTROLS_STYLED_LABEL_H_ | 164 #endif // UI_VIEWS_CONTROLS_STYLED_LABEL_H_ |
| OLD | NEW |