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 InkDropRipple; | 22 class InkDropRipple; |
23 class InkDropHover; | 23 class InkDropHighlight; |
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; |
33 | 33 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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<InkDropRipple> CreateInkDropRipple() const override; | 107 std::unique_ptr<InkDropRipple> CreateInkDropRipple() const override; |
108 std::unique_ptr<InkDropHover> CreateInkDropHover() const override; | 108 std::unique_ptr<InkDropHighlight> CreateInkDropHighlight() 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 bool explicitly_set_normal_color() const { | 115 bool explicitly_set_normal_color() const { |
116 return explicitly_set_colors_[STATE_NORMAL]; | 116 return explicitly_set_colors_[STATE_NORMAL]; |
117 } | 117 } |
118 | 118 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 gfx::HorizontalAlignment horizontal_alignment_; | 230 gfx::HorizontalAlignment horizontal_alignment_; |
231 | 231 |
232 std::unique_ptr<Painter> focus_painter_; | 232 std::unique_ptr<Painter> focus_painter_; |
233 | 233 |
234 DISALLOW_COPY_AND_ASSIGN(LabelButton); | 234 DISALLOW_COPY_AND_ASSIGN(LabelButton); |
235 }; | 235 }; |
236 | 236 |
237 } // namespace views | 237 } // namespace views |
238 | 238 |
239 #endif // UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_ | 239 #endif // UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_ |
OLD | NEW |