diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-19 22:07:48 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-19 22:07:48 +0000 |
commit | a720c07753462c0b8597bacb052ea9a354713dda (patch) | |
tree | 0387c6424afcfa662393afd64dfb89fa53853357 /chrome/views/controls/button | |
parent | b1594d0f4e1b523e72c84b13ebe9bf7e2377648e (diff) | |
download | chromium_src-a720c07753462c0b8597bacb052ea9a354713dda.zip chromium_src-a720c07753462c0b8597bacb052ea9a354713dda.tar.gz chromium_src-a720c07753462c0b8597bacb052ea9a354713dda.tar.bz2 |
Revert "Now have a TextButton rendering." Broke Windows.
TBR=beng
Review URL: http://codereview.chromium.org/50035
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12163 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/views/controls/button')
-rw-r--r-- | chrome/views/controls/button/custom_button.cc | 17 | ||||
-rw-r--r-- | chrome/views/controls/button/text_button.cc | 13 |
2 files changed, 9 insertions, 21 deletions
diff --git a/chrome/views/controls/button/custom_button.cc b/chrome/views/controls/button/custom_button.cc index a01c0ab..04e0a50 100644 --- a/chrome/views/controls/button/custom_button.cc +++ b/chrome/views/controls/button/custom_button.cc @@ -4,17 +4,12 @@ #include "chrome/views/controls/button/custom_button.h" -#include "base/keyboard_codes.h" -#include "chrome/common/drag_drop_types.h" -#include "chrome/common/gfx/chrome_canvas.h" -#include "chrome/common/throb_animation.h" - -// TODO(erg): Write drag'n'drop for Linux. -#if defined(OS_WIN) #include "base/base_drag_source.h" #include "chrome/browser/drag_utils.h" +#include "chrome/common/drag_drop_types.h" +#include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/os_exchange_data.h" -#endif +#include "chrome/common/throb_animation.h" namespace views { @@ -171,10 +166,10 @@ bool CustomButton::OnKeyPressed(const KeyEvent& e) { // Space sets button state to pushed. Enter clicks the button. This matches // the Windows native behavior of buttons, where Space clicks the button // on KeyRelease and Enter clicks the button on KeyPressed. - if (e.GetCharacter() == base::VKEY_SPACE) { + if (e.GetCharacter() == VK_SPACE) { SetState(BS_PUSHED); return true; - } else if (e.GetCharacter() == base::VKEY_RETURN) { + } else if (e.GetCharacter() == VK_RETURN) { SetState(BS_NORMAL); NotifyClick(0); return true; @@ -185,7 +180,7 @@ bool CustomButton::OnKeyPressed(const KeyEvent& e) { bool CustomButton::OnKeyReleased(const KeyEvent& e) { if (state_ != BS_DISABLED) { - if (e.GetCharacter() == base::VKEY_SPACE) { + if (e.GetCharacter() == VK_SPACE) { SetState(BS_NORMAL); NotifyClick(0); return true; diff --git a/chrome/views/controls/button/text_button.cc b/chrome/views/controls/button/text_button.cc index a273d20..c5f1ae6 100644 --- a/chrome/views/controls/button/text_button.cc +++ b/chrome/views/controls/button/text_button.cc @@ -8,15 +8,12 @@ #include "chrome/common/l10n_util.h" #include "chrome/common/resource_bundle.h" #include "chrome/common/throb_animation.h" +#include "chrome/common/win_util.h" #include "chrome/views/controls/button/button.h" #include "chrome/views/event.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" -#if defined(OS_WIN) -#include "chrome/common/win_util.h" -#endif - namespace views { // Padding between the icon and text. @@ -157,11 +154,11 @@ void TextButtonBorder::GetInsets(gfx::Insets* insets) const { TextButton::TextButton(ButtonListener* listener, const std::wstring& text) : CustomButton(listener), - alignment_(ALIGN_LEFT), font_(ResourceBundle::GetSharedInstance().GetFont( ResourceBundle::BaseFont)), color_(kEnabledColor), - max_width_(0) { + max_width_(0), + alignment_(ALIGN_LEFT) { SetText(text); set_border(new TextButtonBorder); SetAnimationDuration(kHoverAnimationDurationMs); @@ -247,16 +244,12 @@ void TextButton::Paint(ChromeCanvas* canvas, bool for_drag) { text_bounds.set_x(MirroredLeftPointForRect(text_bounds)); if (for_drag) { -#if defined(OS_WIN) - // TODO(erg): Either port DrawStringWithHalo to linux or find an - // alternative here. canvas->DrawStringWithHalo(text_, font_, color_, kHighlightColor, text_bounds.x(), text_bounds.y(), text_bounds.width(), text_bounds.height(), l10n_util::DefaultCanvasTextAlignment()); -#endif } else { // Draw bevel highlight canvas->DrawStringInt(text_, |