Chromium Code Reviews| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 87 // will force the text color to be readable over it. | 87 // will force the text color to be readable over it. |
| 88 void SetBackgroundColor(SkColor color); | 88 void SetBackgroundColor(SkColor color); |
| 89 SkColor background_color() const { return background_color_; } | 89 SkColor background_color() const { return background_color_; } |
| 90 | 90 |
| 91 // Enables a drop shadow underneath the text. | 91 // Enables a drop shadow underneath the text. |
| 92 void SetShadowColors(SkColor enabled_color, SkColor disabled_color); | 92 void SetShadowColors(SkColor enabled_color, SkColor disabled_color); |
| 93 | 93 |
| 94 // Sets the drop shadow's offset from the text. | 94 // Sets the drop shadow's offset from the text. |
| 95 void SetShadowOffset(int x, int y); | 95 void SetShadowOffset(int x, int y); |
| 96 | 96 |
| 97 // Sets the shadow blur. Default is zero. | |
|
tdanderson
2014/04/14 16:58:39
What is the allowable range for shadow_blur_? 0.0
Nina
2014/04/14 17:59:17
It's a bit more complicated. Please see the follow
| |
| 98 double shadow_blur() const { return shadow_blur_; } | |
| 99 void SetShadowBlur(double shadow_blur_); | |
| 100 | |
| 101 // If true, let the shadow surrender the text. Default is false. | |
|
tdanderson
2014/04/14 16:58:39
surrender->surround
Nina
2014/04/14 17:59:17
Done.
| |
| 102 bool mirror_shadow() const { return mirror_shadow_; } | |
| 103 void SetMirrorShadow(bool mirror_shadow); | |
|
tdanderson
2014/04/14 16:58:39
Since the mutators just have simple one-line imple
Nina
2014/04/14 17:59:17
I'm using the same logic as in SetShadowOffset and
| |
| 104 | |
| 97 // Disables shadows. | 105 // Disables shadows. |
| 98 void ClearEmbellishing(); | 106 void ClearEmbellishing(); |
| 99 | 107 |
| 100 // Sets horizontal alignment. If the locale is RTL, and the directionality | 108 // Sets horizontal alignment. If the locale is RTL, and the directionality |
| 101 // mode is USE_UI_DIRECTIONALITY, the alignment is flipped around. | 109 // mode is USE_UI_DIRECTIONALITY, the alignment is flipped around. |
| 102 // | 110 // |
| 103 // Caveat: for labels originating from a web page, the directionality mode | 111 // Caveat: for labels originating from a web page, the directionality mode |
| 104 // should be reset to AUTO_DETECT_DIRECTIONALITY before the horizontal | 112 // should be reset to AUTO_DETECT_DIRECTIONALITY before the horizontal |
| 105 // alignment is set. Otherwise, the label's alignment specified as a parameter | 113 // alignment is set. Otherwise, the label's alignment specified as a parameter |
| 106 // will be flipped in RTL locales. | 114 // will be flipped in RTL locales. |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 260 SkColor background_color_; | 268 SkColor background_color_; |
| 261 | 269 |
| 262 // Set to true once the corresponding setter is invoked. | 270 // Set to true once the corresponding setter is invoked. |
| 263 bool enabled_color_set_; | 271 bool enabled_color_set_; |
| 264 bool disabled_color_set_; | 272 bool disabled_color_set_; |
| 265 bool background_color_set_; | 273 bool background_color_set_; |
| 266 | 274 |
| 267 bool auto_color_readability_; | 275 bool auto_color_readability_; |
| 268 mutable gfx::Size text_size_; | 276 mutable gfx::Size text_size_; |
| 269 mutable bool text_size_valid_; | 277 mutable bool text_size_valid_; |
| 278 double shadow_blur_; | |
|
tdanderson
2014/04/14 16:58:39
Add brief comments explaining what shadow_blur_ an
Nina
2014/04/14 17:59:17
Done.
| |
| 270 int line_height_; | 279 int line_height_; |
| 271 bool is_multi_line_; | 280 bool is_multi_line_; |
| 272 bool is_obscured_; | 281 bool is_obscured_; |
| 273 bool allow_character_break_; | 282 bool allow_character_break_; |
| 274 ElideBehavior elide_behavior_; | 283 ElideBehavior elide_behavior_; |
| 275 gfx::HorizontalAlignment horizontal_alignment_; | 284 gfx::HorizontalAlignment horizontal_alignment_; |
| 276 base::string16 tooltip_text_; | 285 base::string16 tooltip_text_; |
| 277 // Whether to collapse the label when it's not visible. | 286 // Whether to collapse the label when it's not visible. |
| 278 bool collapse_when_hidden_; | 287 bool collapse_when_hidden_; |
| 279 // The following member variable is used to control whether the | 288 // The following member variable is used to control whether the |
| 280 // directionality is auto-detected based on first strong directionality | 289 // directionality is auto-detected based on first strong directionality |
| 281 // character or is determined by chrome UI's locale. | 290 // character or is determined by chrome UI's locale. |
| 282 DirectionalityMode directionality_mode_; | 291 DirectionalityMode directionality_mode_; |
| 283 | 292 |
| 284 // Colors for shadow. | 293 // Colors for shadow. |
| 285 SkColor enabled_shadow_color_; | 294 SkColor enabled_shadow_color_; |
| 286 SkColor disabled_shadow_color_; | 295 SkColor disabled_shadow_color_; |
| 287 | 296 |
| 288 // Space between text and shadow. | 297 // Space between text and shadow. |
| 289 gfx::Point shadow_offset_; | 298 gfx::Point shadow_offset_; |
| 290 | 299 |
| 291 // Should a shadow be drawn behind the text? | 300 // Should a shadow be drawn behind the text? |
| 292 bool has_shadow_; | 301 bool has_shadow_; |
| 293 | 302 |
| 303 bool mirror_shadow_; | |
| 304 | |
| 294 // The cached heights to avoid recalculation in GetHeightForWidth(). | 305 // The cached heights to avoid recalculation in GetHeightForWidth(). |
| 295 std::vector<gfx::Size> cached_heights_; | 306 std::vector<gfx::Size> cached_heights_; |
| 296 int cached_heights_cursor_; | 307 int cached_heights_cursor_; |
| 297 | 308 |
| 298 DISALLOW_COPY_AND_ASSIGN(Label); | 309 DISALLOW_COPY_AND_ASSIGN(Label); |
| 299 }; | 310 }; |
| 300 | 311 |
| 301 } // namespace views | 312 } // namespace views |
| 302 | 313 |
| 303 #endif // UI_VIEWS_CONTROLS_LABEL_H_ | 314 #endif // UI_VIEWS_CONTROLS_LABEL_H_ |
| OLD | NEW |