Chromium Code Reviews| Index: athena/util/drag_handle.h |
| diff --git a/athena/util/drag_handle.h b/athena/util/drag_handle.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7955865c5f785eae62165e00a97dbbc44664cd99 |
| --- /dev/null |
| +++ b/athena/util/drag_handle.h |
| @@ -0,0 +1,57 @@ |
| +// Copyright 2014 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 ATHENA_UTIL_DRAG_HANDLE_H_ |
| +#define ATHENA_UTIL_DRAG_HANDLE_H_ |
| + |
| +#include "athena/athena_export.h" |
| + |
| +namespace views { |
| +class View; |
| +} |
| + |
| +namespace athena { |
| +// DragHandle will notify it's delegate of the scroll gestures it receives |
| +// through the ScrollDelegate interface. |
| +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.
|
| + public: |
| + class ScrollDelegate { |
| + public: |
| + virtual ~ScrollDelegate() {} |
| + |
| + // Beginning of a scroll gesture. |
| + virtual void HandleScrollBegin(float delta) = 0; |
| + |
| + // End of the current scroll gesture. |
| + virtual void HandleScrollEnd() = 0; |
| + |
| + // Update of the scroll position for the currently active scroll gesture. |
| + virtual void HandleScrollUpdate(float delta) = 0; |
| + |
| + // Should return false if the delegate isn't going to react to the scroll |
| + // events. |
| + // As long as this returns false, the handle won't start scrolling. However |
| + // if the scroll starts while HandleCanScroll() returns true and then the |
| + // delegate's state changes mid-scrol and HandleCanScroll() starts to return |
| + // false, the handle will continue scrolling and HandleScrollUpdate / |
| + // HandleScrollEnd callbacks will be called on the delegate. |
| + 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
|
| + }; |
| + |
| + virtual ~DragHandle(); |
| + |
| + enum ScrollDirection { VERTICAL, HORIZONTAL }; |
| +}; |
| + |
| +// Creates a handle view which notifies the delegate of the scrolls performed on |
| +// it. |
| +ATHENA_EXPORT views::View* CreateDragHandleView( |
| + DragHandle::ScrollDirection scroll_direction, |
| + DragHandle::ScrollDelegate* delegate, |
| + int preferred_width, |
| + int preferred_height); |
| + |
| +} // namespace athena |
| + |
| +#endif // ATHENA_UTIL_DRAG_HANDLE_H_ |