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

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

Issue 2032683003: Add ripples to md checkboxes/radio buttons (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
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_CHECKBOX_H_ 5 #ifndef UI_VIEWS_CONTROLS_BUTTON_CHECKBOX_H_
6 #define UI_VIEWS_CONTROLS_BUTTON_CHECKBOX_H_ 6 #define UI_VIEWS_CONTROLS_BUTTON_CHECKBOX_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/strings/string16.h" 12 #include "base/strings/string16.h"
13 #include "ui/views/controls/button/label_button.h" 13 #include "ui/views/controls/button/label_button.h"
14 14
15 class SkPaint; 15 class SkPaint;
16 16
17 namespace views { 17 namespace views {
18 18
19 class InkDropHover;
20 class InkDropRipple;
21
19 // A native themed class representing a checkbox. This class does not use 22 // A native themed class representing a checkbox. This class does not use
20 // platform specific objects to replicate the native platforms looks and feel. 23 // platform specific objects to replicate the native platforms looks and feel.
21 class VIEWS_EXPORT Checkbox : public LabelButton { 24 class VIEWS_EXPORT Checkbox : public LabelButton {
22 public: 25 public:
23 static const char kViewClassName[]; 26 static const char kViewClassName[];
24 27
25 explicit Checkbox(const base::string16& label); 28 explicit Checkbox(const base::string16& label);
26 ~Checkbox() override; 29 ~Checkbox() override;
27 30
28 // Sets a listener for this checkbox. Checkboxes aren't required to have them 31 // Sets a listener for this checkbox. Checkboxes aren't required to have them
29 // since their state can be read independently of them being toggled. 32 // since their state can be read independently of them being toggled.
30 void set_listener(ButtonListener* listener) { listener_ = listener; } 33 void set_listener(ButtonListener* listener) { listener_ = listener; }
31 34
32 // Sets/Gets whether or not the checkbox is checked. 35 // Sets/Gets whether or not the checkbox is checked.
33 virtual void SetChecked(bool checked); 36 virtual void SetChecked(bool checked);
34 bool checked() const { return checked_; } 37 bool checked() const { return checked_; }
35 38
36 protected: 39 protected:
37 // Returns whether MD is enabled; exists for the sake of brevity. 40 // Returns whether MD is enabled; exists for the sake of brevity.
38 static bool UseMd(); 41 static bool UseMd();
39 42
40 // Overridden from LabelButton: 43 // Overridden from LabelButton:
41 void Layout() override; 44 void Layout() override;
42 const char* GetClassName() const override; 45 const char* GetClassName() const override;
43 void GetAccessibleState(ui::AXViewState* state) override; 46 void GetAccessibleState(ui::AXViewState* state) override;
44 void OnPaint(gfx::Canvas* canvas) override; 47 void OnPaint(gfx::Canvas* canvas) override;
45 void OnFocus() override; 48 void OnFocus() override;
46 void OnBlur() override; 49 void OnBlur() override;
47 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; 50 void OnNativeThemeChanged(const ui::NativeTheme* theme) override;
51 std::unique_ptr<InkDropRipple> CreateInkDropRipple() const override;
52 std::unique_ptr<InkDropHover> CreateInkDropHover() const override;
53 gfx::Point GetInkDropCenter() const override;
54 SkColor GetInkDropBaseColor() const override;
48 gfx::ImageSkia GetImage(ButtonState for_state) const override; 55 gfx::ImageSkia GetImage(ButtonState for_state) const override;
49 56
50 // Set the image shown for each button state depending on whether it is 57 // Set the image shown for each button state depending on whether it is
51 // [checked] or [focused]. 58 // [checked] or [focused].
52 void SetCustomImage(bool checked, 59 void SetCustomImage(bool checked,
53 bool focused, 60 bool focused,
54 ButtonState for_state, 61 ButtonState for_state,
55 const gfx::ImageSkia& image); 62 const gfx::ImageSkia& image);
56 63
57 // Paints a focus indicator for the view. 64 // Paints a focus indicator for the view.
(...skipping 11 matching lines...) Expand all
69 76
70 // The images for each button state. 77 // The images for each button state.
71 gfx::ImageSkia images_[2][2][STATE_COUNT]; 78 gfx::ImageSkia images_[2][2][STATE_COUNT];
72 79
73 DISALLOW_COPY_AND_ASSIGN(Checkbox); 80 DISALLOW_COPY_AND_ASSIGN(Checkbox);
74 }; 81 };
75 82
76 } // namespace views 83 } // namespace views
77 84
78 #endif // UI_VIEWS_CONTROLS_BUTTON_CHECKBOX_H_ 85 #endif // UI_VIEWS_CONTROLS_BUTTON_CHECKBOX_H_
OLDNEW
« no previous file with comments | « no previous file | ui/views/controls/button/checkbox.cc » ('j') | ui/views/controls/button/checkbox.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698