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_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 "cc/paint/paint_flags.h" |
13 #include "ui/views/controls/button/label_button.h" | 14 #include "ui/views/controls/button/label_button.h" |
14 | 15 |
15 class SkPaint; | |
16 | |
17 namespace gfx { | 16 namespace gfx { |
18 struct VectorIcon; | 17 struct VectorIcon; |
19 } | 18 } |
20 | 19 |
21 namespace views { | 20 namespace views { |
22 | 21 |
23 // 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 |
24 // platform specific objects to replicate the native platforms looks and feel. | 23 // platform specific objects to replicate the native platforms looks and feel. |
25 class VIEWS_EXPORT Checkbox : public LabelButton { | 24 class VIEWS_EXPORT Checkbox : public LabelButton { |
26 public: | 25 public: |
(...skipping 27 matching lines...) Expand all Loading... |
54 gfx::ImageSkia GetImage(ButtonState for_state) const override; | 53 gfx::ImageSkia GetImage(ButtonState for_state) const override; |
55 | 54 |
56 // Set the image shown for each button state depending on whether it is | 55 // Set the image shown for each button state depending on whether it is |
57 // [checked] or [focused]. | 56 // [checked] or [focused]. |
58 void SetCustomImage(bool checked, | 57 void SetCustomImage(bool checked, |
59 bool focused, | 58 bool focused, |
60 ButtonState for_state, | 59 ButtonState for_state, |
61 const gfx::ImageSkia& image); | 60 const gfx::ImageSkia& image); |
62 | 61 |
63 // Paints a focus indicator for the view. | 62 // Paints a focus indicator for the view. |
64 virtual void PaintFocusRing(gfx::Canvas* canvas, const SkPaint& paint); | 63 virtual void PaintFocusRing(gfx::Canvas* canvas, const cc::PaintFlags& paint); |
65 | 64 |
66 // Gets the vector icon to use based on the current state of |checked_|. | 65 // Gets the vector icon to use based on the current state of |checked_|. |
67 virtual const gfx::VectorIcon& GetVectorIcon() const; | 66 virtual const gfx::VectorIcon& GetVectorIcon() const; |
68 | 67 |
69 private: | 68 private: |
70 // Overridden from Button: | 69 // Overridden from Button: |
71 void NotifyClick(const ui::Event& event) override; | 70 void NotifyClick(const ui::Event& event) override; |
72 | 71 |
73 ui::NativeTheme::Part GetThemePart() const override; | 72 ui::NativeTheme::Part GetThemePart() const override; |
74 void GetExtraParams(ui::NativeTheme::ExtraParams* params) const override; | 73 void GetExtraParams(ui::NativeTheme::ExtraParams* params) const override; |
75 | 74 |
76 // True if the checkbox is checked. | 75 // True if the checkbox is checked. |
77 bool checked_; | 76 bool checked_; |
78 | 77 |
79 // The images for each button node_data. | 78 // The images for each button node_data. |
80 gfx::ImageSkia images_[2][2][STATE_COUNT]; | 79 gfx::ImageSkia images_[2][2][STATE_COUNT]; |
81 | 80 |
82 DISALLOW_COPY_AND_ASSIGN(Checkbox); | 81 DISALLOW_COPY_AND_ASSIGN(Checkbox); |
83 }; | 82 }; |
84 | 83 |
85 } // namespace views | 84 } // namespace views |
86 | 85 |
87 #endif // UI_VIEWS_CONTROLS_BUTTON_CHECKBOX_H_ | 86 #endif // UI_VIEWS_CONTROLS_BUTTON_CHECKBOX_H_ |
OLD | NEW |