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 IOS_CHROME_BROWSER_UI_CONTEXTUAL_SEARCH_CONTEXTUAL_SEARCH_PANEL_VIEW_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_CONTEXTUAL_SEARCH_CONTEXTUAL_SEARCH_PANEL_VIEW_H_ |
| 7 |
| 8 #import <UIKit/UIKit.h> |
| 9 #import "ios/chrome/browser/ui/contextual_search/panel_configuration.h" |
| 10 |
| 11 @protocol ContextualSearchPanelMotionObserver; |
| 12 @protocol ContextualSearchPanelTapHandler; |
| 13 |
| 14 // A view designed to sit "on top" of the frontmost tab in a range of positions, |
| 15 // with content can position controlled by a ContextualSearchPanelController. |
| 16 // Generally speaking each BrowserViewController will own both the panel view |
| 17 // and panel controller object. |
| 18 @interface ContextualSearchPanelView : UIView |
| 19 |
| 20 // Current state. |
| 21 @property(nonatomic, assign) ContextualSearch::PanelState state; |
| 22 // Panel configuration, for motion observers that want to do different |
| 23 // computations around panel state and position. |
| 24 @property(nonatomic, readonly) PanelConfiguration* configuration; |
| 25 |
| 26 // Create a panel view. It will need to have a delegate and controller assigned |
| 27 // to do anything useful. |
| 28 - (instancetype)initWithConfiguration:(PanelConfiguration*)configuration |
| 29 NS_DESIGNATED_INITIALIZER; |
| 30 |
| 31 - (instancetype)initWithCoder:(NSCoder*)aDecoder NS_UNAVAILABLE; |
| 32 |
| 33 - (instancetype)initWithFrame:(CGRect)frame NS_UNAVAILABLE; |
| 34 |
| 35 // Add panel content views. Views in |contentViews| will be arranged vertically |
| 36 // in the panel according to their intrinsic sizes, and will fill its width. |
| 37 // If a view in |contentViews| conforms to the panel motion observer protocol, |
| 38 // it will be automatically added as an observer. |
| 39 // If a view in |contentViews| conforms to the panel scroll synchronizer |
| 40 // protocol, its scrolling will be synchronized with panel dragging. |
| 41 - (void)addContentViews:(NSArray*)contentViews; |
| 42 |
| 43 // Add or remove observers. |
| 44 - (void)addMotionObserver:(id<ContextualSearchPanelMotionObserver>)observer; |
| 45 - (void)removeMotionObserver:(id<ContextualSearchPanelMotionObserver>)observer; |
| 46 |
| 47 // Inform the receiver it is about to promote to be tab-sized; it will inform |
| 48 // any obsevers. |
| 49 - (void)prepareForPromotion; |
| 50 // Have the receiver adjust its frame to match its superview's bounds, |
| 51 // vertically offset by |offset| points from the y-origin. |
| 52 - (void)promoteToMatchSuperviewWithVerticalOffset:(CGFloat)offset; |
| 53 @end |
| 54 |
| 55 #endif // IOS_CHROME_BROWSER_UI_CONTEXTUAL_SEARCH_CONTEXTUAL_SEARCH_PANEL_VIEW_
H_ |
OLD | NEW |