Skip to content
Snippets Groups Projects
Commit 3746b9d4 authored by nkostylev@chromium.org's avatar nkostylev@chromium.org
Browse files

[cros] Use WideButton for all screens, increase textfield vmargin on login screen.

BUG=chromium-os:8101
TEST=Manual.

Review URL: http://codereview.chromium.org/5338002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67123 0039d316-1c4b-4281-b951-d872f2087c98
parent 0cfac690
No related branches found
No related tags found
No related merge requests found
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
#include "grit/locale_settings.h" #include "grit/locale_settings.h"
#include "grit/theme_resources.h" #include "grit/theme_resources.h"
#include "views/controls/button/checkbox.h" #include "views/controls/button/checkbox.h"
#include "views/controls/button/native_button.h"
#include "views/controls/label.h" #include "views/controls/label.h"
#include "views/controls/throbber.h" #include "views/controls/throbber.h"
#include "views/grid_layout.h" #include "views/grid_layout.h"
...@@ -394,10 +393,10 @@ void EulaView::Init() { ...@@ -394,10 +393,10 @@ void EulaView::Init() {
layout->AddView(system_security_settings_link_); layout->AddView(system_security_settings_link_);
back_button_ = new views::NativeButton(this, std::wstring()); back_button_ = new login::WideButton(this, std::wstring());
layout->AddView(back_button_); layout->AddView(back_button_);
continue_button_ = new views::NativeButton(this, std::wstring()); continue_button_ = new login::WideButton(this, std::wstring());
layout->AddView(continue_button_); layout->AddView(continue_button_);
layout->AddPaddingRow(0, kPadding); layout->AddPaddingRow(0, kPadding);
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "googleurl/src/gurl.h" #include "googleurl/src/gurl.h"
#include "grit/theme_resources.h" #include "grit/theme_resources.h"
#include "third_party/skia/include/effects/SkGradientShader.h" #include "third_party/skia/include/effects/SkGradientShader.h"
#include "views/controls/button/menu_button.h"
#include "views/controls/button/native_button.h" #include "views/controls/button/native_button.h"
#include "views/controls/label.h" #include "views/controls/label.h"
#include "views/controls/textfield/textfield.h" #include "views/controls/textfield/textfield.h"
...@@ -102,6 +103,11 @@ void CorrectLabelFontSize(views::Label* label) { ...@@ -102,6 +103,11 @@ void CorrectLabelFontSize(views::Label* label) {
label->SetFont(label->font().DeriveFont(kFontSizeCorrectionDelta)); label->SetFont(label->font().DeriveFont(kFontSizeCorrectionDelta));
} }
void CorrectMenuButtonFontSize(views::MenuButton* button) {
if (button)
button->SetFont(button->font().DeriveFont(kFontSizeCorrectionDelta));
}
void CorrectNativeButtonFontSize(views::NativeButton* button) { void CorrectNativeButtonFontSize(views::NativeButton* button) {
if (button) if (button)
button->set_font(button->font().DeriveFont(kFontSizeCorrectionDelta)); button->set_font(button->font().DeriveFont(kFontSizeCorrectionDelta));
...@@ -123,6 +129,7 @@ const int kButtonMinWidth = 90; ...@@ -123,6 +129,7 @@ const int kButtonMinWidth = 90;
gfx::Size WideButton::GetPreferredSize() { gfx::Size WideButton::GetPreferredSize() {
gfx::Size preferred_size = NativeButton::GetPreferredSize(); gfx::Size preferred_size = NativeButton::GetPreferredSize();
// Set minimal width.
if (preferred_size.width() < kButtonMinWidth) if (preferred_size.width() < kButtonMinWidth)
preferred_size.set_width(kButtonMinWidth); preferred_size.set_width(kButtonMinWidth);
return preferred_size; return preferred_size;
......
...@@ -20,6 +20,7 @@ class Size; ...@@ -20,6 +20,7 @@ class Size;
namespace views { namespace views {
class Label; class Label;
class MenuButton;
class Painter; class Painter;
class Textfield; class Textfield;
class Throbber; class Throbber;
...@@ -44,6 +45,9 @@ gfx::Rect CalculateScreenBounds(const gfx::Size& size); ...@@ -44,6 +45,9 @@ gfx::Rect CalculateScreenBounds(const gfx::Size& size);
// Corrects font size for Label control. // Corrects font size for Label control.
void CorrectLabelFontSize(views::Label* label); void CorrectLabelFontSize(views::Label* label);
// Corrects font size for MenuButton control.
void CorrectMenuButtonFontSize(views::MenuButton* button);
// Corrects font size for NativeButton control. // Corrects font size for NativeButton control.
void CorrectNativeButtonFontSize(views::NativeButton* button); void CorrectNativeButtonFontSize(views::NativeButton* button);
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include "grit/chromium_strings.h" #include "grit/chromium_strings.h"
#include "grit/generated_resources.h" #include "grit/generated_resources.h"
#include "grit/theme_resources.h" #include "grit/theme_resources.h"
#include "views/controls/button/native_button.h"
#include "views/controls/label.h" #include "views/controls/label.h"
#include "views/controls/throbber.h" #include "views/controls/throbber.h"
#include "views/fill_layout.h" #include "views/fill_layout.h"
...@@ -89,6 +88,7 @@ static void InitMenuButtonProperties(views::MenuButton* menu_button) { ...@@ -89,6 +88,7 @@ static void InitMenuButtonProperties(views::MenuButton* menu_button) {
menu_button->set_animate_on_state_change(false); menu_button->set_animate_on_state_change(false);
// Menu is positioned by bottom right corner of the MenuButton. // Menu is positioned by bottom right corner of the MenuButton.
menu_button->set_menu_offset(kMenuHorizontalOffset, kMenuVerticalOffset); menu_button->set_menu_offset(kMenuHorizontalOffset, kMenuVerticalOffset);
chromeos::CorrectMenuButtonFontSize(menu_button);
} }
} // namespace } // namespace
...@@ -445,7 +445,7 @@ void NetworkSelectionView::RecreateNativeControls() { ...@@ -445,7 +445,7 @@ void NetworkSelectionView::RecreateNativeControls() {
// sized so delete and recreate the button on text update. // sized so delete and recreate the button on text update.
bool is_continue_enabled = IsContinueEnabled(); bool is_continue_enabled = IsContinueEnabled();
delete continue_button_; delete continue_button_;
continue_button_ = new views::NativeButton( continue_button_ = new login::WideButton(
delegate_, delegate_,
l10n_util::GetString(IDS_NETWORK_SELECTION_CONTINUE_BUTTON)); l10n_util::GetString(IDS_NETWORK_SELECTION_CONTINUE_BUTTON));
continue_button_->SetEnabled(is_continue_enabled); continue_button_->SetEnabled(is_continue_enabled);
......
...@@ -9,13 +9,20 @@ namespace { ...@@ -9,13 +9,20 @@ namespace {
// Holds ratio of the margin to the preferred text height. // Holds ratio of the margin to the preferred text height.
const double kTextMarginRate = 0.33; const double kTextMarginRate = 0.33;
// Size of each vertical margin (top, bottom).
const int kVerticalMargin = 3;
} // namespace } // namespace
namespace chromeos { namespace chromeos {
TextfieldWithMargin::TextfieldWithMargin() {
}
void TextfieldWithMargin::Layout() { void TextfieldWithMargin::Layout() {
int margin = GetPreferredSize().height() * kTextMarginRate; int margin = GetPreferredSize().height() * kTextMarginRate;
SetHorizontalMargins(margin, margin); SetHorizontalMargins(margin, margin);
SetVerticalMargins(kVerticalMargin, kVerticalMargin);
views::Textfield::Layout(); views::Textfield::Layout();
} }
......
...@@ -14,7 +14,7 @@ namespace chromeos { ...@@ -14,7 +14,7 @@ namespace chromeos {
// height. // height.
class TextfieldWithMargin : public views::Textfield { class TextfieldWithMargin : public views::Textfield {
public: public:
TextfieldWithMargin() {}; TextfieldWithMargin();
explicit TextfieldWithMargin(views::Textfield::StyleFlags style) explicit TextfieldWithMargin(views::Textfield::StyleFlags style)
: Textfield(style) {} : Textfield(style) {}
......
...@@ -138,6 +138,9 @@ class TextButton : public CustomButton { ...@@ -138,6 +138,9 @@ class TextButton : public CustomButton {
void set_max_width(int max_width) { max_width_ = max_width; } void set_max_width(int max_width) { max_width_ = max_width; }
void SetFont(const gfx::Font& font); void SetFont(const gfx::Font& font);
// Return the font used by this button.
gfx::Font font() const { return font_; }
void SetEnabledColor(SkColor color); void SetEnabledColor(SkColor color);
void SetDisabledColor(SkColor color); void SetDisabledColor(SkColor color);
void SetHighlightColor(SkColor color); void SetHighlightColor(SkColor color);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment