diff options
author | beng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-15 18:02:30 +0000 |
---|---|---|
committer | beng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-15 18:02:30 +0000 |
commit | 154f8bcac65142d7ae6733204c15ae52cfa320c6 (patch) | |
tree | d7375c1119946c2914ee79ef2c0e8aa195b1fbe9 /chrome/views/checkbox.cc | |
parent | 8144d0cea4e142ff7d7a75c84240a4bb8a7fb3a4 (diff) | |
download | chromium_src-154f8bcac65142d7ae6733204c15ae52cfa320c6.zip chromium_src-154f8bcac65142d7ae6733204c15ae52cfa320c6.tar.gz chromium_src-154f8bcac65142d7ae6733204c15ae52cfa320c6.tar.bz2 |
Convert GetPreferredSize from:
void GetPreferredSize(CSize* out);
to:
gfx::Size GetPreferredSize();
.. and update some other places to use gfx::Size as well.
http://crbug.com/2186
Review URL: http://codereview.chromium.org/7344
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3400 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/views/checkbox.cc')
-rw-r--r-- | chrome/views/checkbox.cc | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/chrome/views/checkbox.cc b/chrome/views/checkbox.cc index 0b59e9c..ebfa179 100644 --- a/chrome/views/checkbox.cc +++ b/chrome/views/checkbox.cc @@ -71,14 +71,13 @@ void CheckBox::Layout() { } void CheckBox::ComputeTextRect(gfx::Rect* out) { - CSize s; - label_->GetPreferredSize(&s); + gfx::Size s = label_->GetPreferredSize(); out->set_x(GetTextIndent()); out->set_y(kFocusPaddingVertical); int new_width = std::min(width() - (kCheckBoxWidth + kCheckBoxToLabel), - static_cast<int>(s.cx)); + s.width()); out->set_width(std::max(0, new_width)); - out->set_height(s.cy); + out->set_height(s.height()); } void CheckBox::Paint(ChromeCanvas* canvas) { @@ -119,11 +118,12 @@ void CheckBox::ConfigureNativeButton(HWND hwnd) { label_->SetText(GetLabel()); } -void CheckBox::GetPreferredSize(CSize *out) { - label_->GetPreferredSize(out); - out->cy = std::max(static_cast<int>(out->cy + kFocusPaddingVertical * 2), - kCheckBoxHeight); - out->cx += GetTextIndent() * 2; +gfx::Size CheckBox::GetPreferredSize() { + gfx::Size prefsize = label_->GetPreferredSize(); + prefsize.set_height(std::max(prefsize.height() + kFocusPaddingVertical * 2, + kCheckBoxHeight)); + prefsize.Enlarge(GetTextIndent() * 2, 0); + return prefsize; } LRESULT CheckBox::OnCommand(UINT code, int id, HWND source) { |