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_TAB_SWITCHER_TAB_SWITCHER_HEADER_VIEW_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_TAB_SWITCHER_TAB_SWITCHER_HEADER_VIEW_H_ |
| 7 |
| 8 #import <UIKit/UIKit.h> |
| 9 |
| 10 #include "base/ios/block_types.h" |
| 11 |
| 12 @class SessionCellData; |
| 13 @class TabSwitcherHeaderView; |
| 14 |
| 15 @protocol TabSwitcherHeaderViewDelegate<NSObject> |
| 16 |
| 17 - (void)tabSwitcherHeaderViewDismiss:(TabSwitcherHeaderView*)view; |
| 18 - (void)tabSwitcherHeaderViewDidSelectSessionAtIndex:(NSInteger)index; |
| 19 // Called to get the currently selected panel index. Returns NSNotFound when no |
| 20 // panel is selected. |
| 21 - (NSInteger)tabSwitcherHeaderViewSelectedPanelIndex; |
| 22 |
| 23 @end |
| 24 |
| 25 @protocol TabSwitcherHeaderViewDataSource<NSObject> |
| 26 |
| 27 - (NSInteger)tabSwitcherHeaderViewSessionCount; |
| 28 - (SessionCellData*)sessionCellDataAtIndex:(NSUInteger)index; |
| 29 |
| 30 @end |
| 31 |
| 32 @interface TabSwitcherHeaderView : UIView |
| 33 |
| 34 @property(nonatomic, assign) id<TabSwitcherHeaderViewDelegate> delegate; |
| 35 @property(nonatomic, assign) id<TabSwitcherHeaderViewDataSource> dataSource; |
| 36 @property(nonatomic, readonly) UIView* dismissButton; |
| 37 |
| 38 // Selects the item at the specified index. |
| 39 // The delegate is not called. |
| 40 - (void)selectItemAtIndex:(NSInteger)index; |
| 41 |
| 42 // Reload the collection view. |
| 43 - (void)reloadData; |
| 44 |
| 45 // Performs an update on the header view using the passed block. |
| 46 - (void)performUpdate:(void (^)(TabSwitcherHeaderView* headerView))updateBlock; |
| 47 |
| 48 // Performs an update on the header view using the passed block, the completion |
| 49 // handler block is called at the end of the update animations. |
| 50 - (void)performUpdate:(void (^)(TabSwitcherHeaderView* headerView))updateBlock |
| 51 completion:(ProceduralBlock)completion; |
| 52 |
| 53 // Updates methods can only be called inside an update block passed to the |
| 54 // - (void)performUpdate: method. |
| 55 // Update methods takes arrays of NSNumbers. |
| 56 - (void)insertSessionsAtIndexes:(NSArray*)indexes; |
| 57 - (void)removeSessionsAtIndexes:(NSArray*)indexes; |
| 58 |
| 59 // Returns the accessibility title of the panel at index |index|. |
| 60 - (NSString*)panelTitleAtIndex:(NSInteger)index; |
| 61 |
| 62 @end |
| 63 |
| 64 #endif // IOS_CHROME_BROWSER_UI_TAB_SWITCHER_TAB_SWITCHER_HEADER_VIEW_H_ |
OLD | NEW |