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

Unified Diff: ui/views/controls/scrollbar/overlay_scroll_bar.h

Issue 2496643002: Implement Sebastien's overlay scrollbars for native UI (Views). (Closed)
Patch Set: clarify comment Created 4 years, 1 month 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
Index: ui/views/controls/scrollbar/overlay_scroll_bar.h
diff --git a/ui/views/controls/scrollbar/overlay_scroll_bar.h b/ui/views/controls/scrollbar/overlay_scroll_bar.h
index 36f908c2e7b10a172a68de3e761b1e3e82151752..b3dade83462420650bace249a391d8c3d1e7a095 100644
--- a/ui/views/controls/scrollbar/overlay_scroll_bar.h
+++ b/ui/views/controls/scrollbar/overlay_scroll_bar.h
@@ -8,6 +8,7 @@
#include "base/macros.h"
#include "ui/gfx/animation/slide_animation.h"
#include "ui/views/controls/scrollbar/base_scroll_bar.h"
+#include "ui/views/controls/scrollbar/base_scroll_bar_thumb.h"
namespace views {
@@ -20,19 +21,49 @@ class VIEWS_EXPORT OverlayScrollBar : public BaseScrollBar {
protected:
// BaseScrollBar overrides:
gfx::Rect GetTrackBounds() const override;
- void OnGestureEvent(ui::GestureEvent* event) override;
// ScrollBar overrides:
int GetLayoutSize() const override;
int GetContentOverlapSize() const override;
- void OnMouseEnteredScrollView(const ui::MouseEvent& event) override;
- void OnMouseExitedScrollView(const ui::MouseEvent& event) override;
// View overrides:
void Layout() override;
+ void OnMouseEntered(const ui::MouseEvent& event) override;
+ void OnMouseExited(const ui::MouseEvent& event) override;
private:
- gfx::SlideAnimation animation_;
+ class Thumb : public BaseScrollBarThumb, public gfx::AnimationDelegate {
+ public:
+ explicit Thumb(OverlayScrollBar* scroll_bar);
+ ~Thumb() override;
+
+ protected:
+ // BaseScrollBarThumb:
+ gfx::Size GetPreferredSize() const override;
+ void OnPaint(gfx::Canvas* canvas) override;
+ void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
+ void SetState(CustomButton::ButtonState state) override;
+
+ // gfx::AnimationDelegate overrides:
+ void AnimationProgressed(const gfx::Animation* animation) override;
+
+ private:
+ OverlayScrollBar* scroll_bar_;
+ gfx::SlideAnimation hover_animation_;
+
+ DISALLOW_COPY_AND_ASSIGN(Thumb);
+ };
+ friend class Thumb;
+
+ // Shows the thumb without delay.
+ void ShowThumb();
+ // Hides the thumb with a delay.
+ void HideThumb();
+ // Starts a countdown that hides the thumb when it fires.
+ void StartThumbHideCountdown();
+
+ base::Timer thumb_hide_timer_;
+
DISALLOW_COPY_AND_ASSIGN(OverlayScrollBar);
};

Powered by Google App Engine
This is Rietveld 408576698