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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_VIEWS_CONTROLS_SCROLLBAR_OVERLAY_SCROLL_BAR_H_ 5 #ifndef UI_VIEWS_CONTROLS_SCROLLBAR_OVERLAY_SCROLL_BAR_H_
6 #define UI_VIEWS_CONTROLS_SCROLLBAR_OVERLAY_SCROLL_BAR_H_ 6 #define UI_VIEWS_CONTROLS_SCROLLBAR_OVERLAY_SCROLL_BAR_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "ui/gfx/animation/slide_animation.h"
10 #include "ui/views/controls/scrollbar/base_scroll_bar.h" 9 #include "ui/views/controls/scrollbar/base_scroll_bar.h"
10 #include "ui/views/controls/scrollbar/base_scroll_bar_thumb.h"
11 11
12 namespace views { 12 namespace views {
13 13
14 // The transparent scrollbar which overlays its contents. 14 // The transparent scrollbar which overlays its contents.
15 class VIEWS_EXPORT OverlayScrollBar : public BaseScrollBar { 15 class VIEWS_EXPORT OverlayScrollBar : public BaseScrollBar {
16 public: 16 public:
17 explicit OverlayScrollBar(bool horizontal); 17 explicit OverlayScrollBar(bool horizontal);
18 ~OverlayScrollBar() override; 18 ~OverlayScrollBar() override;
19 19
20 protected: 20 protected:
21 // BaseScrollBar overrides: 21 // BaseScrollBar overrides:
22 gfx::Rect GetTrackBounds() const override; 22 gfx::Rect GetTrackBounds() const override;
23 void OnGestureEvent(ui::GestureEvent* event) override;
24 23
25 // ScrollBar overrides: 24 // ScrollBar overrides:
26 int GetLayoutSize() const override; 25 int GetLayoutSize() const override;
27 int GetContentOverlapSize() const override; 26 int GetContentOverlapSize() const override;
28 void OnMouseEnteredScrollView(const ui::MouseEvent& event) override;
29 void OnMouseExitedScrollView(const ui::MouseEvent& event) override;
30 27
31 // View overrides: 28 // View overrides:
32 void Layout() override; 29 void Layout() override;
30 void OnMouseEntered(const ui::MouseEvent& event) override;
31 void OnMouseExited(const ui::MouseEvent& event) override;
33 32
34 private: 33 private:
35 gfx::SlideAnimation animation_; 34 class Thumb : public BaseScrollBarThumb {
35 public:
36 explicit Thumb(OverlayScrollBar* scroll_bar);
37 ~Thumb() override;
38
39 protected:
40 // BaseScrollBarThumb:
41 gfx::Size GetPreferredSize() const override;
42 void OnPaint(gfx::Canvas* canvas) override;
43 void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
44 void OnStateChanged() override;
45
46 private:
47 OverlayScrollBar* scroll_bar_;
48
49 DISALLOW_COPY_AND_ASSIGN(Thumb);
50 };
51 friend class Thumb;
52
53 // Shows this (effectively, the thumb) without delay.
54 void Show();
55 // Hides this with a delay.
56 void Hide();
57 // Starts a countdown that hides this when it fires.
58 void StartHideCountdown();
59
60 base::Timer hide_timer_;
61
36 DISALLOW_COPY_AND_ASSIGN(OverlayScrollBar); 62 DISALLOW_COPY_AND_ASSIGN(OverlayScrollBar);
37 }; 63 };
38 64
39 } // namespace views 65 } // namespace views
40 66
41 #endif // UI_VIEWS_CONTROLS_SCROLLBAR_OVERLAY_SCROLL_BAR_H_ 67 #endif // UI_VIEWS_CONTROLS_SCROLLBAR_OVERLAY_SCROLL_BAR_H_
OLDNEW
« 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