Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: ui/views/controls/button/vector_icon_button.h

Issue 2744463002: Add VectorIconButton functionality to ImageButton. (Closed)
Patch Set: check details Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef UI_VIEWS_CONTROLS_BUTTON_VECTOR_ICON_BUTTON_H_
6 #define UI_VIEWS_CONTROLS_BUTTON_VECTOR_ICON_BUTTON_H_
7
8 #include "base/macros.h"
9 #include "ui/views/controls/button/image_button.h"
10
11 namespace gfx {
12 struct VectorIcon;
13 enum class VectorIconId;
14 }
15
16 namespace views {
17
18 class VectorIconButtonDelegate;
19
20 // A button that has an image and no text, with the image defined by a vector
21 // icon identifier.
22 class VIEWS_EXPORT VectorIconButton : public views::ImageButton {
23 public:
24 explicit VectorIconButton(VectorIconButtonDelegate* delegate);
25 ~VectorIconButton() override;
26
27 // Sets the icon to display and provides a callback which should return the
28 // text color from which to derive this icon's color.
29 void SetIcon(const gfx::VectorIcon& icon);
30
31 // views::ImageButton:
32 void OnThemeChanged() override;
33 void OnNativeThemeChanged(const ui::NativeTheme* theme) override;
34
35 private:
36 // Performs the work common to both SetIcon() variants.
37 void OnSetIcon();
38
39 // Called when something may have affected the button's images or colors.
40 void UpdateImagesAndColors();
41
42 VectorIconButtonDelegate* delegate_;
43 const gfx::VectorIcon* icon_;
44
45 DISALLOW_COPY_AND_ASSIGN(VectorIconButton);
46 };
47
48 } // namespace views
49
50 #endif // UI_VIEWS_CONTROLS_BUTTON_VECTOR_ICON_BUTTON_H_
OLDNEW
« no previous file with comments | « ui/views/controls/button/image_button_factory_unittest.cc ('k') | ui/views/controls/button/vector_icon_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698