OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef IOS_CHROME_BROWSER_UI_STACK_VIEW_CARD_SET_H_ | 5 #ifndef IOS_CHROME_BROWSER_UI_STACK_VIEW_CARD_SET_H_ |
6 #define IOS_CHROME_BROWSER_UI_STACK_VIEW_CARD_SET_H_ | 6 #define IOS_CHROME_BROWSER_UI_STACK_VIEW_CARD_SET_H_ |
7 | 7 |
8 #import <UIKit/UIKit.h> | 8 #import <UIKit/UIKit.h> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 // Manager for constructing a set of StackCards and displaying them in a view. | 46 // Manager for constructing a set of StackCards and displaying them in a view. |
47 @interface CardSet : NSObject | 47 @interface CardSet : NSObject |
48 // The layout manager for the set. | 48 // The layout manager for the set. |
49 // TODO(stuartmorgan): See if this can reasonably be internalized. | 49 // TODO(stuartmorgan): See if this can reasonably be internalized. |
50 @property(nonatomic, readonly) CardStackLayoutManager* stackModel; | 50 @property(nonatomic, readonly) CardStackLayoutManager* stackModel; |
51 // An array of StackCards in the same order as the tabs in the tab model. | 51 // An array of StackCards in the same order as the tabs in the tab model. |
52 @property(nonatomic, readonly) NSArray* cards; | 52 @property(nonatomic, readonly) NSArray* cards; |
53 // The card corresponding to the currently selected tab in the tab model. | 53 // The card corresponding to the currently selected tab in the tab model. |
54 // Setting this property will change the selection in the tab model. | 54 // Setting this property will change the selection in the tab model. |
55 @property(nonatomic, assign, readwrite) StackCard* currentCard; | 55 @property(nonatomic) StackCard* currentCard; |
56 // Set to the card that is currently animating closed, if any. | 56 // Set to the card that is currently animating closed, if any. |
57 @property(nonatomic, assign, readwrite) StackCard* closingCard; | 57 @property(nonatomic) StackCard* closingCard; |
58 // The view that cards should be displayed in. Changing the display view will | 58 // The view that cards should be displayed in. Changing the display view will |
59 // remove cards from the previous view, but they will not be re-displayed in the | 59 // remove cards from the previous view, but they will not be re-displayed in the |
60 // new view without a call to updateCardVisibilities. | 60 // new view without a call to updateCardVisibilities. |
61 @property(nonatomic, retain, readwrite) UIView* displayView; | 61 @property(nonatomic, strong, readwrite) UIView* displayView; |
62 // The side on which the close button should be displayed. | 62 // The side on which the close button should be displayed. |
63 @property(nonatomic, readonly) CardCloseButtonSide closeButtonSide; | 63 @property(nonatomic, readonly) CardCloseButtonSide closeButtonSide; |
64 // The object to be notified about addition and removal of cards. | 64 // The object to be notified about addition and removal of cards. |
65 @property(nonatomic, assign, readwrite) id<CardSetObserver> observer; | 65 @property(nonatomic, weak, readwrite) id<CardSetObserver> observer; |
66 // While YES, changes to the tab model will not affect the card stack. When | 66 // While YES, changes to the tab model will not affect the card stack. When |
67 // this is changed back to NO, the card stack will be completely rebuilt, so | 67 // this is changed back to NO, the card stack will be completely rebuilt, so |
68 // this should be used very carefully. | 68 // this should be used very carefully. |
69 @property(nonatomic, assign, readwrite) BOOL ignoresTabModelChanges; | 69 @property(nonatomic, assign, readwrite) BOOL ignoresTabModelChanges; |
70 // While set to YES, |updateCardVisibilities| will elide setting the views | 70 // While set to YES, |updateCardVisibilities| will elide setting the views |
71 // of covered cards to hidden. Setting to NO will trigger a call to | 71 // of covered cards to hidden. Setting to NO will trigger a call to |
72 // |updateCardVisibilities| to hide any covered views. Can be set to YES | 72 // |updateCardVisibilities| to hide any covered views. Can be set to YES |
73 // during animations to ensure that cards being animated to not-visible | 73 // during animations to ensure that cards being animated to not-visible |
74 // positions remain visible throughout the animation; should be set back to | 74 // positions remain visible throughout the animation; should be set back to |
75 // NO on the completion of such animations. Default value is NO. | 75 // NO on the completion of such animations. Default value is NO. |
76 @property(nonatomic, assign, readwrite) BOOL defersCardHiding; | 76 @property(nonatomic, assign, readwrite) BOOL defersCardHiding; |
77 // The maximum amount that the first card is allowed to overextend toward the | 77 // The maximum amount that the first card is allowed to overextend toward the |
78 // start or the end. | 78 // start or the end. |
79 @property(nonatomic, assign) CGFloat maximumOverextensionAmount; | 79 @property(nonatomic, assign) CGFloat maximumOverextensionAmount; |
80 // If set to YES, a card view is released once the corresponding card becomes | 80 // If set to YES, a card view is released once the corresponding card becomes |
81 // covered (it will be transparently reloaded if the card is uncovered), saving | 81 // covered (it will be transparently reloaded if the card is uncovered), saving |
82 // memory at the cost of potentially introducing jankiness. Default value is | 82 // memory at the cost of potentially introducing jankiness. Default value is |
83 // NO. Setting this property to YES causes views of covered cards to be | 83 // NO. Setting this property to YES causes views of covered cards to be |
84 // immediately released. | 84 // immediately released. |
85 @property(nonatomic, assign) BOOL keepOnlyVisibleCardViewsAlive; | 85 @property(nonatomic, assign) BOOL keepOnlyVisibleCardViewsAlive; |
86 | 86 |
87 // Initializes a card set backed by |model|. |model| is not retained, and must | 87 // Initializes a card set backed by |model|. |model| is not retained, and must |
88 // outlive the card set. | 88 // outlive the card set. |
89 - (id)initWithModel:(TabModel*)model; | 89 - (id)initWithModel:(TabModel*)model; |
90 | 90 |
| 91 // Tears down any observation or other state. After this method is called, the |
| 92 // receiver should be set to nil or otherwise marked for deallocation. |
| 93 - (void)disconnect; |
| 94 |
91 // The tab model backing the card set. | 95 // The tab model backing the card set. |
92 // TODO(stuartmorgan): See if this can reasonably be internalized. | 96 // TODO(stuartmorgan): See if this can reasonably be internalized. |
93 - (TabModel*)tabModel; | 97 - (TabModel*)tabModel; |
94 | 98 |
95 // Sets the tab model backing the card set. This should only be called when the | 99 // Sets the tab model backing the card set. This should only be called when the |
96 // TabModel will be deleted and replaced by a new one. When called both the | 100 // TabModel will be deleted and replaced by a new one. When called both the |
97 // current tab model and the new tab model must be either nil, or contain no | 101 // current tab model and the new tab model must be either nil, or contain no |
98 // tabs. | 102 // tabs. |
99 - (void)setTabModel:(TabModel*)tabModel; | 103 - (void)setTabModel:(TabModel*)tabModel; |
100 | 104 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 - (void)updateShadowLayout; | 226 - (void)updateShadowLayout; |
223 | 227 |
224 @end | 228 @end |
225 | 229 |
226 @interface CardSet (Testing) | 230 @interface CardSet (Testing) |
227 - (StackCard*)cardForTab:(Tab*)tab; | 231 - (StackCard*)cardForTab:(Tab*)tab; |
228 - (void)setStackModelForTesting:(CardStackLayoutManager*)stackModel; | 232 - (void)setStackModelForTesting:(CardStackLayoutManager*)stackModel; |
229 @end | 233 @end |
230 | 234 |
231 #endif // IOS_CHROME_BROWSER_UI_STACK_VIEW_CARD_SET_H_ | 235 #endif // IOS_CHROME_BROWSER_UI_STACK_VIEW_CARD_SET_H_ |
OLD | NEW |