OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 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 ATHENA_UTIL_DRAG_HANDLE_H_ |
| 6 #define ATHENA_UTIL_DRAG_HANDLE_H_ |
| 7 |
| 8 #include "athena/athena_export.h" |
| 9 |
| 10 namespace views { |
| 11 class View; |
| 12 } |
| 13 |
| 14 namespace athena { |
| 15 class DragHandleScrollDelegate { |
| 16 public: |
| 17 virtual ~DragHandleScrollDelegate() {} |
| 18 |
| 19 // Beginning of a scroll gesture. |
| 20 virtual void HandleScrollBegin(float delta) = 0; |
| 21 |
| 22 // End of the current scroll gesture. |
| 23 virtual void HandleScrollEnd() = 0; |
| 24 |
| 25 // Update of the scroll position for the currently active scroll gesture. |
| 26 virtual void HandleScrollUpdate(float delta) = 0; |
| 27 |
| 28 // Should return false if the delegate isn't going to react to the scroll |
| 29 // events. |
| 30 // As long as this returns false, the handle won't start scrolling. However |
| 31 // if the scroll starts while HandleCanScroll() returns true and then the |
| 32 // delegate's state changes mid-scrol and HandleCanScroll() starts to return |
| 33 // false, the handle will continue scrolling and HandleScrollUpdate / |
| 34 // HandleScrollEnd callbacks will be called on the delegate. |
| 35 virtual bool HandleCanScroll() = 0; |
| 36 }; |
| 37 |
| 38 enum DragHandleScrollDirection { DRAG_HANDLE_VERTICAL, DRAG_HANDLE_HORIZONTAL }; |
| 39 |
| 40 // Creates a handle view which notifies the delegate of the scrolls performed on |
| 41 // it. |
| 42 ATHENA_EXPORT views::View* CreateDragHandleView( |
| 43 DragHandleScrollDirection scroll_direction, |
| 44 DragHandleScrollDelegate* delegate, |
| 45 int preferred_width, |
| 46 int preferred_height); |
| 47 |
| 48 } // namespace athena |
| 49 |
| 50 #endif // ATHENA_UTIL_DRAG_HANDLE_H_ |
OLD | NEW |