OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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 IOS_CHROME_BROWSER_UI_OVERSCROLL_ACTIONS_OVERSCROLL_ACTIONS_VIEW_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_OVERSCROLL_ACTIONS_OVERSCROLL_ACTIONS_VIEW_H_ |
| 7 |
| 8 #import <UIKit/UIKit.h> |
| 9 |
| 10 namespace ios_internal { |
| 11 // Describes the current Index of an action in the OverScrollActionsView. |
| 12 enum class OverscrollAction { |
| 13 NONE, // No action |
| 14 NEW_TAB, // New tab action |
| 15 REFRESH, // Refresh action |
| 16 CLOSE_TAB, // Close tab action |
| 17 }; |
| 18 |
| 19 // Describes the style of the overscroll action UI. |
| 20 enum class OverscrollStyle { |
| 21 NTP_NON_INCOGNITO, // UI to fit the NTP in non incognito. |
| 22 NTP_INCOGNITO, // UI to fit the NTP in incognito. |
| 23 REGULAR_PAGE_NON_INCOGNITO, // UI to fit regular pages in non incognito. |
| 24 REGULAR_PAGE_INCOGNITO // UI to fit regular pages in incognito. |
| 25 }; |
| 26 |
| 27 } // namespace ios_internal |
| 28 |
| 29 @class OverscrollActionsView; |
| 30 |
| 31 @protocol OverscrollActionsViewDelegate |
| 32 |
| 33 - (void)overscrollActionsViewDidTapTriggerAction: |
| 34 (OverscrollActionsView*)overscrollActionsView; |
| 35 |
| 36 @end |
| 37 |
| 38 // This view displays the actions of the OverscrollActionsController. |
| 39 // How actions are displayed depends on the vertical and horizontal offsets. |
| 40 @interface OverscrollActionsView : UIView |
| 41 |
| 42 // The currently selected action. |
| 43 @property(nonatomic, assign, readonly) |
| 44 ios_internal::OverscrollAction selectedAction; |
| 45 // The view displayed has the background of the overscroll actions view. |
| 46 @property(nonatomic, retain, readonly) UIView* backgroundView; |
| 47 // Whether cropping is set on the selection circle (true by default). |
| 48 @property(nonatomic, assign) BOOL selectionCroppingEnabled; |
| 49 |
| 50 @property(nonatomic, assign) id<OverscrollActionsViewDelegate> delegate; |
| 51 |
| 52 // Add a snapshot view on top of the background image view. The previous |
| 53 // snapshot view if any will be removed. |
| 54 - (void)addSnapshotView:(UIView*)view; |
| 55 |
| 56 // Called to indicate that a new pull gesture has started. |
| 57 - (void)pullStarted; |
| 58 |
| 59 // Vertical offset [0, yOffset]. |
| 60 // This offset is set to the top inset of the scrollView managed by the |
| 61 // OverscrollActionsController. |
| 62 - (void)updateWithVerticalOffset:(CGFloat)offset; |
| 63 |
| 64 // Horizontal offset [-1,1]. |
| 65 // This offset is set by the OverscrollActionsController and is used to display |
| 66 // the action selection circle. |
| 67 - (void)updateWithHorizontalOffset:(CGFloat)offset; |
| 68 |
| 69 // This starts an "ink response" like animation typically triggered when an |
| 70 // action has been selected. |
| 71 - (void)displayActionAnimation; |
| 72 |
| 73 // Sets the style of the overscroll action UI. |
| 74 - (void)setStyle:(ios_internal::OverscrollStyle)style; |
| 75 |
| 76 @end |
| 77 |
| 78 #endif // IOS_CHROME_BROWSER_UI_OVERSCROLL_ACTIONS_OVERSCROLL_ACTIONS_VIEW_H_ |
OLD | NEW |