| 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. |
| 98 double shadow_blur() const { return shadow_blur_; } |
| 99 void set_shadow_blur(double shadow_blur) { shadow_blur_ = shadow_blur; } |
| 100 |
| 97 // Disables shadows. | 101 // Disables shadows. |
| 98 void ClearEmbellishing(); | 102 void ClearEmbellishing(); |
| 99 | 103 |
| 100 // Sets horizontal alignment. If the locale is RTL, and the directionality | 104 // Sets horizontal alignment. If the locale is RTL, and the directionality |
| 101 // mode is USE_UI_DIRECTIONALITY, the alignment is flipped around. | 105 // mode is USE_UI_DIRECTIONALITY, the alignment is flipped around. |
| 102 // | 106 // |
| 103 // Caveat: for labels originating from a web page, the directionality mode | 107 // Caveat: for labels originating from a web page, the directionality mode |
| 104 // should be reset to AUTO_DETECT_DIRECTIONALITY before the horizontal | 108 // should be reset to AUTO_DETECT_DIRECTIONALITY before the horizontal |
| 105 // alignment is set. Otherwise, the label's alignment specified as a parameter | 109 // alignment is set. Otherwise, the label's alignment specified as a parameter |
| 106 // will be flipped in RTL locales. | 110 // will be flipped in RTL locales. |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 SkColor background_color_; | 264 SkColor background_color_; |
| 261 | 265 |
| 262 // Set to true once the corresponding setter is invoked. | 266 // Set to true once the corresponding setter is invoked. |
| 263 bool enabled_color_set_; | 267 bool enabled_color_set_; |
| 264 bool disabled_color_set_; | 268 bool disabled_color_set_; |
| 265 bool background_color_set_; | 269 bool background_color_set_; |
| 266 | 270 |
| 267 bool auto_color_readability_; | 271 bool auto_color_readability_; |
| 268 mutable gfx::Size text_size_; | 272 mutable gfx::Size text_size_; |
| 269 mutable bool text_size_valid_; | 273 mutable bool text_size_valid_; |
| 274 // Indicates the level of shadow blurring. Default is zero. |
| 275 double shadow_blur_; |
| 270 int line_height_; | 276 int line_height_; |
| 271 bool is_multi_line_; | 277 bool is_multi_line_; |
| 272 bool is_obscured_; | 278 bool is_obscured_; |
| 273 bool allow_character_break_; | 279 bool allow_character_break_; |
| 274 ElideBehavior elide_behavior_; | 280 ElideBehavior elide_behavior_; |
| 275 gfx::HorizontalAlignment horizontal_alignment_; | 281 gfx::HorizontalAlignment horizontal_alignment_; |
| 276 base::string16 tooltip_text_; | 282 base::string16 tooltip_text_; |
| 277 // Whether to collapse the label when it's not visible. | 283 // Whether to collapse the label when it's not visible. |
| 278 bool collapse_when_hidden_; | 284 bool collapse_when_hidden_; |
| 279 // The following member variable is used to control whether the | 285 // The following member variable is used to control whether the |
| 280 // directionality is auto-detected based on first strong directionality | 286 // directionality is auto-detected based on first strong directionality |
| 281 // character or is determined by chrome UI's locale. | 287 // character or is determined by chrome UI's locale. |
| 282 DirectionalityMode directionality_mode_; | 288 DirectionalityMode directionality_mode_; |
| 283 | 289 |
| 284 // Colors for shadow. | 290 // Colors for shadow. |
| 285 SkColor enabled_shadow_color_; | 291 SkColor enabled_shadow_color_; |
| 286 SkColor disabled_shadow_color_; | 292 SkColor disabled_shadow_color_; |
| 287 | 293 |
| 288 // Space between text and shadow. | 294 // Space between text and shadow. |
| 289 gfx::Point shadow_offset_; | 295 gfx::Point shadow_offset_; |
| 290 | 296 |
| 291 // Should a shadow be drawn behind the text? | 297 // Should a shadow be drawn behind the text? |
| 292 bool has_shadow_; | 298 bool has_shadow_; |
| 293 | 299 |
| 300 // If true, surrender the text with the shadow. Default is false. |
| 301 bool mirror_shadow_; |
| 302 |
| 294 // The cached heights to avoid recalculation in GetHeightForWidth(). | 303 // The cached heights to avoid recalculation in GetHeightForWidth(). |
| 295 std::vector<gfx::Size> cached_heights_; | 304 std::vector<gfx::Size> cached_heights_; |
| 296 int cached_heights_cursor_; | 305 int cached_heights_cursor_; |
| 297 | 306 |
| 298 DISALLOW_COPY_AND_ASSIGN(Label); | 307 DISALLOW_COPY_AND_ASSIGN(Label); |
| 299 }; | 308 }; |
| 300 | 309 |
| 301 } // namespace views | 310 } // namespace views |
| 302 | 311 |
| 303 #endif // UI_VIEWS_CONTROLS_LABEL_H_ | 312 #endif // UI_VIEWS_CONTROLS_LABEL_H_ |
| OLD | NEW |