OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ui/views/examples/multiline_elision_example.h" |
| 6 |
| 7 #include "ui/gfx/render_text.h" |
| 8 |
| 9 namespace views { |
| 10 namespace examples { |
| 11 |
| 12 class MultilineElisionExample::ElidedRenderTextView |
| 13 : public RenderTextView { |
| 14 public: |
| 15 ElidedRenderTextView() { |
| 16 render_text()->SetElideBehavior(gfx::ELIDE_TAIL); |
| 17 render_text()->SetMaxLines(2); |
| 18 } |
| 19 |
| 20 gfx::Size GetPreferredSize() const override { return gfx::Size(500, 40); } |
| 21 |
| 22 private: |
| 23 DISALLOW_COPY_AND_ASSIGN(ElidedRenderTextView); |
| 24 }; |
| 25 |
| 26 MultilineElisionExample::MultilineElisionExample() |
| 27 : MultilineExample("Multiline Elision Example") {} |
| 28 |
| 29 MultilineElisionExample::~MultilineElisionExample() {} |
| 30 |
| 31 MultilineExample::RenderTextView* MultilineElisionExample::CreateTextView() { |
| 32 return new ElidedRenderTextView(); |
| 33 } |
| 34 |
| 35 } // namespace examples |
| 36 } // namespace views |
OLD | NEW |