session-ios/Signal/src/ViewControllers/ConversationView/ConversationViewLayout.h

44 lines
1.1 KiB
C
Raw Normal View History

2017-10-10 22:13:54 +02:00
//
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
//
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSInteger, ConversationViewLayoutAlignment) {
2017-10-11 15:58:20 +02:00
// We use incoming/outgoing, not left/right to support RTL.
2017-10-10 22:13:54 +02:00
ConversationViewLayoutAlignment_Incoming,
ConversationViewLayoutAlignment_Outgoing,
ConversationViewLayoutAlignment_FullWidth,
ConversationViewLayoutAlignment_Center,
};
@protocol ConversationViewLayoutItem <NSObject>
2017-10-11 15:44:10 +02:00
- (CGSize)cellSizeForViewWidth:(int)viewWidth contentWidth:(int)contentWidth;
2017-10-10 22:13:54 +02:00
- (ConversationViewLayoutAlignment)layoutAlignment;
@end
#pragma mark -
@protocol ConversationViewLayoutDelegate <NSObject>
- (NSArray<id<ConversationViewLayoutItem>> *)layoutItems;
@end
#pragma mark -
2017-10-11 15:58:20 +02:00
// A new lean and efficient layout for conversation view designed to
// handle our edge cases (e.g. full-width unread indicators, etc.).
2017-10-10 22:13:54 +02:00
@interface ConversationViewLayout : UICollectionViewLayout
@property (nonatomic, weak) id<ConversationViewLayoutDelegate> delegate;
@property (nonatomic, readonly) int contentWidth;
2017-10-10 22:13:54 +02:00
@end
NS_ASSUME_NONNULL_END