| 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 "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
| 10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 // Get or set if the label text can wrap on multiple lines; default is false. | 79 // Get or set if the label text can wrap on multiple lines; default is false. |
| 80 bool multi_line() const { return multi_line_; } | 80 bool multi_line() const { return multi_line_; } |
| 81 void SetMultiLine(bool multi_line); | 81 void SetMultiLine(bool multi_line); |
| 82 | 82 |
| 83 // Get or set if the label text should be obscured before rendering (e.g. | 83 // Get or set if the label text should be obscured before rendering (e.g. |
| 84 // should "Password!" display as "*********"); default is false. | 84 // should "Password!" display as "*********"); default is false. |
| 85 bool obscured() const { return render_text_->obscured(); } | 85 bool obscured() const { return render_text_->obscured(); } |
| 86 void SetObscured(bool obscured); | 86 void SetObscured(bool obscured); |
| 87 | 87 |
| 88 // Sets whether multi-line text can wrap mid-word; the default is false. | 88 // Sets whether multi-line text can wrap mid-word; the default is false. |
| 89 // TODO(mukai): allow specifying WordWrapBehavior. |
| 89 void SetAllowCharacterBreak(bool allow_character_break); | 90 void SetAllowCharacterBreak(bool allow_character_break); |
| 90 | 91 |
| 91 // Sets the eliding or fading behavior, applied as necessary. The default is | 92 // Sets the eliding or fading behavior, applied as necessary. The default is |
| 92 // to elide at the end. Eliding is not well-supported for multi-line labels. | 93 // to elide at the end. Eliding is not well-supported for multi-line labels. |
| 93 void SetElideBehavior(gfx::ElideBehavior elide_behavior); | 94 void SetElideBehavior(gfx::ElideBehavior elide_behavior); |
| 94 gfx::ElideBehavior elide_behavior() const { return elide_behavior_; } | 95 gfx::ElideBehavior elide_behavior() const { return elide_behavior_; } |
| 95 | 96 |
| 96 // Sets the tooltip text. Default behavior for a label (single-line) is to | 97 // Sets the tooltip text. Default behavior for a label (single-line) is to |
| 97 // show the full text if it is wider than its bounds. Calling this overrides | 98 // show the full text if it is wider than its bounds. Calling this overrides |
| 98 // the default behavior and lets you set a custom tooltip. To revert to | 99 // the default behavior and lets you set a custom tooltip. To revert to |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 gfx::ElideBehavior elide_behavior_; | 203 gfx::ElideBehavior elide_behavior_; |
| 203 | 204 |
| 204 bool subpixel_rendering_enabled_; | 205 bool subpixel_rendering_enabled_; |
| 205 bool auto_color_readability_; | 206 bool auto_color_readability_; |
| 206 // TODO(mukai): remove |multi_line_| when all RenderText can render multiline. | 207 // TODO(mukai): remove |multi_line_| when all RenderText can render multiline. |
| 207 bool multi_line_; | 208 bool multi_line_; |
| 208 base::string16 tooltip_text_; | 209 base::string16 tooltip_text_; |
| 209 bool handles_tooltips_; | 210 bool handles_tooltips_; |
| 210 // Whether to collapse the label when it's not visible. | 211 // Whether to collapse the label when it's not visible. |
| 211 bool collapse_when_hidden_; | 212 bool collapse_when_hidden_; |
| 212 bool allow_character_break_; | |
| 213 int max_width_; | 213 int max_width_; |
| 214 | 214 |
| 215 // TODO(vadimt): Remove is_first_paint_text_ before crbug.com/431326 is | 215 // TODO(vadimt): Remove is_first_paint_text_ before crbug.com/431326 is |
| 216 // closed. | 216 // closed. |
| 217 bool is_first_paint_text_; | 217 bool is_first_paint_text_; |
| 218 | 218 |
| 219 DISALLOW_COPY_AND_ASSIGN(Label); | 219 DISALLOW_COPY_AND_ASSIGN(Label); |
| 220 }; | 220 }; |
| 221 | 221 |
| 222 } // namespace views | 222 } // namespace views |
| 223 | 223 |
| 224 #endif // UI_VIEWS_CONTROLS_LABEL_H_ | 224 #endif // UI_VIEWS_CONTROLS_LABEL_H_ |
| OLD | NEW |