Chromium Code Reviews| Index: ui/views/controls/button/vector_icon_button.h |
| diff --git a/ui/views/controls/button/vector_icon_button.h b/ui/views/controls/button/vector_icon_button.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..9e2e3ca0ca38fb66fd1e3fa3ce459c55cbcc38a0 |
| --- /dev/null |
| +++ b/ui/views/controls/button/vector_icon_button.h |
| @@ -0,0 +1,53 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
|
sky
2016/09/07 03:42:18
2016
Evan Stade
2016/09/07 16:17:37
in my mind this is a file move + rename
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef UI_VIEWS_CONTROLS_BUTTON_VECTOR_ICON_BUTTON_H_ |
| +#define UI_VIEWS_CONTROLS_BUTTON_VECTOR_ICON_BUTTON_H_ |
| + |
| +#include <memory> |
| + |
| +#include "base/macros.h" |
| +#include "ui/views/controls/button/image_button.h" |
| + |
| +namespace gfx { |
| +enum class VectorIconId; |
| +} |
| + |
| +namespace views { |
| + |
| +// A ButtonListener that also provides a color to use for drawing an icon. |
| +class VIEWS_EXPORT VectorIconButtonDelegate : public ButtonListener { |
|
sky
2016/09/07 03:42:19
Move to own header as suggested in style guide.
Evan Stade
2016/09/07 16:17:37
Done.
|
| + public: |
| + virtual SkColor GetVectorIconBaseColor() const; |
| + |
| + protected: |
| + ~VectorIconButtonDelegate() override {} |
| +}; |
| + |
| +// A button that has an image and no text, with the image defined by a vector |
| +// icon identifier. |
| +class VIEWS_EXPORT VectorIconButton : public views::ImageButton { |
| + public: |
| + explicit VectorIconButton(VectorIconButtonDelegate* delegate); |
| + ~VectorIconButton() override; |
| + |
| + // Sets the icon to display and provides a callback which should return the |
| + // text color from which to derive this icon's color. |
| + void SetIcon(gfx::VectorIconId id); |
| + |
| + // views::ImageButton: |
| + void OnEnabledChanged() override; |
| + void OnThemeChanged() override; |
| + void OnNativeThemeChanged(const ui::NativeTheme* theme) override; |
| + |
| + private: |
| + VectorIconButtonDelegate* delegate_; |
| + gfx::VectorIconId id_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(VectorIconButton); |
| +}; |
| + |
| +} // namespace views |
| + |
| +#endif // UI_VIEWS_CONTROLS_BUTTON_VECTOR_ICON_BUTTON_H_ |