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..ae32db343ec607ac811bf057fd4246a1aa11aa35 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,20 @@ 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); |
| + |
| + // Calculates and returns the bounding box of all drawn elements including the |
| + // necessary padding but not including any additional border. |
| + gfx::Size GetVisibleSize() const; |
|
Evan Stade
2016/11/18 00:20:21
I'd prefer exposing GetPreferredSize(). That shoul
varkha
2016/11/18 01:13:40
Done.
|
| + |
| 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. |
| @@ -35,14 +46,18 @@ class VIEWS_EXPORT ToggleButton : public CustomButton { |
| SkColor GetTrackColor(bool is_on) const; |
| - // CustomButton: |
| + // views::View: |
| gfx::Size GetPreferredSize() const override; |
| const char* GetClassName() const override; |
| void OnPaint(gfx::Canvas* canvas) override; |
| - void NotifyClick(const ui::Event& event) override; |
| + void OnFocus() override; |
| + void OnBlur() override; |
| void OnBoundsChanged(const gfx::Rect& previous_bounds) override; |
| void OnNativeThemeChanged(const ui::NativeTheme* theme) override; |
| void GetAccessibleNodeData(ui::AXNodeData* node_data) override; |
| + |
| + // CustomButton: |
| + void NotifyClick(const ui::Event& event) override; |
| void AddInkDropLayer(ui::Layer* ink_drop_layer) override; |
| void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override; |
| std::unique_ptr<InkDrop> CreateInkDrop() override; |
| @@ -55,6 +70,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); |
| }; |