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

Side by Side Diff: ui/views/controls/scrollbar/cocoa_scroll_bar.h

Issue 1671313002: MacViews: Overlay Scrollbars with Show/Hide Animations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 4 years, 10 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef UI_VIEWS_CONTROLS_SCROLLBAR_COCOA_SCROLL_BAR_H_
6 #define UI_VIEWS_CONTROLS_SCROLLBAR_COCOA_SCROLL_BAR_H_
7
8 #include "base/macros.h"
9 #import "base/mac/scoped_nsobject.h"
10 #import "ui/views/cocoa/views_scrollbar_bridge.h"
11 #include "ui/views/controls/scrollbar/base_scroll_bar.h"
12 #include "ui/views/views_export.h"
13
14 namespace views {
15
16 // The transparent scrollbar for Mac which overlays its contents.
17 class VIEWS_EXPORT CocoaScrollBar : public BaseScrollBar,
18 public ViewsScrollbarBridgeDelegate {
19 public:
20 explicit CocoaScrollBar(bool horizontal);
21 ~CocoaScrollBar() override;
22
23 // Called by CocoaScrollBarThumb when the mouse enters or exits the view.
24 void OnMouseEnteredScrollbarThumb(const ui::MouseEvent& event);
25
26 // ScrollDelegate:
27 bool OnScroll(float dx, float dy) override;
28
29 // ViewsScrollbarBridgeDelegate:
30 void OnScrollerStyleChanged() override;
31
32 // Returns the scroller style.
33 NSScrollerStyle GetScrollerStyle() const { return scroller_style_; }
34
35 protected:
36 // BaseScrollBar:
37 gfx::Rect GetTrackBounds() const override;
38
39 // ScrollBar:
40 int GetLayoutSize() const override;
41 int GetContentOverlapSize() const override;
42
43 // View:
44 void Layout() override;
45 gfx::Size GetPreferredSize() const override;
46 void OnPaint(gfx::Canvas* canvas) override;
47
48 private:
49 // Methods to change the visibility of the scrollbar.
50 void ShowScrollbar();
51 void HideScrollbar();
52
53 // Scroller style the scrollbar is using.
54 NSScrollerStyle scroller_style_;
55
56 // Timer that will start the scrollbar's hiding animation when it reaches 0.
57 base::Timer hide_scrollbar_timer_;
58
59 // True when the scrolltrack should be drawn.
60 bool has_scrolltrack_;
61
62 // The bridge for NSScroller.
63 base::scoped_nsobject<ViewsScrollbarBridge> bridge_;
64
65 DISALLOW_COPY_AND_ASSIGN(CocoaScrollBar);
66 };
67
68 } // namespace views
69
70 #endif // UI_VIEWS_CONTROLS_SCROLLBAR_COCOA_SCROLL_BAR_H_
OLDNEW
« no previous file with comments | « ui/views/controls/scroll_view_unittest.cc ('k') | ui/views/controls/scrollbar/cocoa_scroll_bar.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698