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