| Index: athena/common/drag_handle.h
|
| diff --git a/athena/common/drag_handle.h b/athena/common/drag_handle.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..bc32133630ec7017e3e32c5835adab93b7b1535e
|
| --- /dev/null
|
| +++ b/athena/common/drag_handle.h
|
| @@ -0,0 +1,61 @@
|
| +// 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_COMMON_DRAG_HANDLE_H_
|
| +#define ATHENA_COMMON_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 {
|
| + 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;
|
| + };
|
| +
|
| + virtual ~DragHandle();
|
| +
|
| + enum ScrollDirection { VERTICAL, HORIZONTAL };
|
| +};
|
| +
|
| +// The handle view occupies the entire space given to it, showing a rectangular
|
| +// handle in the center of the view on a black background. Preferred width and
|
| +// height define the preferred visual extents of the rectangular handle.
|
| +// |margin| defines the minimum margins between the visual handle and the
|
| +// borders of the entire handle view.
|
| +ATHENA_EXPORT views::View* CreateDragHandleView(
|
| + DragHandle::ScrollDirection scroll_direction,
|
| + DragHandle::ScrollDelegate* delegate,
|
| + int preferred_width,
|
| + int preferred_height,
|
| + int margin);
|
| +
|
| +} // namespace athena
|
| +
|
| +#endif // ATHENA_COMMON_DRAG_HANDLE_H_
|
|
|