Chromium Code Reviews| Index: ui/views/controls/button/toggle_button.h |
| diff --git a/ui/views/controls/button/toggle_button.h b/ui/views/controls/button/toggle_button.h |
| index eb8efadfbd22aea374cab8b80f86fdc1b46772d3..610691dfb6b398a4ddd16f2679ddb2635a7b6350 100644 |
| --- a/ui/views/controls/button/toggle_button.h |
| +++ b/ui/views/controls/button/toggle_button.h |
| @@ -10,6 +10,8 @@ |
| namespace views { |
| +class Painter; |
| + |
| // This view presents a button that has two states: on and off. This is similar |
| // to a checkbox but has no text and looks more like a two-state horizontal |
| // slider. |
| @@ -23,11 +25,21 @@ class VIEWS_EXPORT ToggleButton : public CustomButton { |
| void SetIsOn(bool is_on, bool animate); |
| bool is_on() const { return is_on_; } |
| + void set_focus_painter(std::unique_ptr<Painter> focus_painter); |
| + |
| + protected: |
| + // View: |
| + void OnFocus() override; |
|
Evan Stade
2016/11/17 23:24:36
nit: put these in the same block as the other over
varkha
2016/11/17 23:40:51
Done. Also split View overrides from the CustomBut
|
| + void OnBlur() override; |
| + |
| private: |
| friend class TestToggleButton; |
| class ThumbView; |
| - // Calculates the bounding box for the thumb (the circle). |
| + // Calculates and returns the bounding box for the track. |
| + gfx::Rect GetTrackBounds() const; |
| + |
| + // Calculates and returns the bounding box for the thumb (the circle). |
| gfx::Rect GetThumbBounds() const; |
| // Updates position and color of the thumb. |
| @@ -55,6 +67,7 @@ class VIEWS_EXPORT ToggleButton : public CustomButton { |
| bool is_on_; |
| gfx::SlideAnimation slide_animation_; |
| ThumbView* thumb_view_; |
| + std::unique_ptr<Painter> focus_painter_; |
| DISALLOW_COPY_AND_ASSIGN(ToggleButton); |
| }; |