-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCLCascadeView.h
executable file
·112 lines (85 loc) · 3.36 KB
/
CLCascadeView.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
//
// CLCascadeView.h
// Cascade
//
// Created by Emil Wojtaszek on 11-05-26.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "CLScrollView.h"
@protocol CLCascadeViewDataSource;
@protocol CLCascadeViewDelegate;
@interface CLCascadeView : UIView <UIScrollViewDelegate> {
// delegate and dataSource
id<CLCascadeViewDelegate> __unsafe_unretained _delegate;
id<CLCascadeViewDataSource> __unsafe_unretained _dataSource;
// scroll view
CLScrollView* _scrollView;
// contain all pages, if page is unloaded then page is respresented as [NSNull null]
NSMutableArray* _pages;
//sizes
CGFloat _pageWidth;
CGFloat _leftInset;
CGFloat _widerLeftInset;
BOOL _pullToDetachPages;
@private
struct {
unsigned int willDetachPages:1;
unsigned int isDetachPages:1;
unsigned int hasWiderPage:1;
} _flags;
NSInteger _indexOfFirstVisiblePage;
NSInteger _indexOfLastVisiblePage;
}
@property(nonatomic, unsafe_unretained) id<CLCascadeViewDelegate> delegate;
@property(nonatomic, unsafe_unretained) id<CLCascadeViewDataSource> dataSource;
/*
* Left inset of normal page from left boarder. Default 58.0f
* If you change this property, width of page will change
*/
@property(nonatomic) CGFloat leftInset;
/*
* Left inset of wider page from left boarder. Default 220.0f
*/
@property(nonatomic) CGFloat widerLeftInset;
/*
* If YES, then pull to detach pages is enabled, default YES
*/
@property(nonatomic, assign) BOOL pullToDetachPages;
- (void) pushPage:(UIView*)newPage fromPage:(UIView*)fromPage animated:(BOOL)animated;
- (void) popPageAtIndex:(NSInteger)index animated:(BOOL)animated;
- (void) popAllPagesAnimated:(BOOL)animated;
- (UIView*) loadPageAtIndex:(NSInteger)index;
// unload pages which are not visible
- (void) unloadInvisiblePages;
- (NSInteger) indexOfFirstVisibleView:(BOOL)loadIfNeeded;
- (NSInteger) indexOfLastVisibleView:(BOOL)loadIfNeeded;
- (NSArray*) visiblePages;
- (void) updateContentLayoutToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration;
- (BOOL) canPopPageAtIndex:(NSInteger)index; // @dodikk
@end
@protocol CLCascadeViewDataSource <NSObject>
@required
- (UIView*) cascadeView:(CLCascadeView*)cascadeView pageAtIndex:(NSInteger)index;
- (NSInteger) numberOfPagesInCascadeView:(CLCascadeView*)cascadeView;
@end
@protocol CLCascadeViewDelegate <NSObject>
@optional
- (void) cascadeView:(CLCascadeView*)cascadeView didLoadPage:(UIView*)page;
- (void) cascadeView:(CLCascadeView*)cascadeView didUnloadPage:(UIView*)page;
- (void) cascadeView:(CLCascadeView*)cascadeView didAddPage:(UIView*)page animated:(BOOL)animated;
- (void) cascadeView:(CLCascadeView*)cascadeView didPopPageAtIndex:(NSInteger)index;
/*
* Called when page will be unveiled by another page or will slide in CascadeView bounds
*/
- (void) cascadeView:(CLCascadeView*)cascadeView pageDidAppearAtIndex:(NSInteger)index;
/*
* Called when page will be shadowed by another page or will slide out CascadeView bounds
*/
- (void) cascadeView:(CLCascadeView*)cascadeView pageDidDisappearAtIndex:(NSInteger)index;
/*
*/
- (void) cascadeViewDidStartPullingToDetachPages:(CLCascadeView*)cascadeView;
- (void) cascadeViewDidPullToDetachPages:(CLCascadeView*)cascadeView;
- (void) cascadeViewDidCancelPullToDetachPages:(CLCascadeView*)cascadeView;
@end