| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_ | 5 #ifndef UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_ |
| 6 #define UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_ | 6 #define UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "third_party/skia/include/core/SkColor.h" | 13 #include "third_party/skia/include/core/SkColor.h" |
| 14 #include "ui/gfx/image/image_skia.h" | 14 #include "ui/gfx/image/image_skia.h" |
| 15 #include "ui/views/controls/button/custom_button.h" | 15 #include "ui/views/controls/button/custom_button.h" |
| 16 #include "ui/views/controls/image_view.h" | 16 #include "ui/views/controls/image_view.h" |
| 17 #include "ui/views/controls/label.h" | 17 #include "ui/views/controls/label.h" |
| 18 #include "ui/views/native_theme_delegate.h" | 18 #include "ui/views/native_theme_delegate.h" |
| 19 | 19 |
| 20 namespace views { | 20 namespace views { |
| 21 | 21 |
| 22 class InkDropAnimation; | 22 class InkDropRipple; |
| 23 class InkDropHover; | 23 class InkDropHover; |
| 24 class LabelButtonBorder; | 24 class LabelButtonBorder; |
| 25 class Painter; | 25 class Painter; |
| 26 | 26 |
| 27 // LabelButton is a button with text and an icon, it's not focusable by default. | 27 // LabelButton is a button with text and an icon, it's not focusable by default. |
| 28 class VIEWS_EXPORT LabelButton : public CustomButton, | 28 class VIEWS_EXPORT LabelButton : public CustomButton, |
| 29 public NativeThemeDelegate { | 29 public NativeThemeDelegate { |
| 30 public: | 30 public: |
| 31 // The length of the hover fade animation. | 31 // The length of the hover fade animation. |
| 32 static const int kHoverAnimationDurationMs; | 32 static const int kHoverAnimationDurationMs; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 97 |
| 98 // View: | 98 // View: |
| 99 void SetBorder(std::unique_ptr<Border> border) override; | 99 void SetBorder(std::unique_ptr<Border> border) override; |
| 100 gfx::Size GetPreferredSize() const override; | 100 gfx::Size GetPreferredSize() const override; |
| 101 int GetHeightForWidth(int w) const override; | 101 int GetHeightForWidth(int w) const override; |
| 102 void Layout() override; | 102 void Layout() override; |
| 103 const char* GetClassName() const override; | 103 const char* GetClassName() const override; |
| 104 void EnableCanvasFlippingForRTLUI(bool flip) override; | 104 void EnableCanvasFlippingForRTLUI(bool flip) override; |
| 105 void AddInkDropLayer(ui::Layer* ink_drop_layer) override; | 105 void AddInkDropLayer(ui::Layer* ink_drop_layer) override; |
| 106 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override; | 106 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override; |
| 107 std::unique_ptr<InkDropAnimation> CreateInkDropAnimation() const override; | 107 std::unique_ptr<InkDropRipple> CreateInkDropRipple() const override; |
| 108 std::unique_ptr<InkDropHover> CreateInkDropHover() const override; | 108 std::unique_ptr<InkDropHover> CreateInkDropHover() const override; |
| 109 gfx::Point GetInkDropCenter() const override; | 109 gfx::Point GetInkDropCenter() const override; |
| 110 | 110 |
| 111 protected: | 111 protected: |
| 112 ImageView* image() const { return image_; } | 112 ImageView* image() const { return image_; } |
| 113 Label* label() const { return label_; } | 113 Label* label() const { return label_; } |
| 114 | 114 |
| 115 // Returns the available area for the label and image. Subclasses can change | 115 // Returns the available area for the label and image. Subclasses can change |
| 116 // these bounds if they need room to do manual painting. | 116 // these bounds if they need room to do manual painting. |
| 117 virtual gfx::Rect GetChildAreaBounds(); | 117 virtual gfx::Rect GetChildAreaBounds(); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 gfx::HorizontalAlignment horizontal_alignment_; | 222 gfx::HorizontalAlignment horizontal_alignment_; |
| 223 | 223 |
| 224 std::unique_ptr<Painter> focus_painter_; | 224 std::unique_ptr<Painter> focus_painter_; |
| 225 | 225 |
| 226 DISALLOW_COPY_AND_ASSIGN(LabelButton); | 226 DISALLOW_COPY_AND_ASSIGN(LabelButton); |
| 227 }; | 227 }; |
| 228 | 228 |
| 229 } // namespace views | 229 } // namespace views |
| 230 | 230 |
| 231 #endif // UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_ | 231 #endif // UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_ |
| OLD | NEW |