This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Doric/iOS/Pod/Classes/Shader/DoricViewContainer.h

87 lines
1.7 KiB
C
Raw Normal View History

2019-07-30 19:07:46 +08:00
//
// DoricViewContainer.h
// Doric
//
// Created by pengfei.zhou on 2019/7/30.
//
#import "UIView+Doric.h"
2019-10-12 14:48:19 +08:00
typedef NS_ENUM(NSInteger, DoricGravity) {
2019-07-30 19:07:46 +08:00
SPECIFIED = 1,
START = 1 << 1,
END = 1 << 2,
SHIFT_X = 0,
SHIFT_Y = 4,
LEFT = (START | SPECIFIED) << SHIFT_X,
RIGHT = (END | SPECIFIED) << SHIFT_X,
TOP = (START | SPECIFIED) << SHIFT_Y,
BOTTOM = (END | SPECIFIED) << SHIFT_Y,
CENTER_X = SPECIFIED << SHIFT_X,
CENTER_Y = SPECIFIED << SHIFT_Y,
CENTER = CENTER_X | CENTER_Y,
};
2019-10-12 14:48:19 +08:00
typedef NS_ENUM(NSInteger, DoricLayoutDesc) {
2019-07-31 17:43:26 +08:00
LAYOUT_ABSOLUTE = 0,
2019-07-31 14:18:20 +08:00
LAYOUT_MATCH_PARENT = -1,
LAYOUT_WRAP_CONTENT = -2,
};
2019-07-30 19:07:46 +08:00
NS_ASSUME_NONNULL_BEGIN
2019-10-12 14:48:19 +08:00
@interface DoricRect : NSObject
@property(nonatomic) CGFloat left;
@property(nonatomic) CGFloat right;
@property(nonatomic) CGFloat top;
@property(nonatomic) CGFloat bottom;
2019-07-30 19:07:46 +08:00
@end
@interface LayoutParams : NSObject
2019-10-12 14:48:19 +08:00
@property(nonatomic) DoricLayoutDesc width;
@property(nonatomic) DoricLayoutDesc height;
2019-07-31 17:43:26 +08:00
@end
@interface MarginLayoutParams : LayoutParams
2019-10-12 14:48:19 +08:00
@property(nonatomic, strong) DoricRect *margin;
2019-07-30 19:07:46 +08:00
@end
2019-07-31 17:43:26 +08:00
@interface StackLayoutParams : LayoutParams
2019-10-12 14:48:19 +08:00
@property(nonatomic) DoricGravity alignment;
2019-07-31 17:43:26 +08:00
@end
@interface VHLayoutParams : MarginLayoutParams
2019-10-12 14:48:19 +08:00
@property(nonatomic) DoricGravity alignment;
@property(nonatomic) NSInteger weight;
2019-07-31 17:43:26 +08:00
@end
2019-10-12 14:48:19 +08:00
@interface UIView (DoricContainer)
2019-07-30 19:07:46 +08:00
2019-10-12 14:48:19 +08:00
@property(nonatomic, strong) LayoutParams *layoutParams;
2019-07-30 19:07:46 +08:00
2019-10-12 14:48:19 +08:00
- (void)layout;
2019-07-30 19:07:46 +08:00
2019-10-12 14:48:19 +08:00
- (void)measure;
2019-07-30 19:07:46 +08:00
@end
@interface Stack : UIView
2019-10-12 14:48:19 +08:00
@property(nonatomic) DoricGravity gravity;
2019-07-30 19:07:46 +08:00
@end
2019-07-30 21:05:27 +08:00
@interface LinearLayout : UIView
2019-10-12 14:48:19 +08:00
@property(nonatomic) DoricGravity gravity;
@property(nonatomic) CGFloat space;
2019-07-30 19:07:46 +08:00
@end
2019-07-30 21:05:27 +08:00
@interface VLayout : LinearLayout
@end
@interface HLayout : LinearLayout
2019-07-30 19:07:46 +08:00
@end
NS_ASSUME_NONNULL_END