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

Unified Diff: ui/views/controls/scrollbar/native_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: 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/controls/scrollbar/native_cocoa_scroll_bar.h
diff --git a/ui/views/controls/scrollbar/native_cocoa_scroll_bar.h b/ui/views/controls/scrollbar/native_cocoa_scroll_bar.h
new file mode 100644
index 0000000000000000000000000000000000000000..837447d138784b5047d21a14330bde73da54ec0d
--- /dev/null
+++ b/ui/views/controls/scrollbar/native_cocoa_scroll_bar.h
@@ -0,0 +1,64 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_VIEWS_CONTROLS_SCROLLBAR_NATIVE_COCOA_SCROLL_BAR_H_
+#define UI_VIEWS_CONTROLS_SCROLLBAR_NATIVE_COCOA_SCROLL_BAR_H_
+
+#include "base/macros.h"
+#import "base/mac/scoped_nsobject.h"
+#include "ui/gfx/animation/linear_animation.h"
+#import "ui/views/cocoa/views_scrollbar_bridge.h"
+#include "ui/views/controls/scrollbar/base_scroll_bar.h"
+#include "ui/views/controls/scrollbar/native_scroll_bar.h"
+#include "ui/views/controls/scrollbar/native_scroll_bar_views.h"
+#include "ui/views/views_export.h"
+
+@class ViewsScrollbarBridge;
+
+namespace views {
+
+// The transparent scrollbar which overlays its contents.
+class VIEWS_EXPORT NativeCocoaScrollBar : public NativeScrollBar {
+ public:
+ explicit NativeCocoaScrollBar(bool horizontal);
+ ~NativeCocoaScrollBar() override;
+
+ protected:
+ NativeScrollBarWrapper* CreateWrapper() override;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(NativeCocoaScrollBar);
+};
+
+class VIEWS_EXPORT NativeCocoaScrollBarViews
tapted 2016/02/11 08:46:17 I think this should be NativeScrollBarViewsMac i
spqchan 2016/02/13 01:39:23 I just switched back to CocoaScrollBar, do you thi
+ : public NativeScrollBarViews,
tapted 2016/02/11 08:46:17 We should override NativeScrollBarViews::OnPaint()
spqchan 2016/02/13 01:39:23 Did it for CocoaScrollBar.
+ public ViewsScrollbarBridgeDelegate {
+ public:
+ explicit NativeCocoaScrollBarViews(NativeScrollBar* native_scroll_bar);
+ ~NativeCocoaScrollBarViews() override;
+
+ // BaseScrollBar override
tapted 2016/02/11 08:46:17 nit: Lately views OWNERS have been asking me to go
spqchan 2016/02/13 01:39:23 Done.
+ bool OnScroll(float dx, float dy) override;
+
tapted 2016/02/11 08:46:17 Hm... how do we fix the layout so that the content
spqchan 2016/02/13 01:39:23 I used return 0 for GetLayoutSize() I used the scr
+ // ViewsScrollbarBridgeDelegate override
+ void OnScrollerStyleChanged() override;
+
+ private:
+ void ShowScrollbar();
+ void HideScrollbar();
+
+ NSScrollerStyle scroller_style_;
+
+ // Timer that will start the scrollbar's hiding animation when it reaches 0.
+ base::OneShotTimer hide_scrollbar_timer_;
+
+ // The bridge for NSScroller.
+ base::scoped_nsobject<ViewsScrollbarBridge> bridge_;
+
+ DISALLOW_COPY_AND_ASSIGN(NativeCocoaScrollBarViews);
+};
+
+} // namespace views
+
+#endif // UI_VIEWS_CONTROLS_SCROLLBAR_COCOA_SCROLL_BAR_H_

Powered by Google App Engine
This is Rietveld 408576698