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_BOOKMARKS_BOOKMARK_FOLDER_VIEW_CONTROLLER_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_FOLDER_VIEW_CONTROLLER_H_ |
| 7 |
| 8 #import <UIKit/UIKit.h> |
| 9 #include <set> |
| 10 |
| 11 @class BookmarkFolderViewController; |
| 12 namespace bookmarks { |
| 13 class BookmarkModel; |
| 14 class BookmarkNode; |
| 15 } // namespace bookmarks |
| 16 |
| 17 @protocol BookmarkFolderViewControllerDelegate |
| 18 // Called when a bookmark folder is selected. |folder| is the newly selected |
| 19 // folder. |
| 20 - (void)folderPicker:(BookmarkFolderViewController*)folderPicker |
| 21 didFinishWithFolder:(const bookmarks::BookmarkNode*)folder; |
| 22 // Called when the user is done with the picker, either by tapping the Cancel or |
| 23 // the Back button. |
| 24 - (void)folderPickerDidCancel:(BookmarkFolderViewController*)folderPicker; |
| 25 @end |
| 26 |
| 27 // A folder selector view controller. |
| 28 // |
| 29 // This controller monitors the state of the bookmark model, so changes to the |
| 30 // bookmark model can affect this controller's state. |
| 31 // The bookmark model is assumed to be loaded, thus also not to be NULL. |
| 32 @interface BookmarkFolderViewController : UIViewController |
| 33 |
| 34 @property(nonatomic, assign) id<BookmarkFolderViewControllerDelegate> delegate; |
| 35 |
| 36 // The current nodes (bookmarks or folders) that are considered for a move. |
| 37 @property(nonatomic, assign, readonly) |
| 38 const std::set<const bookmarks::BookmarkNode*>& editedNodes; |
| 39 |
| 40 // Initializes the view controller with a bookmarks model. |allowsNewFolders| |
| 41 // will instruct the controller to provide the necessary UI to create a folder. |
| 42 // |bookmarkModel| must not be NULL and must be loaded. |
| 43 // |editedNodes| affects which cells can be selected, since it is not possible |
| 44 // to move a node into its subnode. |
| 45 // |allowsCancel| puts a cancel and done button in the navigation bar instead of |
| 46 // a back button, which is needed if this view controller is presented modally. |
| 47 - (instancetype) |
| 48 initWithBookmarkModel:(bookmarks::BookmarkModel*)bookmarkModel |
| 49 allowsNewFolders:(BOOL)allowsNewFolders |
| 50 editedNodes:(const std::set<const bookmarks::BookmarkNode*>&)nodes |
| 51 allowsCancel:(BOOL)allowsCancel |
| 52 selectedFolder:(const bookmarks::BookmarkNode*)selectedFolder; |
| 53 |
| 54 // This method changes the currently selected folder and updates the UI. The |
| 55 // delegate is not notified of the change. |
| 56 - (void)changeSelectedFolder:(const bookmarks::BookmarkNode*)selectedFolder; |
| 57 |
| 58 #pragma mark UIScrollViewDelegate |
| 59 |
| 60 // Updates the MDCAppBar with changes to the collection view scroll state. Must |
| 61 // be called by subclasses if they override this method in order to maintain |
| 62 // this functionality. |
| 63 - (void)scrollViewDidScroll:(UIScrollView*)scrollView NS_REQUIRES_SUPER; |
| 64 |
| 65 // Updates the MDCAppBar with changes to the collection view scroll state. Must |
| 66 // be called by subclasses if they override this method in order to maintain |
| 67 // this functionality. |
| 68 - (void)scrollViewDidEndDragging:(UIScrollView*)scrollView |
| 69 willDecelerate:(BOOL)decelerate NS_REQUIRES_SUPER; |
| 70 |
| 71 // Updates the MDCAppBar with changes to the collection view scroll state. Must |
| 72 // be called by subclasses if they override this method in order to maintain |
| 73 // this functionality. |
| 74 - (void)scrollViewDidEndDecelerating:(UIScrollView*)scrollView |
| 75 NS_REQUIRES_SUPER; |
| 76 |
| 77 // Updates the MDCAppBar with changes to the collection view scroll state. Must |
| 78 // be called by subclasses if they override this method in order to maintain |
| 79 // this functionality. |
| 80 - (void)scrollViewWillEndDragging:(UIScrollView*)scrollView |
| 81 withVelocity:(CGPoint)velocity |
| 82 targetContentOffset:(inout CGPoint*)targetContentOffset |
| 83 NS_REQUIRES_SUPER; |
| 84 |
| 85 @end |
| 86 |
| 87 #endif // IOS_CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_FOLDER_VIEW_CONTROLLER_H_ |
OLD | NEW |