Chromium Code Reviews| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 bool is_link; | 61 bool is_link; |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 // Note that any trailing whitespace in |text| will be trimmed. | 64 // Note that any trailing whitespace in |text| will be trimmed. |
| 65 StyledLabel(const base::string16& text, StyledLabelListener* listener); | 65 StyledLabel(const base::string16& text, StyledLabelListener* listener); |
| 66 ~StyledLabel() override; | 66 ~StyledLabel() override; |
| 67 | 67 |
| 68 // Sets the text to be displayed, and clears any previous styling. | 68 // Sets the text to be displayed, and clears any previous styling. |
| 69 void SetText(const base::string16& text); | 69 void SetText(const base::string16& text); |
| 70 | 70 |
| 71 base::string16 text() const { return text_; } | |
|
sky
2016/11/03 13:24:23
const base::string16&?
juncai
2016/11/03 20:26:24
Done.
| |
| 72 | |
| 71 // Sets the fonts used by all labels. Can be augemented by styling set by | 73 // Sets the fonts used by all labels. Can be augemented by styling set by |
| 72 // AddStyleRange and SetDefaultStyle. | 74 // AddStyleRange and SetDefaultStyle. |
| 73 void SetBaseFontList(const gfx::FontList& font_list); | 75 void SetBaseFontList(const gfx::FontList& font_list); |
| 74 | 76 |
| 75 // Marks the given range within |text_| with style defined by |style_info|. | 77 // Marks the given range within |text_| with style defined by |style_info|. |
| 76 // |range| must be contained in |text_|. | 78 // |range| must be contained in |text_|. |
| 77 void AddStyleRange(const gfx::Range& range, const RangeStyleInfo& style_info); | 79 void AddStyleRange(const gfx::Range& range, const RangeStyleInfo& style_info); |
| 78 | 80 |
| 79 // Sets the default style to use for any part of the text that isn't within | 81 // Sets the default style to use for any part of the text that isn't within |
| 80 // a range set by AddStyleRange. | 82 // a range set by AddStyleRange. |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 175 // Controls whether the text is automatically re-colored to be readable on the | 177 // Controls whether the text is automatically re-colored to be readable on the |
| 176 // background. | 178 // background. |
| 177 bool auto_color_readability_enabled_; | 179 bool auto_color_readability_enabled_; |
| 178 | 180 |
| 179 DISALLOW_COPY_AND_ASSIGN(StyledLabel); | 181 DISALLOW_COPY_AND_ASSIGN(StyledLabel); |
| 180 }; | 182 }; |
| 181 | 183 |
| 182 } // namespace views | 184 } // namespace views |
| 183 | 185 |
| 184 #endif // UI_VIEWS_CONTROLS_STYLED_LABEL_H_ | 186 #endif // UI_VIEWS_CONTROLS_STYLED_LABEL_H_ |
| OLD | NEW |