Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(528)

Unified Diff: ui/views/examples/text_example.cc

Issue 9864048: Add a border to views_examples' text styles example. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/examples/text_example.cc
===================================================================
--- ui/views/examples/text_example.cc (revision 129193)
+++ ui/views/examples/text_example.cc (working copy)
@@ -100,23 +100,26 @@
}
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 @@
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);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698