summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/views/examples/text_example.cc16
1 files changed, 10 insertions, 6 deletions
diff --git a/ui/views/examples/text_example.cc b/ui/views/examples/text_example.cc
index 3ffb589..96d13a5 100644
--- a/ui/views/examples/text_example.cc
+++ b/ui/views/examples/text_example.cc
@@ -100,23 +100,26 @@ class TextExample::TextExampleView : public View {
}
virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE {
+ View::OnPaint(canvas);
+
+ const gfx::Rect bounds = GetContentsBounds();
+
#if defined(OS_WIN)
if (fade_) {
size_t characters_to_truncate_from_head =
gfx::Canvas::TruncateFadeHeadAndTail ? 10 : 0;
canvas->DrawFadeTruncatingString(text_, fade_mode_,
- characters_to_truncate_from_head, font_, SK_ColorDKGRAY,
- GetLocalBounds());
+ characters_to_truncate_from_head, font_, SK_ColorDKGRAY, bounds);
return;
}
#endif
if (halo_) {
- canvas->DrawStringWithHalo(text_, font_, SK_ColorDKGRAY, SK_ColorWHITE, 0,
- 0, width(), height(), text_flags_);
+ canvas->DrawStringWithHalo(text_, font_, SK_ColorDKGRAY, SK_ColorWHITE,
+ bounds.x(), bounds.y(), bounds.width(), bounds.height(), text_flags_);
} else {
- canvas->DrawStringInt(text_, font_, SK_ColorDKGRAY, 0, 0, width(),
- height(), text_flags_);
+ canvas->DrawStringInt(text_, font_, SK_ColorDKGRAY, bounds.x(),
+ bounds.y(), bounds.width(), bounds.height(), text_flags_);
}
}
@@ -198,6 +201,7 @@ Combobox* TextExample::AddCombobox(GridLayout* layout,
void TextExample::CreateExampleView(View* container) {
text_view_ = new TextExampleView;
+ text_view_->set_border(views::Border::CreateSolidBorder(1, SK_ColorGRAY));
GridLayout* layout = new GridLayout(container);
container->SetLayoutManager(layout);