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

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

Issue 2496643002: Implement Sebastien's overlay scrollbars for native UI (Views). (Closed)
Patch Set: fix test failure 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..13ca029f2bcbb6d27433cc24367dba3fa838cf24 100644
--- a/ui/views/controls/scrollbar/overlay_scroll_bar.h
+++ b/ui/views/controls/scrollbar/overlay_scroll_bar.h
@@ -6,8 +6,8 @@
#define UI_VIEWS_CONTROLS_SCROLLBAR_OVERLAY_SCROLL_BAR_H_
#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 +20,45 @@ 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:
+ 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 OnStateChanged() override;
+
+ private:
+ OverlayScrollBar* scroll_bar_;
+
+ DISALLOW_COPY_AND_ASSIGN(Thumb);
+ };
+ friend class Thumb;
+
+ // Shows this (effectively, the thumb) without delay.
+ void Show();
+ // Hides this with a delay.
+ void Hide();
+ // Starts a countdown that hides this when it fires.
+ void StartHideCountdown();
+
+ base::Timer hide_timer_;
+
DISALLOW_COPY_AND_ASSIGN(OverlayScrollBar);
};
« no previous file with comments | « ui/views/controls/scrollbar/base_scroll_bar_thumb.cc ('k') | ui/views/controls/scrollbar/overlay_scroll_bar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698