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 // Additional spacing between lines. | |
77 void SetInterlineSpacing(int spacing_in_px); | |
Evan Stade
2014/06/19 00:16:36
It would be more CSS-like if you made this control
Garrett Casto
2014/06/20 23:47:01
Are you saying that a value of 0 should leave no s
Evan Stade
2014/06/23 18:20:40
yes. You could always redefine 0 to be "reset to d
| |
78 | |
76 // Sets the color of the background on which the label is drawn. This won't | 79 // 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 | 80 // be explicitly drawn, but the label will force the text color to be |
78 // readable over it. | 81 // readable over it. |
79 void SetDisplayedOnBackgroundColor(SkColor color); | 82 void SetDisplayedOnBackgroundColor(SkColor color); |
80 SkColor displayed_on_background_color() const { | 83 SkColor displayed_on_background_color() const { |
81 return displayed_on_background_color_; | 84 return displayed_on_background_color_; |
82 } | 85 } |
83 | 86 |
84 void set_auto_color_readability_enabled(bool auto_color_readability) { | 87 void set_auto_color_readability_enabled(bool auto_color_readability) { |
85 auto_color_readability_enabled_ = auto_color_readability; | 88 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. | 118 // has to work with. If |dry_run| is true, the view hierarchy is not touched. |
116 // The return value is the necessary size. | 119 // The return value is the necessary size. |
117 gfx::Size CalculateAndDoLayout(int width, bool dry_run); | 120 gfx::Size CalculateAndDoLayout(int width, bool dry_run); |
118 | 121 |
119 // The text to display. | 122 // The text to display. |
120 base::string16 text_; | 123 base::string16 text_; |
121 | 124 |
122 // Fonts used to display text. Can be augmented by RangeStyleInfo. | 125 // Fonts used to display text. Can be augmented by RangeStyleInfo. |
123 gfx::FontList font_list_; | 126 gfx::FontList font_list_; |
124 | 127 |
128 // Additional spacing, in pixels, added between lines. | |
129 int interline_spacing_; | |
130 | |
125 // The default style to use for any part of the text that isn't within | 131 // The default style to use for any part of the text that isn't within |
126 // a range in |style_ranges_|. | 132 // a range in |style_ranges_|. |
127 RangeStyleInfo default_style_info_; | 133 RangeStyleInfo default_style_info_; |
128 | 134 |
129 // The listener that will be informed of link clicks. | 135 // The listener that will be informed of link clicks. |
130 StyledLabelListener* listener_; | 136 StyledLabelListener* listener_; |
131 | 137 |
132 // The ranges that should be linkified, sorted by start position. | 138 // The ranges that should be linkified, sorted by start position. |
133 StyleRanges style_ranges_; | 139 StyleRanges style_ranges_; |
134 | 140 |
(...skipping 12 matching lines...) Expand all Loading... | |
147 // Controls whether the text is automatically re-colored to be readable on the | 153 // Controls whether the text is automatically re-colored to be readable on the |
148 // background. | 154 // background. |
149 bool auto_color_readability_enabled_; | 155 bool auto_color_readability_enabled_; |
150 | 156 |
151 DISALLOW_COPY_AND_ASSIGN(StyledLabel); | 157 DISALLOW_COPY_AND_ASSIGN(StyledLabel); |
152 }; | 158 }; |
153 | 159 |
154 } // namespace views | 160 } // namespace views |
155 | 161 |
156 #endif // UI_VIEWS_CONTROLS_STYLED_LABEL_H_ | 162 #endif // UI_VIEWS_CONTROLS_STYLED_LABEL_H_ |
OLD | NEW |