OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "ui/views/examples/multiline_example.h" | 5 #include "ui/views/examples/multiline_example.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "ui/base/events/event.h" | 8 #include "ui/base/events/event.h" |
9 #include "ui/gfx/render_text.h" | 9 #include "ui/gfx/render_text.h" |
10 #include "ui/views/controls/label.h" | 10 #include "ui/views/controls/label.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 set_border(Border::CreateSolidBorder(2, SK_ColorGRAY)); | 24 set_border(Border::CreateSolidBorder(2, SK_ColorGRAY)); |
25 } | 25 } |
26 | 26 |
27 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { | 27 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { |
28 View::OnPaint(canvas); | 28 View::OnPaint(canvas); |
29 render_text_->Draw(canvas); | 29 render_text_->Draw(canvas); |
30 } | 30 } |
31 | 31 |
32 virtual gfx::Size GetPreferredSize() OVERRIDE { | 32 virtual gfx::Size GetPreferredSize() OVERRIDE { |
33 return gfx::Size(0, | 33 return gfx::Size(0, |
34 render_text_->GetFont().GetHeight() + GetInsets().height()); | 34 render_text_->font_list().GetHeight() + GetInsets().height()); |
35 } | 35 } |
36 | 36 |
37 void SetText(const string16& new_contents) { | 37 void SetText(const string16& new_contents) { |
38 render_text_->SetText(new_contents); | 38 render_text_->SetText(new_contents); |
39 SchedulePaint(); | 39 SchedulePaint(); |
40 } | 40 } |
41 | 41 |
42 private: | 42 private: |
43 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE { | 43 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE { |
44 gfx::Rect bounds = GetLocalBounds(); | 44 gfx::Rect bounds = GetLocalBounds(); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 label_->SetText(new_contents); | 108 label_->SetText(new_contents); |
109 } | 109 } |
110 | 110 |
111 bool MultilineExample::HandleKeyEvent(Textfield* sender, | 111 bool MultilineExample::HandleKeyEvent(Textfield* sender, |
112 const ui::KeyEvent& key_event) { | 112 const ui::KeyEvent& key_event) { |
113 return false; | 113 return false; |
114 } | 114 } |
115 | 115 |
116 } // namespace examples | 116 } // namespace examples |
117 } // namespace views | 117 } // namespace views |
OLD | NEW |