Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Unified Diff: ui/views/controls/button/toggle_button.h

Issue 2396133005: [ash-md] Animates ToggleButton highlight to move it in sync with the thumb (Closed)
Patch Set: [ash-md] Animates ToggleButton highlight to move it in sync with the thumb (comments) Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/views/controls/button/toggle_button.cc » ('j') | ui/views/controls/button/toggle_button.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 347d1d050a3e99dbb6ef0625ec8d88ddc0b09173..4e88422883c1f9db5bc23d8ed290f9f28df12477 100644
--- a/ui/views/controls/button/toggle_button.h
+++ b/ui/views/controls/button/toggle_button.h
@@ -22,11 +22,17 @@ class VIEWS_EXPORT ToggleButton : public CustomButton {
bool is_on() const { return is_on_; }
private:
+ class ThumbView;
+
// CustomButton:
gfx::Size GetPreferredSize() const override;
+ const char* GetClassName() const override;
void OnPaint(gfx::Canvas* canvas) override;
void NotifyClick(const ui::Event& event) override;
+ void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
void OnNativeThemeChanged(const ui::NativeTheme* theme) override;
+ void AddInkDropLayer(ui::Layer* ink_drop_layer) override;
+ void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override;
std::unique_ptr<InkDropRipple> CreateInkDropRipple() const override;
SkColor GetInkDropBaseColor() const override;
bool ShouldShowInkDropHighlight() const override;
@@ -37,8 +43,12 @@ class VIEWS_EXPORT ToggleButton : public CustomButton {
// Calculates the bounding box for the thumb (the circle).
gfx::Rect GetThumbBounds() const;
+ // Updates position and color of the thumb.
+ void UpdateThumb();
sadrul 2016/10/13 03:30:23 non-virtuals should be before virtuals (although I
varkha 2016/10/13 17:04:56 Done.
+
bool is_on_;
gfx::SlideAnimation slide_animation_;
+ std::unique_ptr<ThumbView> thumb_view_;
DISALLOW_COPY_AND_ASSIGN(ToggleButton);
};
« no previous file with comments | « no previous file | ui/views/controls/button/toggle_button.cc » ('j') | ui/views/controls/button/toggle_button.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698