OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_VECTOR_ICON_BUTTON_H_ | 5 #ifndef UI_VIEWS_CONTROLS_BUTTON_VECTOR_ICON_BUTTON_H_ |
6 #define UI_VIEWS_CONTROLS_BUTTON_VECTOR_ICON_BUTTON_H_ | 6 #define UI_VIEWS_CONTROLS_BUTTON_VECTOR_ICON_BUTTON_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "ui/views/controls/button/image_button.h" | 9 #include "ui/views/controls/button/image_button.h" |
10 | 10 |
11 namespace gfx { | 11 namespace gfx { |
| 12 struct VectorIcon; |
12 enum class VectorIconId; | 13 enum class VectorIconId; |
13 } | 14 } |
14 | 15 |
15 namespace views { | 16 namespace views { |
16 | 17 |
17 class VectorIconButtonDelegate; | 18 class VectorIconButtonDelegate; |
18 | 19 |
19 // A button that has an image and no text, with the image defined by a vector | 20 // A button that has an image and no text, with the image defined by a vector |
20 // icon identifier. | 21 // icon identifier. |
21 class VIEWS_EXPORT VectorIconButton : public views::ImageButton { | 22 class VIEWS_EXPORT VectorIconButton : public views::ImageButton { |
22 public: | 23 public: |
23 explicit VectorIconButton(VectorIconButtonDelegate* delegate); | 24 explicit VectorIconButton(VectorIconButtonDelegate* delegate); |
24 ~VectorIconButton() override; | 25 ~VectorIconButton() override; |
25 | 26 |
26 // Sets the icon to display and provides a callback which should return the | 27 // Sets the icon to display and provides a callback which should return the |
27 // text color from which to derive this icon's color. | 28 // text color from which to derive this icon's color. The one that takes an ID |
| 29 // is deprecated and should be removed when all vector icons are identified by |
| 30 // VectorIcon structs. |
28 void SetIcon(gfx::VectorIconId id); | 31 void SetIcon(gfx::VectorIconId id); |
| 32 void SetIcon(const gfx::VectorIcon& icon); |
29 | 33 |
30 // views::ImageButton: | 34 // views::ImageButton: |
31 void OnThemeChanged() override; | 35 void OnThemeChanged() override; |
32 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; | 36 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; |
33 | 37 |
34 private: | 38 private: |
35 VectorIconButtonDelegate* delegate_; | 39 VectorIconButtonDelegate* delegate_; |
| 40 // TODO(estade): remove |id_| in favor of |icon_| once all callers have been |
| 41 // updated. |
36 gfx::VectorIconId id_; | 42 gfx::VectorIconId id_; |
| 43 const gfx::VectorIcon* icon_ = nullptr; |
37 | 44 |
38 DISALLOW_COPY_AND_ASSIGN(VectorIconButton); | 45 DISALLOW_COPY_AND_ASSIGN(VectorIconButton); |
39 }; | 46 }; |
40 | 47 |
41 } // namespace views | 48 } // namespace views |
42 | 49 |
43 #endif // UI_VIEWS_CONTROLS_BUTTON_VECTOR_ICON_BUTTON_H_ | 50 #endif // UI_VIEWS_CONTROLS_BUTTON_VECTOR_ICON_BUTTON_H_ |
OLD | NEW |