| OLD | NEW |
| (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_NATIVE_COCOA_SCROLL_BAR_H_ |
| 6 #define UI_VIEWS_CONTROLS_SCROLLBAR_NATIVE_COCOA_SCROLL_BAR_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #import "base/mac/scoped_nsobject.h" |
| 10 #include "ui/gfx/animation/linear_animation.h" |
| 11 #import "ui/views/cocoa/views_scrollbar_bridge.h" |
| 12 #include "ui/views/controls/scrollbar/base_scroll_bar.h" |
| 13 #include "ui/views/controls/scrollbar/native_scroll_bar.h" |
| 14 #include "ui/views/controls/scrollbar/native_scroll_bar_views.h" |
| 15 #include "ui/views/views_export.h" |
| 16 |
| 17 @class ViewsScrollbarBridge; |
| 18 |
| 19 namespace views { |
| 20 |
| 21 // The transparent scrollbar which overlays its contents. |
| 22 class VIEWS_EXPORT NativeCocoaScrollBar : public NativeScrollBar { |
| 23 public: |
| 24 explicit NativeCocoaScrollBar(bool horizontal); |
| 25 ~NativeCocoaScrollBar() override; |
| 26 |
| 27 protected: |
| 28 NativeScrollBarWrapper* CreateWrapper() override; |
| 29 |
| 30 private: |
| 31 DISALLOW_COPY_AND_ASSIGN(NativeCocoaScrollBar); |
| 32 }; |
| 33 |
| 34 class VIEWS_EXPORT NativeCocoaScrollBarViews |
| 35 : public NativeScrollBarViews, |
| 36 public ViewsScrollbarBridgeDelegate { |
| 37 public: |
| 38 explicit NativeCocoaScrollBarViews(NativeScrollBar* native_scroll_bar); |
| 39 ~NativeCocoaScrollBarViews() override; |
| 40 |
| 41 // BaseScrollBar override |
| 42 bool OnScroll(float dx, float dy) override; |
| 43 |
| 44 // ViewsScrollbarBridgeDelegate override |
| 45 void OnScrollerStyleChanged() override; |
| 46 |
| 47 private: |
| 48 void ShowScrollbar(); |
| 49 void HideScrollbar(); |
| 50 |
| 51 NSScrollerStyle scroller_style_; |
| 52 |
| 53 // Timer that will start the scrollbar's hiding animation when it reaches 0. |
| 54 base::OneShotTimer hide_scrollbar_timer_; |
| 55 |
| 56 // The bridge for NSScroller. |
| 57 base::scoped_nsobject<ViewsScrollbarBridge> bridge_; |
| 58 |
| 59 DISALLOW_COPY_AND_ASSIGN(NativeCocoaScrollBarViews); |
| 60 }; |
| 61 |
| 62 } // namespace views |
| 63 |
| 64 #endif // UI_VIEWS_CONTROLS_SCROLLBAR_COCOA_SCROLL_BAR_H_ |
| OLD | NEW |