| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 // applies to every label that originates from the Chrome UI. However, if the | 110 // applies to every label that originates from the Chrome UI. However, if the |
| 111 // label originates from a web page, its directionality is auto-detected. | 111 // label originates from a web page, its directionality is auto-detected. |
| 112 void set_directionality_mode(DirectionalityMode mode) { | 112 void set_directionality_mode(DirectionalityMode mode) { |
| 113 directionality_mode_ = mode; | 113 directionality_mode_ = mode; |
| 114 } | 114 } |
| 115 | 115 |
| 116 DirectionalityMode directionality_mode() const { | 116 DirectionalityMode directionality_mode() const { |
| 117 return directionality_mode_; | 117 return directionality_mode_; |
| 118 } | 118 } |
| 119 | 119 |
| 120 // Get or set the distance in pixels between baselines of multi-line text. |
| 121 // Default is 0, indicating the distance between lines should be the standard |
| 122 // one for the label's text, font, and platform. |
| 123 int line_height() const { return line_height_; } |
| 124 void SetLineHeight(int height); |
| 125 |
| 120 // Get or set if the label text can wrap on multiple lines; default is false. | 126 // Get or set if the label text can wrap on multiple lines; default is false. |
| 121 bool is_multi_line() const { return is_multi_line_; } | 127 bool is_multi_line() const { return is_multi_line_; } |
| 122 void SetMultiLine(bool multi_line); | 128 void SetMultiLine(bool multi_line); |
| 123 | 129 |
| 124 // Sets whether the label text can be split on words. | 130 // Sets whether the label text can be split on words. |
| 125 // Default is false. This only works when is_multi_line is true. | 131 // Default is false. This only works when is_multi_line is true. |
| 126 void SetAllowCharacterBreak(bool allow_character_break); | 132 void SetAllowCharacterBreak(bool allow_character_break); |
| 127 | 133 |
| 128 // Sets whether the label text should be elided in the middle or end (if | 134 // Sets whether the label text should be elided in the middle or end (if |
| 129 // necessary). The default is to not elide at all. | 135 // necessary). The default is to not elide at all. |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 SkColor background_color_; | 241 SkColor background_color_; |
| 236 | 242 |
| 237 // Set to true once the corresponding setter is invoked. | 243 // Set to true once the corresponding setter is invoked. |
| 238 bool enabled_color_set_; | 244 bool enabled_color_set_; |
| 239 bool disabled_color_set_; | 245 bool disabled_color_set_; |
| 240 bool background_color_set_; | 246 bool background_color_set_; |
| 241 | 247 |
| 242 bool auto_color_readability_; | 248 bool auto_color_readability_; |
| 243 mutable gfx::Size text_size_; | 249 mutable gfx::Size text_size_; |
| 244 mutable bool text_size_valid_; | 250 mutable bool text_size_valid_; |
| 251 int line_height_; |
| 245 bool is_multi_line_; | 252 bool is_multi_line_; |
| 246 bool allow_character_break_; | 253 bool allow_character_break_; |
| 247 ElideBehavior elide_behavior_; | 254 ElideBehavior elide_behavior_; |
| 248 gfx::HorizontalAlignment horizontal_alignment_; | 255 gfx::HorizontalAlignment horizontal_alignment_; |
| 249 string16 tooltip_text_; | 256 string16 tooltip_text_; |
| 250 // Whether to collapse the label when it's not visible. | 257 // Whether to collapse the label when it's not visible. |
| 251 bool collapse_when_hidden_; | 258 bool collapse_when_hidden_; |
| 252 // The following member variable is used to control whether the | 259 // The following member variable is used to control whether the |
| 253 // directionality is auto-detected based on first strong directionality | 260 // directionality is auto-detected based on first strong directionality |
| 254 // character or is determined by chrome UI's locale. | 261 // character or is determined by chrome UI's locale. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 271 // The cached heights to avoid recalculation in GetHeightForWidth(). | 278 // The cached heights to avoid recalculation in GetHeightForWidth(). |
| 272 std::vector<gfx::Size> cached_heights_; | 279 std::vector<gfx::Size> cached_heights_; |
| 273 int cached_heights_cursor_; | 280 int cached_heights_cursor_; |
| 274 | 281 |
| 275 DISALLOW_COPY_AND_ASSIGN(Label); | 282 DISALLOW_COPY_AND_ASSIGN(Label); |
| 276 }; | 283 }; |
| 277 | 284 |
| 278 } // namespace views | 285 } // namespace views |
| 279 | 286 |
| 280 #endif // UI_VIEWS_CONTROLS_LABEL_H_ | 287 #endif // UI_VIEWS_CONTROLS_LABEL_H_ |
| OLD | NEW |