summaryrefslogtreecommitdiff
path: root/chromium/ui/views/controls/button/label_button.h
diff options
context:
space:
mode:
authorAndras Becsi <andras.becsi@digia.com>2014-03-18 13:16:26 +0100
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2014-03-20 15:55:39 +0100
commit3f0f86b0caed75241fa71c95a5d73bc0164348c5 (patch)
tree92b9fb00f2e9e90b0be2262093876d4f43b6cd13 /chromium/ui/views/controls/button/label_button.h
parente90d7c4b152c56919d963987e2503f9909a666d2 (diff)
downloadqtwebengine-chromium-3f0f86b0caed75241fa71c95a5d73bc0164348c5.tar.gz
Update to new stable branch 1750
This also includes an updated ninja and chromium dependencies needed on Windows. Change-Id: Icd597d80ed3fa4425933c9f1334c3c2e31291c42 Reviewed-by: Zoltan Arvai <zarvai@inf.u-szeged.hu> Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
Diffstat (limited to 'chromium/ui/views/controls/button/label_button.h')
-rw-r--r--chromium/ui/views/controls/button/label_button.h33
1 files changed, 27 insertions, 6 deletions
diff --git a/chromium/ui/views/controls/button/label_button.h b/chromium/ui/views/controls/button/label_button.h
index f48e9a8e2eb..ad7e226ad5e 100644
--- a/chromium/ui/views/controls/button/label_button.h
+++ b/chromium/ui/views/controls/button/label_button.h
@@ -6,6 +6,7 @@
#define UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_
#include "base/compiler_specific.h"
+#include "base/memory/scoped_ptr.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/font.h"
#include "ui/gfx/image/image_skia.h"
@@ -16,10 +17,15 @@
namespace views {
+class Painter;
+
// LabelButton is an alternative to TextButton, it's not focusable by default.
class VIEWS_EXPORT LabelButton : public CustomButton,
public NativeThemeDelegate {
public:
+ // The length of the hover fade animation.
+ static const int kHoverAnimationDurationMs;
+
static const char kViewClassName[];
LabelButton(ButtonListener* listener, const string16& text);
@@ -45,6 +51,9 @@ class VIEWS_EXPORT LabelButton : public CustomButton,
const gfx::Font& GetFont() const;
void SetFont(const gfx::Font& font);
+ // Set the elide behavior of this button.
+ void SetElideBehavior(Label::ElideBehavior elide_behavior);
+
// Get or set the horizontal alignment used for the button; reversed in RTL.
// The optional image will lead the text, unless the button is right-aligned.
gfx::HorizontalAlignment GetHorizontalAlignment() const;
@@ -62,13 +71,21 @@ class VIEWS_EXPORT LabelButton : public CustomButton,
ButtonStyle style() const { return style_; }
void SetStyle(ButtonStyle style);
- // Overridden from View:
+ void SetFocusPainter(scoped_ptr<Painter> focus_painter);
+
+ // View:
virtual gfx::Size GetPreferredSize() OVERRIDE;
virtual void Layout() OVERRIDE;
virtual const char* GetClassName() const OVERRIDE;
protected:
- Label* label() const { return label_; }
+ ImageView* image() const { return image_; }
+ Label* label() const { return label_; }
+
+ // View:
+ virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
+ virtual void OnFocus() OVERRIDE;
+ virtual void OnBlur() OVERRIDE;
// Fill |params| with information about the button.
virtual void GetExtraParams(ui::NativeTheme::ExtraParams* params) const;
@@ -79,6 +96,9 @@ class VIEWS_EXPORT LabelButton : public CustomButton,
// Updates the image view to contain the appropriate button state image.
void UpdateImage();
+ // NativeThemeDelegate:
+ virtual gfx::Rect GetThemePaintRect() const OVERRIDE;
+
private:
FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Init);
FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Label);
@@ -86,16 +106,15 @@ class VIEWS_EXPORT LabelButton : public CustomButton,
FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, LabelAndImage);
FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Font);
- // Overridden from CustomButton:
+ // CustomButton:
virtual void StateChanged() OVERRIDE;
- // Overridden from View:
+ // View:
virtual void ChildPreferredSizeChanged(View* child) OVERRIDE;
virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE;
- // Overridden from NativeThemeDelegate:
+ // NativeThemeDelegate:
virtual ui::NativeTheme::Part GetThemePart() const OVERRIDE;
- virtual gfx::Rect GetThemePaintRect() const OVERRIDE;
virtual ui::NativeTheme::State GetThemeState(
ui::NativeTheme::ExtraParams* params) const OVERRIDE;
virtual const gfx::Animation* GetThemeAnimation() const OVERRIDE;
@@ -128,6 +147,8 @@ class VIEWS_EXPORT LabelButton : public CustomButton,
// The button's overall style.
ButtonStyle style_;
+ scoped_ptr<Painter> focus_painter_;
+
DISALLOW_COPY_AND_ASSIGN(LabelButton);
};