diff options
Diffstat (limited to 'views/controls/button')
-rw-r--r-- | views/controls/button/checkbox.cc | 2 | ||||
-rw-r--r-- | views/controls/button/native_button.cc | 25 | ||||
-rw-r--r-- | views/controls/button/native_button_gtk.cc | 9 | ||||
-rw-r--r-- | views/controls/button/native_button_win.cc | 2 | ||||
-rw-r--r-- | views/controls/button/text_button.cc | 2 |
5 files changed, 23 insertions, 17 deletions
diff --git a/views/controls/button/checkbox.cc b/views/controls/button/checkbox.cc index 0899e58..404a0ea 100644 --- a/views/controls/button/checkbox.cc +++ b/views/controls/button/checkbox.cc @@ -103,7 +103,7 @@ void Checkbox::Layout() { label_x, 0, std::max(0, width() - label_x - kLabelFocusPaddingHorizontal), height()); - int first_line_height = label_->font().height(); + int first_line_height = label_->font().GetHeight(); native_wrapper_->GetView()->SetBounds( 0, ((first_line_height - checkmark_prefsize.height()) / 2), checkmark_prefsize.width(), checkmark_prefsize.height()); diff --git a/views/controls/button/native_button.cc b/views/controls/button/native_button.cc index 542030a..756cc20 100644 --- a/views/controls/button/native_button.cc +++ b/views/controls/button/native_button.cc @@ -4,16 +4,19 @@ #include "views/controls/button/native_button.h" -#if defined(OS_LINUX) -#include <gdk/gdkkeysyms.h> -#include "views/screen.h" -#endif - #include "base/i18n/rtl.h" #include "base/keyboard_codes.h" #include "base/logging.h" #include "views/controls/native/native_view_host.h" +#if defined(OS_WIN) +#include "gfx/platform_font_win.h" +#elif defined(OS_LINUX) +#include <gdk/gdkkeysyms.h> +#include "views/screen.h" +#endif + + namespace views { #if defined(OS_WIN) @@ -144,10 +147,14 @@ gfx::Size NativeButton::GetPreferredSize() { #if defined(OS_WIN) // Clamp the size returned to at least the minimum size. if (!ignore_minimum_size_) { - sz.set_width(std::max(sz.width(), - font_.horizontal_dlus_to_pixels(kMinWidthDLUs))); - sz.set_height(std::max(sz.height(), - font_.vertical_dlus_to_pixels(kMinHeightDLUs))); + gfx::PlatformFontWin* platform_font = + static_cast<gfx::PlatformFontWin*>(font_.platform_font()); + sz.set_width(std::max( + sz.width(), + platform_font->horizontal_dlus_to_pixels(kMinWidthDLUs))); + sz.set_height(std::max( + sz.height(), + platform_font->vertical_dlus_to_pixels(kMinHeightDLUs))); } // GTK returns a meaningful preferred size so that we don't need to adjust // the preferred size as we do on windows. diff --git a/views/controls/button/native_button_gtk.cc b/views/controls/button/native_button_gtk.cc index d25f444..6720a50 100644 --- a/views/controls/button/native_button_gtk.cc +++ b/views/controls/button/native_button_gtk.cc @@ -1,6 +1,6 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. Use of this -// source code is governed by a BSD-style license that can be found in the -// LICENSE file. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #include "views/controls/button/native_button_gtk.h" @@ -42,8 +42,7 @@ void NativeButtonGtk::UpdateFont() { if (!native_view()) return; - PangoFontDescription* pfd = - gfx::Font::PangoFontFromGfxFont(native_button_->font()); + PangoFontDescription* pfd = native_button_->font().GetNativeFont(); gtk_widget_modify_font(native_view(), pfd); pango_font_description_free(pfd); preferred_size_ = gfx::Size(); diff --git a/views/controls/button/native_button_win.cc b/views/controls/button/native_button_win.cc index 9e24fc3..eae509c 100644 --- a/views/controls/button/native_button_win.cc +++ b/views/controls/button/native_button_win.cc @@ -49,7 +49,7 @@ void NativeButtonWin::UpdateLabel() { void NativeButtonWin::UpdateFont() { SendMessage(native_view(), WM_SETFONT, - reinterpret_cast<WPARAM>(native_button_->font().hfont()), + reinterpret_cast<WPARAM>(native_button_->font().GetNativeFont()), FALSE); button_size_valid_ = false; } diff --git a/views/controls/button/text_button.cc b/views/controls/button/text_button.cc index 2125a02..bcff70d 100644 --- a/views/controls/button/text_button.cc +++ b/views/controls/button/text_button.cc @@ -390,7 +390,7 @@ void TextButton::UpdateTextSize() { gfx::CanvasSkia::SizeStringInt( text_, font_, &width, &height, gfx::Canvas::NO_ELLIPSIS | PrefixTypeToCanvasType(prefix_type_)); - text_size_.SetSize(width, font_.height()); + text_size_.SetSize(width, font_.GetHeight()); max_text_size_.SetSize(std::max(max_text_size_.width(), text_size_.width()), std::max(max_text_size_.height(), text_size_.height())); |