|
4 | 4 | // |
5 | 5 | // Created by AnAn on 2024/11/5. |
6 | 6 | // Copyright © 2024 An An. All rights reserved. |
7 | | -// |
| 7 | +//*************** ...... SOURCE CODE ...... *************** |
| 8 | +//***...................................................*** |
| 9 | +//*** https://github.com/AAChartModel/AAChartKit *** |
| 10 | +//*** https://github.com/AAChartModel/AAChartKit-Swift *** |
| 11 | +//***...................................................*** |
| 12 | +//*************** ...... SOURCE CODE ...... *************** |
8 | 13 |
|
9 | | -/** |
10 | | - buttonTheme:{ |
11 | | - fill:#f7f7f7 |
12 | | - padding:8 |
13 | | - r:2 |
14 | | - states:{ |
15 | | - disabled:{ |
16 | | - style:{ |
17 | | - color:#cccccc |
18 | | - } |
19 | | - } |
20 | | - hover:{ |
21 | | - fill:#e6e6e6 |
22 | | - } |
23 | | - select:{ |
24 | | - fill:#e6e9ff |
25 | | - style:{ |
26 | | - color:#000000 |
27 | | - fontWeight:bold |
28 | | - } |
29 | | - } |
30 | | - } |
31 | | - stroke:#cccccc |
32 | | - stroke-width:1 |
33 | | - style:{ |
34 | | - color:#333333 |
35 | | - cursor:pointer |
36 | | - fontSize:0.8em |
37 | | - fontWeight:normal |
38 | | - } |
39 | | - } |
| 14 | +/* |
| 15 | + |
| 16 | + * ------------------------------------------------------------------------------- |
| 17 | + * |
| 18 | + * 🌕 🌖 🌗 🌘 ❀❀❀ WARM TIPS!!! ❀❀❀ 🌑 🌒 🌓 🌔 |
| 19 | + * |
| 20 | + * Please contact me on GitHub,if there are any problems encountered in use. |
| 21 | + * GitHub Issues : https://github.com/AAChartModel/AAChartKit-Swift/issues |
| 22 | + * ------------------------------------------------------------------------------- |
| 23 | + * And if you want to contribute for this project, please contact me as well |
| 24 | + * GitHub : https://github.com/AAChartModel |
| 25 | + * StackOverflow : https://stackoverflow.com/users/12302132/codeforu |
| 26 | + * JianShu : https://www.jianshu.com/u/f1e6753d4254 |
| 27 | + * SegmentFault : https://segmentfault.com/u/huanghunbieguan |
| 28 | + * |
| 29 | + * ------------------------------------------------------------------------------- |
| 30 | + |
40 | 31 | */ |
41 | | -public class AAButtonThemeStatesDisabled: AAObject { |
| 32 | + |
| 33 | +//https://api.highcharts.com/highcharts/global.buttonTheme |
| 34 | +public class AAButtonTheme: AAObject { |
| 35 | + public var fill: String? |
| 36 | + public var padding: Float? |
| 37 | + public var r: Float? |
| 38 | + public var states: AAButtonThemeStates? |
| 39 | + public var stroke: String? |
| 40 | + public var strokeWidth: Float? |
42 | 41 | public var style: AAStyle? |
43 | | - |
| 42 | + |
44 | 43 | @discardableResult |
45 | | - public func style(_ prop: AAStyle?) -> AAButtonThemeStatesDisabled { |
46 | | - style = prop |
| 44 | + public func fill(_ prop: String?) -> AAButtonTheme { |
| 45 | + fill = prop |
47 | 46 | return self |
48 | 47 | } |
49 | 48 |
|
50 | | - public override init() { |
51 | | - |
| 49 | + @discardableResult |
| 50 | + public func padding(_ prop: Float?) -> AAButtonTheme { |
| 51 | + padding = prop |
| 52 | + return self |
52 | 53 | } |
53 | | -} |
54 | | - |
55 | | -public class AAButtonThemeStatesHover: AAObject { |
56 | | - public var fill: String? |
57 | | - public var style: AAStyle? |
58 | 54 |
|
59 | 55 | @discardableResult |
60 | | - public func fill(_ prop: String?) -> AAButtonThemeStatesHover { |
61 | | - fill = prop |
| 56 | + public func r(_ prop: Float?) -> AAButtonTheme { |
| 57 | + r = prop |
62 | 58 | return self |
63 | 59 | } |
64 | 60 |
|
65 | 61 | @discardableResult |
66 | | - public func style(_ prop: AAStyle?) -> AAButtonThemeStatesHover { |
67 | | - style = prop |
| 62 | + public func states(_ prop: AAButtonThemeStates?) -> AAButtonTheme { |
| 63 | + states = prop |
68 | 64 | return self |
69 | 65 | } |
70 | 66 |
|
71 | | - public override init() { |
72 | | - |
| 67 | + @discardableResult |
| 68 | + public func stroke(_ prop: String?) -> AAButtonTheme { |
| 69 | + stroke = prop |
| 70 | + return self |
73 | 71 | } |
74 | | -} |
75 | | - |
76 | | -public class AAButtonThemeStatesSelect: AAObject { |
77 | | - public var fill: String? |
78 | | - public var style: AAStyle? |
79 | 72 |
|
80 | 73 | @discardableResult |
81 | | - public func fill(_ prop: String?) -> AAButtonThemeStatesSelect { |
82 | | - fill = prop |
| 74 | + public func strokeWidth(_ prop: Float?) -> AAButtonTheme { |
| 75 | + strokeWidth = prop |
83 | 76 | return self |
84 | 77 | } |
85 | 78 |
|
86 | 79 | @discardableResult |
87 | | - public func style(_ prop: AAStyle?) -> AAButtonThemeStatesSelect { |
| 80 | + public func style(_ prop: AAStyle?) -> AAButtonTheme { |
88 | 81 | style = prop |
89 | 82 | return self |
90 | 83 | } |
91 | 84 |
|
92 | | - public override init() { |
93 | | - |
| 85 | + public func toDictionaryProp() -> [String: Any]? { |
| 86 | + var dic = [String: Any]() |
| 87 | + if let fill = fill { |
| 88 | + dic["fill"] = fill |
| 89 | + } |
| 90 | + if let padding = padding { |
| 91 | + dic["padding"] = padding |
| 92 | + } |
| 93 | + if let r = r { |
| 94 | + dic["r"] = r |
| 95 | + } |
| 96 | + if let states = states { |
| 97 | + dic["states"] = states.toDic() as Any |
| 98 | + } |
| 99 | + if let stroke = stroke { |
| 100 | + dic["stroke"] = stroke |
| 101 | + } |
| 102 | + if let strokeWidth = strokeWidth { |
| 103 | + dic["stroke-width"] = strokeWidth |
| 104 | + } |
| 105 | + if let style = style { |
| 106 | + dic["style"] = style.toDic() as Any |
| 107 | + } |
| 108 | + return dic |
94 | 109 | } |
95 | | -} |
96 | 110 |
|
| 111 | + public override init() { |
97 | 112 |
|
| 113 | + } |
| 114 | +} |
98 | 115 |
|
99 | 116 |
|
100 | | - |
101 | | - |
102 | | - |
103 | 117 | public class AAButtonThemeStates: AAObject { |
104 | 118 | public var disabled: AAButtonThemeStatesDisabled? |
105 | 119 | public var hover: AAButtonThemeStatesHover? |
@@ -129,100 +143,58 @@ public class AAButtonThemeStates: AAObject { |
129 | 143 | } |
130 | 144 |
|
131 | 145 |
|
132 | | -//https://api.highcharts.com/highcharts/global.buttonTheme |
133 | | -public class AAButtonTheme: AAObject { |
134 | | - public var fill: String? |
135 | | - public var padding: Float? |
136 | | - public var r: Float? |
137 | | - public var states: AAButtonThemeStates? |
138 | | - public var stroke: String? |
139 | | - public var strokeWidth: Float? |
| 146 | +public class AAButtonThemeStatesDisabled: AAObject { |
140 | 147 | public var style: AAStyle? |
141 | | - |
| 148 | + |
142 | 149 | @discardableResult |
143 | | - public func fill(_ prop: String?) -> AAButtonTheme { |
144 | | - fill = prop |
| 150 | + public func style(_ prop: AAStyle?) -> AAButtonThemeStatesDisabled { |
| 151 | + style = prop |
145 | 152 | return self |
146 | 153 | } |
147 | 154 |
|
148 | | - @discardableResult |
149 | | - public func padding(_ prop: Float?) -> AAButtonTheme { |
150 | | - padding = prop |
151 | | - return self |
| 155 | + public override init() { |
| 156 | + |
152 | 157 | } |
| 158 | +} |
| 159 | + |
| 160 | +public class AAButtonThemeStatesHover: AAObject { |
| 161 | + public var fill: String? |
| 162 | + public var style: AAStyle? |
153 | 163 |
|
154 | 164 | @discardableResult |
155 | | - public func r(_ prop: Float?) -> AAButtonTheme { |
156 | | - r = prop |
| 165 | + public func fill(_ prop: String?) -> AAButtonThemeStatesHover { |
| 166 | + fill = prop |
157 | 167 | return self |
158 | 168 | } |
159 | 169 |
|
160 | 170 | @discardableResult |
161 | | - public func states(_ prop: AAButtonThemeStates?) -> AAButtonTheme { |
162 | | - states = prop |
| 171 | + public func style(_ prop: AAStyle?) -> AAButtonThemeStatesHover { |
| 172 | + style = prop |
163 | 173 | return self |
164 | 174 | } |
165 | 175 |
|
166 | | - @discardableResult |
167 | | - public func stroke(_ prop: String?) -> AAButtonTheme { |
168 | | - stroke = prop |
169 | | - return self |
| 176 | + public override init() { |
| 177 | + |
170 | 178 | } |
| 179 | +} |
| 180 | + |
| 181 | +public class AAButtonThemeStatesSelect: AAObject { |
| 182 | + public var fill: String? |
| 183 | + public var style: AAStyle? |
171 | 184 |
|
172 | 185 | @discardableResult |
173 | | - public func strokeWidth(_ prop: Float?) -> AAButtonTheme { |
174 | | - strokeWidth = prop |
| 186 | + public func fill(_ prop: String?) -> AAButtonThemeStatesSelect { |
| 187 | + fill = prop |
175 | 188 | return self |
176 | 189 | } |
177 | 190 |
|
178 | 191 | @discardableResult |
179 | | - public func style(_ prop: AAStyle?) -> AAButtonTheme { |
| 192 | + public func style(_ prop: AAStyle?) -> AAButtonThemeStatesSelect { |
180 | 193 | style = prop |
181 | 194 | return self |
182 | 195 | } |
183 | 196 |
|
184 | | - /* |
185 | | - public func toDictionaryProp() -> [String: Any]? { |
186 | | - var dic = [String: Any]() |
187 | | - if let fill = fill { |
188 | | - dic["fill"] = fill |
189 | | - } |
190 | | - if let stroke = stroke { |
191 | | - dic["stroke"] = stroke |
192 | | - } |
193 | | - if let strokeWidth = strokeWidth { |
194 | | - dic["stroke-width"] = strokeWidth |
195 | | - } |
196 | | - return dic |
197 | | - } |
198 | | - */ |
199 | | - public func toDictionaryProp() -> [String: Any]? { |
200 | | - var dic = [String: Any]() |
201 | | - if let fill = fill { |
202 | | - dic["fill"] = fill |
203 | | - } |
204 | | - if let padding = padding { |
205 | | - dic["padding"] = padding |
206 | | - } |
207 | | - if let r = r { |
208 | | - dic["r"] = r |
209 | | - } |
210 | | - if let states = states { |
211 | | - dic["states"] = states.toDic() as Any |
212 | | - } |
213 | | - if let stroke = stroke { |
214 | | - dic["stroke"] = stroke |
215 | | - } |
216 | | - if let strokeWidth = strokeWidth { |
217 | | - dic["stroke-width"] = strokeWidth |
218 | | - } |
219 | | - if let style = style { |
220 | | - dic["style"] = style.toDic() as Any |
221 | | - } |
222 | | - return dic |
223 | | - } |
224 | | - |
225 | 197 | public override init() { |
226 | | - |
| 198 | + |
227 | 199 | } |
228 | 200 | } |
0 commit comments