This repository was archived by the owner on Aug 7, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRFUI.h
117 lines (96 loc) · 3.32 KB
/
RFUI.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
113
114
115
116
117
/*!
RFUI
Copyright (c) 2012-2014 BB9z
https://github.com/RFUI/Core
The MIT License (MIT)
http://www.opensource.org/licenses/mit-license.php
*/
#ifndef _RFUI_h
#define _RFUI_h
#import "RFKit.h"
#import "RFUIDebug.h"
#import "RFInitializing.h"
#import "RFUIInterfaceOrientationSupport.h"
#import "RFKeyboard.h"
typedef NS_ENUM(NSInteger, RFUIOrientation) {
RFUIOrientationVertical = 0,
RFUIOrientationHorizontal,
} ;
typedef struct {
float top;
float right;
float bottom;
float left;
} RFEdge;
DEPRECATED_ATTRIBUTE typedef RFEdge RFMargin;
DEPRECATED_ATTRIBUTE typedef RFEdge RFBorder;
DEPRECATED_ATTRIBUTE typedef RFEdge RFPadding;
// Default is 10x.
extern float RFUIDebugSlowAnimationsRatio;
/**
Creates an edge inset.
*/
CG_INLINE UIEdgeInsets UIEdgeInsetsMakeWithSameMargin(CGFloat margin) {
return (UIEdgeInsets){ .top = margin, .left = margin, .bottom = margin, .right = margin };
}
/**
Creats an reverse inset.
*/
CG_INLINE UIEdgeInsets UIEdgeInsetsReverse(UIEdgeInsets insets) {
return (UIEdgeInsets){ .top = -insets.top, .left = -insets.left, .bottom = -insets.bottom, .right = -insets.right };
}
// UIViewAutoresizing enum extend
extern NSUInteger const UIViewAutoresizingFlexibleSize;
extern NSUInteger const UIViewAutoresizingFlexibleMargin;
#pragma mark - DEPRECATED
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
bool RFEdgeEqualToEdge (RFEdge a, RFEdge b);
CG_INLINE bool RFMarginEqualToMargin(RFMargin a, RFMargin b) {
return RFEdgeEqualToEdge(a, b);
}
CG_INLINE bool RFPaddingEqualToPadding (RFBorder a, RFBorder b) {
return RFEdgeEqualToEdge(a, b);
}
CG_INLINE bool RFBorderEqualToBorder (RFPadding a, RFPadding b) {
return RFEdgeEqualToEdge(a, b);
}
RFEdge RFEdgeMake (float top, float right, float bottom, float left);
CG_INLINE RFMargin RFMarginMake (float top, float right, float bottom, float left) {
return RFEdgeMake(top, right, bottom, left);
}
CG_INLINE RFBorder RFBorderMake (float top, float right, float bottom, float left) {
return RFEdgeMake(top, right, bottom, left);
}
CG_INLINE RFPadding RFPaddingMake (float top, float right, float bottom, float left) {
return RFEdgeMake(top, right, bottom, left);
}
RFEdge RFEdgeMakeWithRects (CGRect outterRect, CGRect innerRect);
CG_INLINE RFMargin RFMarginMakeWithRects (CGRect outterRect, CGRect innerRect) {
return RFEdgeMakeWithRects(outterRect, innerRect);
}
CG_INLINE RFBorder RFBorderMakeWithRects (CGRect outterRect, CGRect innerRect) {
return RFEdgeMakeWithRects(outterRect, innerRect);
}
CG_INLINE RFPadding RFPaddingMakeWithRects (CGRect outterRect, CGRect innerRect) {
return RFEdgeMakeWithRects(outterRect, innerRect);
}
CG_INLINE RFEdge RFEdgeMakeWithFloat (float edge) {
return RFEdgeMake(edge, edge, edge, edge);
}
CG_INLINE RFMargin RFMarginMakeWithFloat (float edge) {
return RFEdgeMake(edge, edge, edge, edge);
}
CG_INLINE RFBorder RFBorderMakeWithFloat (float edge) {
return RFEdgeMake(edge, edge, edge, edge);
}
CG_INLINE RFPadding RFPaddingMakeWithFloat (float edge) {
return RFEdgeMake(edge, edge, edge, edge);
}
CGRect RFPaddingInsetContentFrameForRect (CGRect boxFrame , RFPadding padding);
extern const RFEdge RFEdgeZero;
extern const RFMargin RFMarginZero;
extern const RFBorder RFBorderZero;
extern const RFPadding RFPaddingZero;
#pragma clang diagnostic pop
#endif