diff options
author | asvitkine@chromium.org <asvitkine@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-28 18:38:00 +0000 |
---|---|---|
committer | asvitkine@chromium.org <asvitkine@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-28 18:38:00 +0000 |
commit | f244f2483cef98e83c2267a0be98725609d52e2c (patch) | |
tree | 9a0bcb8b4dc4df2504bc3dc7042eeefaadca0db1 /ui | |
parent | e12d0a95af31e1029176afb1ddad5bc70820c208 (diff) | |
download | chromium_src-f244f2483cef98e83c2267a0be98725609d52e2c.zip chromium_src-f244f2483cef98e83c2267a0be98725609d52e2c.tar.gz chromium_src-f244f2483cef98e83c2267a0be98725609d52e2c.tar.bz2 |
Add a border to views_examples' text styles example.
This makes it easy to see what size is being used
to center/align the text, for example.
BUG=none
TEST=Open views_examples text styles example.
Review URL: https://chromiumcodereview.appspot.com/9864048
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@129451 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/views/examples/text_example.cc | 16 |
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); |