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 UI_VIEWS_CONTROLS_LABEL_H_ | 5 #ifndef UI_VIEWS_CONTROLS_LABEL_H_ |
6 #define UI_VIEWS_CONTROLS_LABEL_H_ | 6 #define UI_VIEWS_CONTROLS_LABEL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 SkColor enabled_color() const { return actual_enabled_color_; } | 55 SkColor enabled_color() const { return actual_enabled_color_; } |
56 | 56 |
57 // Sets the background color. This won't be explicitly drawn, but the label | 57 // Sets the background color. This won't be explicitly drawn, but the label |
58 // will force the text color to be readable over it. | 58 // will force the text color to be readable over it. |
59 void SetBackgroundColor(SkColor color); | 59 void SetBackgroundColor(SkColor color); |
60 SkColor background_color() const { return background_color_; } | 60 SkColor background_color() const { return background_color_; } |
61 | 61 |
62 // Set drop shadows underneath the text. | 62 // Set drop shadows underneath the text. |
63 void set_shadows(const gfx::ShadowValues& shadows) { shadows_ = shadows; } | 63 void set_shadows(const gfx::ShadowValues& shadows) { shadows_ = shadows; } |
64 | 64 |
| 65 // Sets whether subpixel rendering is used; the default is true, but this |
| 66 // feature also requires an opaque background color. |
| 67 void set_subpixel_rendering_enabled(bool subpixel_rendering_enabled) { |
| 68 subpixel_rendering_enabled_ = subpixel_rendering_enabled; |
| 69 } |
| 70 |
65 // Set the color of a halo on the painted text (use transparent for none). | 71 // Set the color of a halo on the painted text (use transparent for none). |
66 void set_halo_color(SkColor halo_color) { halo_color_ = halo_color; } | 72 void set_halo_color(SkColor halo_color) { halo_color_ = halo_color; } |
67 | 73 |
68 // Sets the horizontal alignment; the argument value is mirrored in RTL UI. | 74 // Sets the horizontal alignment; the argument value is mirrored in RTL UI. |
69 void SetHorizontalAlignment(gfx::HorizontalAlignment alignment); | 75 void SetHorizontalAlignment(gfx::HorizontalAlignment alignment); |
70 gfx::HorizontalAlignment GetHorizontalAlignment() const; | 76 gfx::HorizontalAlignment GetHorizontalAlignment() const; |
71 | 77 |
72 // Sets the directionality mode. The default value is DIRECTIONALITY_FROM_UI, | 78 // Sets the directionality mode. The default value is DIRECTIONALITY_FROM_UI, |
73 // which should be suitable for most text originating from UI string assets. | 79 // which should be suitable for most text originating from UI string assets. |
74 // Most text originating from web content should use DIRECTIONALITY_FROM_TEXT. | 80 // Most text originating from web content should use DIRECTIONALITY_FROM_TEXT. |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 SkColor actual_enabled_color_; | 217 SkColor actual_enabled_color_; |
212 SkColor requested_disabled_color_; | 218 SkColor requested_disabled_color_; |
213 SkColor actual_disabled_color_; | 219 SkColor actual_disabled_color_; |
214 SkColor background_color_; | 220 SkColor background_color_; |
215 | 221 |
216 // Set to true once the corresponding setter is invoked. | 222 // Set to true once the corresponding setter is invoked. |
217 bool enabled_color_set_; | 223 bool enabled_color_set_; |
218 bool disabled_color_set_; | 224 bool disabled_color_set_; |
219 bool background_color_set_; | 225 bool background_color_set_; |
220 | 226 |
| 227 bool subpixel_rendering_enabled_; |
221 bool auto_color_readability_; | 228 bool auto_color_readability_; |
222 mutable gfx::Size text_size_; | 229 mutable gfx::Size text_size_; |
223 mutable bool text_size_valid_; | 230 mutable bool text_size_valid_; |
224 int line_height_; | 231 int line_height_; |
225 bool is_multi_line_; | 232 bool is_multi_line_; |
226 bool is_obscured_; | 233 bool is_obscured_; |
227 bool allow_character_break_; | 234 bool allow_character_break_; |
228 gfx::ElideBehavior elide_behavior_; | 235 gfx::ElideBehavior elide_behavior_; |
229 gfx::HorizontalAlignment horizontal_alignment_; | 236 gfx::HorizontalAlignment horizontal_alignment_; |
230 base::string16 tooltip_text_; | 237 base::string16 tooltip_text_; |
(...skipping 10 matching lines...) Expand all Loading... |
241 // The cached heights to avoid recalculation in GetHeightForWidth(). | 248 // The cached heights to avoid recalculation in GetHeightForWidth(). |
242 mutable std::vector<gfx::Size> cached_heights_; | 249 mutable std::vector<gfx::Size> cached_heights_; |
243 mutable int cached_heights_cursor_; | 250 mutable int cached_heights_cursor_; |
244 | 251 |
245 DISALLOW_COPY_AND_ASSIGN(Label); | 252 DISALLOW_COPY_AND_ASSIGN(Label); |
246 }; | 253 }; |
247 | 254 |
248 } // namespace views | 255 } // namespace views |
249 | 256 |
250 #endif // UI_VIEWS_CONTROLS_LABEL_H_ | 257 #endif // UI_VIEWS_CONTROLS_LABEL_H_ |
OLD | NEW |