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 #include "ui/views/examples/text_example.h" | 5 #include "ui/views/examples/text_example.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "ui/base/resource/resource_bundle.h" | 8 #include "ui/base/resource/resource_bundle.h" |
9 #include "ui/gfx/canvas.h" | 9 #include "ui/gfx/canvas.h" |
10 #include "ui/gfx/font_list.h" | 10 #include "ui/gfx/font_list.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 bool fade() const { return fade_; } | 119 bool fade() const { return fade_; } |
120 void set_fade(bool fade) { fade_ = fade; } | 120 void set_fade(bool fade) { fade_ = fade; } |
121 | 121 |
122 gfx::Canvas::TruncateFadeMode fade_mode() const { return fade_mode_; } | 122 gfx::Canvas::TruncateFadeMode fade_mode() const { return fade_mode_; } |
123 void set_fade_mode(gfx::Canvas::TruncateFadeMode mode) { fade_mode_ = mode; } | 123 void set_fade_mode(gfx::Canvas::TruncateFadeMode mode) { fade_mode_ = mode; } |
124 | 124 |
125 int GetFontStyle() const { | 125 int GetFontStyle() const { |
126 return font_list_.GetFontStyle(); | 126 return font_list_.GetFontStyle(); |
127 } | 127 } |
128 void SetFontStyle(int style) { | 128 void SetFontStyle(int style) { |
129 font_list_ = font_list_.DeriveFontList(style); | 129 font_list_ = font_list_.DeriveWithStyle(style); |
130 } | 130 } |
131 | 131 |
132 private: | 132 private: |
133 // The font used for drawing the text. | 133 // The font used for drawing the text. |
134 gfx::FontList font_list_; | 134 gfx::FontList font_list_; |
135 | 135 |
136 // The text to draw. | 136 // The text to draw. |
137 base::string16 text_; | 137 base::string16 text_; |
138 | 138 |
139 // Text flags for passing to |DrawStringRect()|. | 139 // Text flags for passing to |DrawStringRect()|. |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 text_flags |= gfx::Canvas::HIDE_PREFIX; | 323 text_flags |= gfx::Canvas::HIDE_PREFIX; |
324 break; | 324 break; |
325 } | 325 } |
326 } | 326 } |
327 text_view_->set_text_flags(text_flags); | 327 text_view_->set_text_flags(text_flags); |
328 text_view_->SchedulePaint(); | 328 text_view_->SchedulePaint(); |
329 } | 329 } |
330 | 330 |
331 } // namespace examples | 331 } // namespace examples |
332 } // namespace views | 332 } // namespace views |
OLD | NEW |