-
Notifications
You must be signed in to change notification settings - Fork 4
/
STKGroupLayout.h
55 lines (40 loc) · 2.46 KB
/
STKGroupLayout.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
#import <Foundation/Foundation.h>
#import "STKConstants.h"
FOUNDATION_EXPORT NSString * const STKPositionTopKey;
FOUNDATION_EXPORT NSString * const STKPositionBottomKey;
FOUNDATION_EXPORT NSString * const STKPositionLeftKey;
FOUNDATION_EXPORT NSString * const STKPositionRightKey;
FOUNDATION_EXPORT NSString * const STKPositionUnknownKey;
FOUNDATION_EXPORT NSString * NSStringFromLayoutPosition(STKLayoutPosition position);
#define STKPositionIsVertical(_pos) (_pos == STKPositionTop || _pos == STKPositionBottom)
#define STKPositionIsHorizontal(_pos) (_pos == STKPositionLeft || _pos == STKPositionRight)
@class SBIcon;
@interface STKGroupLayout : NSObject <NSFastEnumeration>
// Init using dictionary of an array of identifiers for every layout position.
- (instancetype)initWithIdentifierDictionary:(NSDictionary *)dictionary;
// Init using dictionary of an array of icons for every layout position
- (instancetype)initWithIconDictionary:(NSDictionary *)dictionary;
- (instancetype)initWithIconsAtTop:(NSArray *)topIcons bottom:(NSArray *)bottomIcons left:(NSArray *)leftIcons right:(NSArray *)rightIcons;
+ (instancetype)layoutWithIconsAtTop:(NSArray *)topIcons bottom:(NSArray *)bottomIcons left:(NSArray *)leftIcons right:(NSArray *)rightIcons;
- (NSDictionary *)identifierDictionary;
- (NSDictionary *)iconDictionary;
@property (nonatomic, readonly) NSArray *topIcons;
@property (nonatomic, readonly) NSArray *bottomIcons;
@property (nonatomic, readonly) NSArray *leftIcons;
@property (nonatomic, readonly) NSArray *rightIcons;
- (NSArray *)allIcons;
// Use syntactic sugar to get the icons you need
// layout[STKLayoutPositionTop]
- (id)objectAtIndexedSubscript:(STKLayoutPosition)position;
- (void)setObject:(id)icons atIndexedSubscript:(STKLayoutPosition)position;
- (id)iconInSlot:(STKGroupSlot)slot;
- (void)setIcon:(id)icon inSlot:(STKGroupSlot)slot;
- (STKGroupSlot)slotForIcon:(id)icon;
- (void)addIcons:(NSArray *)icons toIconsAtPosition:(STKLayoutPosition)position;
- (void)addIcon:(id)icon toIconsAtPosition:(STKLayoutPosition)position;
- (void)addIcon:(id)icon toIconsAtPosition:(STKLayoutPosition)position atIndex:(NSUInteger)idx;
- (void)removeIcon:(id)icon fromIconsAtPosition:(STKLayoutPosition)position;
- (void)removeIcons:(NSArray *)icons fromIconsAtPosition:(STKLayoutPosition)position;
- (BOOL)containsIcon:(id)icon;
- (void)enumerateIconsUsingBlockWithIndexes:(void(^)(id icon, STKLayoutPosition position, NSArray *currentArray, NSUInteger index, BOOL *stop))block;
@end