Chromium Code Reviews| 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 // DragHandle will notify it's delegate of the scroll gestures it receives | |
| 16 // through the ScrollDelegate interface. | |
| 17 class DragHandle { | |
|
pkotwicz
2014/09/16 20:02:47
Nuke the DragHandle class. No one instantiates it.
mfomitchev
2014/09/22 21:10:59
Done.
| |
| 18 public: | |
| 19 class ScrollDelegate { | |
| 20 public: | |
| 21 virtual ~ScrollDelegate() {} | |
| 22 | |
| 23 // Beginning of a scroll gesture. | |
| 24 virtual void HandleScrollBegin(float delta) = 0; | |
| 25 | |
| 26 // End of the current scroll gesture. | |
| 27 virtual void HandleScrollEnd() = 0; | |
| 28 | |
| 29 // Update of the scroll position for the currently active scroll gesture. | |
| 30 virtual void HandleScrollUpdate(float delta) = 0; | |
| 31 | |
| 32 // Should return false if the delegate isn't going to react to the scroll | |
| 33 // events. | |
| 34 // As long as this returns false, the handle won't start scrolling. However | |
| 35 // if the scroll starts while HandleCanScroll() returns true and then the | |
| 36 // delegate's state changes mid-scrol and HandleCanScroll() starts to return | |
| 37 // false, the handle will continue scrolling and HandleScrollUpdate / | |
| 38 // HandleScrollEnd callbacks will be called on the delegate. | |
| 39 virtual bool HandleCanScroll() = 0; | |
|
pkotwicz
2014/09/16 20:02:47
I wonder whether this is overkill. In the bezel ca
mfomitchev
2014/09/22 21:10:59
Actually we don't ignore update/end once we receiv
pkotwicz
2014/09/23 05:13:39
Just to double check, we are planning on having Ha
mfomitchev
2014/09/23 15:46:02
Yes, good point. I added it because I thought we w
| |
| 40 }; | |
| 41 | |
| 42 virtual ~DragHandle(); | |
| 43 | |
| 44 enum ScrollDirection { VERTICAL, HORIZONTAL }; | |
| 45 }; | |
| 46 | |
| 47 // Creates a handle view which notifies the delegate of the scrolls performed on | |
| 48 // it. | |
| 49 ATHENA_EXPORT views::View* CreateDragHandleView( | |
| 50 DragHandle::ScrollDirection scroll_direction, | |
| 51 DragHandle::ScrollDelegate* delegate, | |
| 52 int preferred_width, | |
| 53 int preferred_height); | |
| 54 | |
| 55 } // namespace athena | |
| 56 | |
| 57 #endif // ATHENA_UTIL_DRAG_HANDLE_H_ | |
| OLD | NEW |