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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
125 | 125 |
126 // 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. |
127 bool is_multi_line() const { return is_multi_line_; } | 127 bool is_multi_line() const { return is_multi_line_; } |
128 void SetMultiLine(bool multi_line); | 128 void SetMultiLine(bool multi_line); |
129 | 129 |
130 // Sets whether the label text can be split on words. | 130 // Sets whether the label text can be split on words. |
131 // 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. |
132 void SetAllowCharacterBreak(bool allow_character_break); | 132 void SetAllowCharacterBreak(bool allow_character_break); |
133 | 133 |
134 // 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 |
135 // necessary). The default is to not elide at all. | 135 // necessary). The default is to to elide at the end. |
Alexei Svitkine (slow)
2013/05/17 13:49:52
Nit: "to to" -> "to"
| |
136 // NOTE: Eliding in the middle is not supported for multi-line strings. | 136 // NOTE: Eliding in the middle is not supported for multi-line strings. |
137 void SetElideBehavior(ElideBehavior elide_behavior); | 137 void SetElideBehavior(ElideBehavior elide_behavior); |
138 | 138 |
139 // Sets the tooltip text. Default behavior for a label (single-line) is to | 139 // Sets the tooltip text. Default behavior for a label (single-line) is to |
140 // show the full text if it is wider than its bounds. Calling this overrides | 140 // show the full text if it is wider than its bounds. Calling this overrides |
141 // the default behavior and lets you set a custom tooltip. To revert to | 141 // the default behavior and lets you set a custom tooltip. To revert to |
142 // default behavior, call this with an empty string. | 142 // default behavior, call this with an empty string. |
143 void SetTooltipText(const string16& tooltip_text); | 143 void SetTooltipText(const string16& tooltip_text); |
144 | 144 |
145 // Resizes the label so its width is set to the width of the longest line and | 145 // Resizes the label so its width is set to the width of the longest line and |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
281 // The cached heights to avoid recalculation in GetHeightForWidth(). | 281 // The cached heights to avoid recalculation in GetHeightForWidth(). |
282 std::vector<gfx::Size> cached_heights_; | 282 std::vector<gfx::Size> cached_heights_; |
283 int cached_heights_cursor_; | 283 int cached_heights_cursor_; |
284 | 284 |
285 DISALLOW_COPY_AND_ASSIGN(Label); | 285 DISALLOW_COPY_AND_ASSIGN(Label); |
286 }; | 286 }; |
287 | 287 |
288 } // namespace views | 288 } // namespace views |
289 | 289 |
290 #endif // UI_VIEWS_CONTROLS_LABEL_H_ | 290 #endif // UI_VIEWS_CONTROLS_LABEL_H_ |
OLD | NEW |