forked from unoplatform/uno
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathViewPositionExtensions.iOS.cs
More file actions
138 lines (117 loc) · 3.76 KB
/
Copy pathViewPositionExtensions.iOS.cs
File metadata and controls
138 lines (117 loc) · 3.76 KB
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
using System.Drawing;
#if XAMARIN_IOS_UNIFIED
using UIKit;
using CoreGraphics;
using System;
#elif XAMARIN_IOS
using MonoTouch.UIKit;
using CGRect = System.Drawing.RectangleF;
using nfloat = System.Single;
using CGPoint = System.Drawing.PointF;
#endif
namespace Uno.UI.Extensions
{
public static class UIViewPositioningExtensions
{
public static T IncrementX<T>(this T thisView, float delta) where T : UIView
{
thisView.Frame = thisView.Frame.IncrementX((nfloat)delta);
return thisView;
}
public static T IncrementY<T>(this T thisView, float delta) where T : UIView
{
thisView.Frame = thisView.Frame.IncrementY((nfloat)delta);
return thisView;
}
public static T SetX<T>(this T thisView, double value) where T : UIView
{
return thisView.SetX((float)value);
}
public static T SetX<T>(this T thisView, float value) where T : UIView
{
thisView.Frame = thisView.Frame.SetX((nfloat)value);
return thisView;
}
public static T SetRight<T>(this T thisView, float value) where T : UIView
{
thisView.Frame = thisView.Frame.SetRight((nfloat)value);
return thisView;
}
public static T SetRightRespectWidth<T>(this T thisView, float value) where T : UIView
{
thisView.Frame = thisView.Frame.SetRightRespectWidth((nfloat)value);
return thisView;
}
public static T SetVerticalCenter<T>(this T thisView, float value) where T : UIView
{
thisView.Frame = thisView.Frame.SetVerticalCenter((nfloat)value);
return thisView;
}
public static T SetHorizontalCenter<T>(this T thisView, float value) where T : UIView
{
thisView.Frame = thisView.Frame.SetHorizontalCenter((nfloat)value);
return thisView;
}
public static T SetY<T>(this T thisView, nfloat value) where T : UIView
{
thisView.Frame = thisView.Frame.SetY(value);
return thisView;
}
public static T SetY<T>(this T thisView, double value) where T : UIView
{
return thisView.SetY((float)value);
}
public static T SetBottom<T>(this T thisView, float value) where T : UIView
{
thisView.Frame = thisView.Frame.SetBottom((nfloat)value);
return thisView;
}
public static T IncrementHeight<T>(this T thisView, float delta) where T : UIView
{
thisView.Frame = thisView.Frame.IncrementHeight((nfloat)delta);
return thisView;
}
public static T IncrementWidth<T>(this T thisView, float delta) where T : UIView
{
thisView.Frame = thisView.Frame.IncrementWidth((nfloat)delta);
return thisView;
}
public static T SetWidth<T>(this T thisView, float value) where T : UIView
{
thisView.Frame = thisView.Frame.SetWidth((nfloat)value);
return thisView;
}
public static T SetWidth<T>(this T thisView, double value) where T : UIView
{
return thisView.SetWidth((float)value);
}
public static T SetHeight<T>(this T thisView, float value) where T : UIView
{
thisView.Frame = thisView.Frame.Copy().SetHeight((nfloat)value);
return thisView;
}
public static T SetHeight<T>(this T thisView, double value) where T : UIView
{
return thisView.SetHeight((float)value);
}
public static T SetSize<T>(this T thisView, SizeF value) where T : UIView
{
thisView.Frame = new CGRect(thisView.Frame.X, thisView.Frame.Y, value.Width, value.Height);
return thisView;
}
public static T SetSize<T>(this T thisView, float width, float height) where T : UIView
{
thisView.Frame = new CGRect(thisView.Frame.X, thisView.Frame.Y, width, height);
return thisView;
}
public static T SetFrame<T>(this T thisView, RectangleF frame) where T : UIView
{
return thisView.SetFrame(frame.X, frame.Y, frame.Width, frame.Height);
}
public static T SetFrame<T>(this T thisView, float x, float y, float width, float height) where T : UIView
{
thisView.Frame = new RectangleF(x, y, width, height);
return thisView;
}
}
}