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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 InvalidateLayout(); | 106 InvalidateLayout(); |
107 } | 107 } |
108 | 108 |
109 private: | 109 private: |
110 void OnBoundsChanged(const gfx::Rect& previous_bounds) override { | 110 void OnBoundsChanged(const gfx::Rect& previous_bounds) override { |
111 gfx::Rect bounds = GetLocalBounds(); | 111 gfx::Rect bounds = GetLocalBounds(); |
112 bounds.Inset(GetInsets()); | 112 bounds.Inset(GetInsets()); |
113 render_text_->SetDisplayRect(bounds); | 113 render_text_->SetDisplayRect(bounds); |
114 } | 114 } |
115 | 115 |
116 scoped_ptr<gfx::RenderText> render_text_; | 116 std::unique_ptr<gfx::RenderText> render_text_; |
117 | 117 |
118 DISALLOW_COPY_AND_ASSIGN(RenderTextView); | 118 DISALLOW_COPY_AND_ASSIGN(RenderTextView); |
119 }; | 119 }; |
120 | 120 |
121 MultilineExample::MultilineExample() | 121 MultilineExample::MultilineExample() |
122 : ExampleBase("Multiline RenderText"), | 122 : ExampleBase("Multiline RenderText"), |
123 render_text_view_(NULL), | 123 render_text_view_(NULL), |
124 label_(NULL), | 124 label_(NULL), |
125 textfield_(NULL), | 125 textfield_(NULL), |
126 label_checkbox_(NULL) { | 126 label_checkbox_(NULL) { |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 void MultilineExample::ButtonPressed(Button* sender, const ui::Event& event) { | 185 void MultilineExample::ButtonPressed(Button* sender, const ui::Event& event) { |
186 DCHECK_EQ(sender, label_checkbox_); | 186 DCHECK_EQ(sender, label_checkbox_); |
187 label_->SetText(label_checkbox_->checked() ? textfield_->text() : | 187 label_->SetText(label_checkbox_->checked() ? textfield_->text() : |
188 base::string16()); | 188 base::string16()); |
189 container()->Layout(); | 189 container()->Layout(); |
190 container()->SchedulePaint(); | 190 container()->SchedulePaint(); |
191 } | 191 } |
192 | 192 |
193 } // namespace examples | 193 } // namespace examples |
194 } // namespace views | 194 } // namespace views |
OLD | NEW |