diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-19 22:02:24 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-19 22:02:24 +0000 |
commit | b1594d0f4e1b523e72c84b13ebe9bf7e2377648e (patch) | |
tree | 89b4ea435e92e5ee181f26f1a27963d24dc44e90 /chrome/views/controls/button/text_button.cc | |
parent | 5e1d37e5d4c6c573b4e9d0e3290fb3b2748981c3 (diff) | |
download | chromium_src-b1594d0f4e1b523e72c84b13ebe9bf7e2377648e.zip chromium_src-b1594d0f4e1b523e72c84b13ebe9bf7e2377648e.tar.gz chromium_src-b1594d0f4e1b523e72c84b13ebe9bf7e2377648e.tar.bz2 |
Now have a TextButton rendering (sort of; doesn't respond to mouse events so I don't know if it'll draw the border correctly).
Review URL: http://codereview.chromium.org/42414
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12162 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/views/controls/button/text_button.cc')
-rw-r--r-- | chrome/views/controls/button/text_button.cc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/chrome/views/controls/button/text_button.cc b/chrome/views/controls/button/text_button.cc index c5f1ae6..a273d20 100644 --- a/chrome/views/controls/button/text_button.cc +++ b/chrome/views/controls/button/text_button.cc @@ -8,12 +8,15 @@ #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. @@ -154,11 +157,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), - alignment_(ALIGN_LEFT) { + max_width_(0) { SetText(text); set_border(new TextButtonBorder); SetAnimationDuration(kHoverAnimationDurationMs); @@ -244,12 +247,16 @@ 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_, |