OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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_SETTINGS_SETTINGS_ROOT_COLLECTION_VIEW_CONTROLLER_
H_ |
| 6 #define IOS_CHROME_BROWSER_UI_SETTINGS_SETTINGS_ROOT_COLLECTION_VIEW_CONTROLLER_
H_ |
| 7 |
| 8 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_footer_item
.h" |
| 9 #import "ios/chrome/browser/ui/collection_view/collection_view_controller.h" |
| 10 |
| 11 // Root class for collection view controllers in settings. |
| 12 @interface SettingsRootCollectionViewController |
| 13 : CollectionViewController<CollectionViewFooterLinkDelegate> |
| 14 |
| 15 // Creates an autoreleased Edit button for the collection view. Calls |
| 16 // |editButtonEnabled| to determine if the button should be enabled. |
| 17 - (UIBarButtonItem*)createEditButton; |
| 18 |
| 19 // Creates an autoreleased Done button for the collection view's edit state. |
| 20 - (UIBarButtonItem*)createEditDoneButton; |
| 21 |
| 22 // Updates the edit or done button to reflect editing state. If the |
| 23 // collectionView is not in edit mode (and thus showing the 'Done' button), it |
| 24 // calls the above two functions to determine the existence and state of an edit |
| 25 // button. |
| 26 - (void)updateEditButton; |
| 27 |
| 28 // Reloads the collection view model with |loadModel| and then reloads the |
| 29 // collection view data. This class calls this method in |viewWillAppear:|. |
| 30 - (void)reloadData; |
| 31 |
| 32 // Whether this collection view controller should hide the "Done" button (the |
| 33 // right navigation bar button). Default is NO. |
| 34 @property(nonatomic, assign) BOOL shouldHideDoneButton; |
| 35 |
| 36 // The collection view accessibility identifier to be set on |viewDidLoad|. |
| 37 @property(nonatomic, copy) NSString* collectionViewAccessibilityIdentifier; |
| 38 |
| 39 @end |
| 40 |
| 41 // Subclasses of SettingsRootCollectionViewController should implement the |
| 42 // following methods to customize the behavior. |
| 43 @interface SettingsRootCollectionViewController (Subclassing) |
| 44 |
| 45 // Returns NO. Subclasses should overload this if an edit button is required. |
| 46 - (BOOL)shouldShowEditButton; |
| 47 |
| 48 // Returns NO. Subclasses should overload this if the edit button should be |
| 49 // enabled. |
| 50 - (BOOL)editButtonEnabled; |
| 51 |
| 52 // Notifies the view controller that the edit button has been tapped. If you |
| 53 // override this method, you must call -[super editButtonPressed] at some point |
| 54 // in your implementation. |
| 55 // |
| 56 // Note that this method calls -[self setEditing:] in order to change the |
| 57 // editing mode of this controller. |
| 58 - (void)editButtonPressed; |
| 59 |
| 60 // Prevents user interaction until |-allowUserInteraction| is called by doing |
| 61 // the following: |
| 62 // * Disables user interaction with the navigation bar. |
| 63 // * Replaces the done button with an activity indicator. |
| 64 // * Covers the collection view with a transparent veil. |
| 65 - (void)preventUserInteraction; |
| 66 |
| 67 // Allows user interaction: |
| 68 // * Enables user interaction with the navigation bar. |
| 69 // * Restores the done button. |
| 70 // * Removes the transparent veil. |
| 71 - (void)allowUserInteraction; |
| 72 |
| 73 @end |
| 74 |
| 75 #endif // IOS_CHROME_BROWSER_UI_SETTINGS_SETTINGS_ROOT_COLLECTION_VIEW_CONTROLL
ER_H_ |
OLD | NEW |