| 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 "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 gfx { |
| 18 enum class VectorIconId; |
| 19 } |
| 20 |
| 17 namespace views { | 21 namespace views { |
| 18 | 22 |
| 19 class InkDropHover; | 23 class InkDropHover; |
| 20 class InkDropRipple; | 24 class InkDropRipple; |
| 21 | 25 |
| 22 // A native themed class representing a checkbox. This class does not use | 26 // A native themed class representing a checkbox. This class does not use |
| 23 // platform specific objects to replicate the native platforms looks and feel. | 27 // platform specific objects to replicate the native platforms looks and feel. |
| 24 class VIEWS_EXPORT Checkbox : public LabelButton { | 28 class VIEWS_EXPORT Checkbox : public LabelButton { |
| 25 public: | 29 public: |
| 26 static const char kViewClassName[]; | 30 static const char kViewClassName[]; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 56 // Set the image shown for each button state depending on whether it is | 60 // Set the image shown for each button state depending on whether it is |
| 57 // [checked] or [focused]. | 61 // [checked] or [focused]. |
| 58 void SetCustomImage(bool checked, | 62 void SetCustomImage(bool checked, |
| 59 bool focused, | 63 bool focused, |
| 60 ButtonState for_state, | 64 ButtonState for_state, |
| 61 const gfx::ImageSkia& image); | 65 const gfx::ImageSkia& image); |
| 62 | 66 |
| 63 // Paints a focus indicator for the view. | 67 // Paints a focus indicator for the view. |
| 64 virtual void PaintFocusRing(gfx::Canvas* canvas, const SkPaint& paint); | 68 virtual void PaintFocusRing(gfx::Canvas* canvas, const SkPaint& paint); |
| 65 | 69 |
| 70 // Gets the vector icon id used to draw the icon based on the current state of |
| 71 // |checked_|. |
| 72 virtual gfx::VectorIconId GetVectorIconId() const; |
| 73 |
| 66 private: | 74 private: |
| 67 // Overridden from Button: | 75 // Overridden from Button: |
| 68 void NotifyClick(const ui::Event& event) override; | 76 void NotifyClick(const ui::Event& event) override; |
| 69 | 77 |
| 70 ui::NativeTheme::Part GetThemePart() const override; | 78 ui::NativeTheme::Part GetThemePart() const override; |
| 71 void GetExtraParams(ui::NativeTheme::ExtraParams* params) const override; | 79 void GetExtraParams(ui::NativeTheme::ExtraParams* params) const override; |
| 72 | 80 |
| 73 // True if the checkbox is checked. | 81 // True if the checkbox is checked. |
| 74 bool checked_; | 82 bool checked_; |
| 75 | 83 |
| 76 // The images for each button state. | 84 // The images for each button state. |
| 77 gfx::ImageSkia images_[2][2][STATE_COUNT]; | 85 gfx::ImageSkia images_[2][2][STATE_COUNT]; |
| 78 | 86 |
| 79 DISALLOW_COPY_AND_ASSIGN(Checkbox); | 87 DISALLOW_COPY_AND_ASSIGN(Checkbox); |
| 80 }; | 88 }; |
| 81 | 89 |
| 82 } // namespace views | 90 } // namespace views |
| 83 | 91 |
| 84 #endif // UI_VIEWS_CONTROLS_BUTTON_CHECKBOX_H_ | 92 #endif // UI_VIEWS_CONTROLS_BUTTON_CHECKBOX_H_ |
| OLD | NEW |