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

88 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"
typedef NS_ENUM(NSInteger,DoricGravity) {
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-07-31 14:18:20 +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
@interface DoricRect :NSObject
@property (nonatomic) CGFloat left;
@property (nonatomic) CGFloat right;
@property (nonatomic) CGFloat top;
@property (nonatomic) CGFloat bottom;
@end
2019-07-31 14:18:20 +08:00
2019-07-30 19:07:46 +08:00
@interface LayoutParams : NSObject
2019-07-31 14:18:20 +08:00
@property (nonatomic) DoricLayoutDesc width;
@property (nonatomic) DoricLayoutDesc height;
2019-07-31 17:43:26 +08:00
@end
@interface MarginLayoutParams : LayoutParams
2019-07-30 19:07:46 +08:00
@property (nonatomic,strong) DoricRect *margin;
@end
2019-07-31 17:43:26 +08:00
@interface StackLayoutParams : LayoutParams
@property (nonatomic) DoricGravity alignment;
@end
@interface VHLayoutParams : MarginLayoutParams
@property (nonatomic) DoricGravity alignment;
@property (nonatomic) NSInteger weight;
@end
2019-07-30 19:07:46 +08:00
@interface UIView(DoricContainer)
@property (nonatomic,strong) LayoutParams *layoutParams;
- (void) layout;
- (void) measure;
@end
@interface Stack : UIView
@property (nonatomic) DoricGravity gravity;
@end
2019-07-30 21:05:27 +08:00
@interface LinearLayout : UIView
2019-07-30 19:07:46 +08:00
@property (nonatomic) DoricGravity gravity;
@property (nonatomic) CGFloat space;
@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