| 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" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 void set_listener(ButtonListener* listener) { listener_ = listener; } | 33 void set_listener(ButtonListener* listener) { listener_ = listener; } |
| 34 | 34 |
| 35 // Sets/Gets whether or not the checkbox is checked. | 35 // Sets/Gets whether or not the checkbox is checked. |
| 36 virtual void SetChecked(bool checked); | 36 virtual void SetChecked(bool checked); |
| 37 bool checked() const { return checked_; } | 37 bool checked() const { return checked_; } |
| 38 | 38 |
| 39 protected: | 39 protected: |
| 40 // Returns whether MD is enabled; exists for the sake of brevity. | 40 // Returns whether MD is enabled; exists for the sake of brevity. |
| 41 static bool UseMd(); | 41 static bool UseMd(); |
| 42 | 42 |
| 43 // Overridden from LabelButton: | 43 // LabelButton: |
| 44 const char* GetClassName() const override; | 44 const char* GetClassName() const override; |
| 45 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; | 45 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; |
| 46 void OnPaint(gfx::Canvas* canvas) override; | 46 void OnPaint(gfx::Canvas* canvas) override; |
| 47 void OnFocus() override; | 47 void OnFocus() override; |
| 48 void OnBlur() override; | 48 void OnBlur() override; |
| 49 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; | 49 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; |
| 50 std::unique_ptr<InkDropRipple> CreateInkDropRipple() const override; | 50 std::unique_ptr<InkDropRipple> CreateInkDropRipple() const override; |
| 51 std::unique_ptr<InkDropHighlight> CreateInkDropHighlight() const override; |
| 51 SkColor GetInkDropBaseColor() const override; | 52 SkColor GetInkDropBaseColor() const override; |
| 52 gfx::ImageSkia GetImage(ButtonState for_state) const override; | 53 gfx::ImageSkia GetImage(ButtonState for_state) const override; |
| 53 | 54 |
| 54 // 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 |
| 55 // [checked] or [focused]. | 56 // [checked] or [focused]. |
| 56 void SetCustomImage(bool checked, | 57 void SetCustomImage(bool checked, |
| 57 bool focused, | 58 bool focused, |
| 58 ButtonState for_state, | 59 ButtonState for_state, |
| 59 const gfx::ImageSkia& image); | 60 const gfx::ImageSkia& image); |
| 60 | 61 |
| 61 // Paints a focus indicator for the view. | 62 // Paints a focus indicator for the view. |
| 62 virtual void PaintFocusRing(gfx::Canvas* canvas, const cc::PaintFlags& flags); | 63 virtual void PaintFocusRing(gfx::Canvas* canvas, const cc::PaintFlags& flags); |
| 63 | 64 |
| 64 // 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_|. |
| 65 virtual const gfx::VectorIcon& GetVectorIcon() const; | 66 virtual const gfx::VectorIcon& GetVectorIcon() const; |
| 66 | 67 |
| 67 private: | 68 private: |
| 68 // Overridden from Button: | 69 // Button: |
| 69 void NotifyClick(const ui::Event& event) override; | 70 void NotifyClick(const ui::Event& event) override; |
| 70 | 71 |
| 71 ui::NativeTheme::Part GetThemePart() const override; | 72 ui::NativeTheme::Part GetThemePart() const override; |
| 72 void GetExtraParams(ui::NativeTheme::ExtraParams* params) const override; | 73 void GetExtraParams(ui::NativeTheme::ExtraParams* params) const override; |
| 73 | 74 |
| 74 // True if the checkbox is checked. | 75 // True if the checkbox is checked. |
| 75 bool checked_; | 76 bool checked_; |
| 76 | 77 |
| 77 // The images for each button node_data. | 78 // The images for each button node_data. |
| 78 gfx::ImageSkia images_[2][2][STATE_COUNT]; | 79 gfx::ImageSkia images_[2][2][STATE_COUNT]; |
| 79 | 80 |
| 80 DISALLOW_COPY_AND_ASSIGN(Checkbox); | 81 DISALLOW_COPY_AND_ASSIGN(Checkbox); |
| 81 }; | 82 }; |
| 82 | 83 |
| 83 } // namespace views | 84 } // namespace views |
| 84 | 85 |
| 85 #endif // UI_VIEWS_CONTROLS_BUTTON_CHECKBOX_H_ | 86 #endif // UI_VIEWS_CONTROLS_BUTTON_CHECKBOX_H_ |
| OLD | NEW |