| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_TOGGLE_BUTTON_H_ | 5 #ifndef UI_VIEWS_CONTROLS_BUTTON_TOGGLE_BUTTON_H_ |
| 6 #define UI_VIEWS_CONTROLS_BUTTON_TOGGLE_BUTTON_H_ | 6 #define UI_VIEWS_CONTROLS_BUTTON_TOGGLE_BUTTON_H_ |
| 7 | 7 |
| 8 #include "ui/gfx/animation/slide_animation.h" | 8 #include "ui/gfx/animation/slide_animation.h" |
| 9 #include "ui/views/controls/button/custom_button.h" | 9 #include "ui/views/controls/button/custom_button.h" |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 private: | 26 private: |
| 27 friend class TestToggleButton; | 27 friend class TestToggleButton; |
| 28 class ThumbView; | 28 class ThumbView; |
| 29 | 29 |
| 30 // Calculates the bounding box for the thumb (the circle). | 30 // Calculates the bounding box for the thumb (the circle). |
| 31 gfx::Rect GetThumbBounds() const; | 31 gfx::Rect GetThumbBounds() const; |
| 32 | 32 |
| 33 // Updates position and color of the thumb. | 33 // Updates position and color of the thumb. |
| 34 void UpdateThumb(); | 34 void UpdateThumb(); |
| 35 | 35 |
| 36 SkColor GetTrackColor(bool is_on) const; |
| 37 |
| 36 // CustomButton: | 38 // CustomButton: |
| 37 gfx::Size GetPreferredSize() const override; | 39 gfx::Size GetPreferredSize() const override; |
| 38 const char* GetClassName() const override; | 40 const char* GetClassName() const override; |
| 39 void OnPaint(gfx::Canvas* canvas) override; | 41 void OnPaint(gfx::Canvas* canvas) override; |
| 40 void NotifyClick(const ui::Event& event) override; | 42 void NotifyClick(const ui::Event& event) override; |
| 41 void OnBoundsChanged(const gfx::Rect& previous_bounds) override; | 43 void OnBoundsChanged(const gfx::Rect& previous_bounds) override; |
| 42 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; | 44 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; |
| 43 void AddInkDropLayer(ui::Layer* ink_drop_layer) override; | 45 void AddInkDropLayer(ui::Layer* ink_drop_layer) override; |
| 44 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override; | 46 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override; |
| 45 std::unique_ptr<InkDropRipple> CreateInkDropRipple() const override; | 47 std::unique_ptr<InkDropRipple> CreateInkDropRipple() const override; |
| 46 SkColor GetInkDropBaseColor() const override; | 48 SkColor GetInkDropBaseColor() const override; |
| 47 bool ShouldShowInkDropHighlight() const override; | 49 bool ShouldShowInkDropHighlight() const override; |
| 48 | 50 |
| 49 // gfx::AnimationDelegate: | 51 // gfx::AnimationDelegate: |
| 50 void AnimationProgressed(const gfx::Animation* animation) override; | 52 void AnimationProgressed(const gfx::Animation* animation) override; |
| 51 | 53 |
| 52 bool is_on_; | 54 bool is_on_; |
| 53 gfx::SlideAnimation slide_animation_; | 55 gfx::SlideAnimation slide_animation_; |
| 54 std::unique_ptr<ThumbView> thumb_view_; | 56 ThumbView* thumb_view_; |
| 55 | 57 |
| 56 DISALLOW_COPY_AND_ASSIGN(ToggleButton); | 58 DISALLOW_COPY_AND_ASSIGN(ToggleButton); |
| 57 }; | 59 }; |
| 58 | 60 |
| 59 } // namespace views | 61 } // namespace views |
| 60 | 62 |
| 61 #endif // UI_VIEWS_CONTROLS_BUTTON_TOGGLE_BUTTON_H_ | 63 #endif // UI_VIEWS_CONTROLS_BUTTON_TOGGLE_BUTTON_H_ |
| OLD | NEW |