Skip to content

Commit fa0562c

Browse files
committed
Update AAButtonTheme.swift
1 parent c1869c4 commit fa0562c

File tree

1 file changed

+103
-131
lines changed

1 file changed

+103
-131
lines changed

AAInfographics/AAOptionsModel/AAButtonTheme.swift

Lines changed: 103 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -4,102 +4,116 @@
44
//
55
// Created by AnAn on 2024/11/5.
66
// 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 ...... ***************
813

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+
4031
*/
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?
4241
public var style: AAStyle?
43-
42+
4443
@discardableResult
45-
public func style(_ prop: AAStyle?) -> AAButtonThemeStatesDisabled {
46-
style = prop
44+
public func fill(_ prop: String?) -> AAButtonTheme {
45+
fill = prop
4746
return self
4847
}
4948

50-
public override init() {
51-
49+
@discardableResult
50+
public func padding(_ prop: Float?) -> AAButtonTheme {
51+
padding = prop
52+
return self
5253
}
53-
}
54-
55-
public class AAButtonThemeStatesHover: AAObject {
56-
public var fill: String?
57-
public var style: AAStyle?
5854

5955
@discardableResult
60-
public func fill(_ prop: String?) -> AAButtonThemeStatesHover {
61-
fill = prop
56+
public func r(_ prop: Float?) -> AAButtonTheme {
57+
r = prop
6258
return self
6359
}
6460

6561
@discardableResult
66-
public func style(_ prop: AAStyle?) -> AAButtonThemeStatesHover {
67-
style = prop
62+
public func states(_ prop: AAButtonThemeStates?) -> AAButtonTheme {
63+
states = prop
6864
return self
6965
}
7066

71-
public override init() {
72-
67+
@discardableResult
68+
public func stroke(_ prop: String?) -> AAButtonTheme {
69+
stroke = prop
70+
return self
7371
}
74-
}
75-
76-
public class AAButtonThemeStatesSelect: AAObject {
77-
public var fill: String?
78-
public var style: AAStyle?
7972

8073
@discardableResult
81-
public func fill(_ prop: String?) -> AAButtonThemeStatesSelect {
82-
fill = prop
74+
public func strokeWidth(_ prop: Float?) -> AAButtonTheme {
75+
strokeWidth = prop
8376
return self
8477
}
8578

8679
@discardableResult
87-
public func style(_ prop: AAStyle?) -> AAButtonThemeStatesSelect {
80+
public func style(_ prop: AAStyle?) -> AAButtonTheme {
8881
style = prop
8982
return self
9083
}
9184

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
94109
}
95-
}
96110

111+
public override init() {
97112

113+
}
114+
}
98115

99116

100-
101-
102-
103117
public class AAButtonThemeStates: AAObject {
104118
public var disabled: AAButtonThemeStatesDisabled?
105119
public var hover: AAButtonThemeStatesHover?
@@ -129,100 +143,58 @@ public class AAButtonThemeStates: AAObject {
129143
}
130144

131145

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 {
140147
public var style: AAStyle?
141-
148+
142149
@discardableResult
143-
public func fill(_ prop: String?) -> AAButtonTheme {
144-
fill = prop
150+
public func style(_ prop: AAStyle?) -> AAButtonThemeStatesDisabled {
151+
style = prop
145152
return self
146153
}
147154

148-
@discardableResult
149-
public func padding(_ prop: Float?) -> AAButtonTheme {
150-
padding = prop
151-
return self
155+
public override init() {
156+
152157
}
158+
}
159+
160+
public class AAButtonThemeStatesHover: AAObject {
161+
public var fill: String?
162+
public var style: AAStyle?
153163

154164
@discardableResult
155-
public func r(_ prop: Float?) -> AAButtonTheme {
156-
r = prop
165+
public func fill(_ prop: String?) -> AAButtonThemeStatesHover {
166+
fill = prop
157167
return self
158168
}
159169

160170
@discardableResult
161-
public func states(_ prop: AAButtonThemeStates?) -> AAButtonTheme {
162-
states = prop
171+
public func style(_ prop: AAStyle?) -> AAButtonThemeStatesHover {
172+
style = prop
163173
return self
164174
}
165175

166-
@discardableResult
167-
public func stroke(_ prop: String?) -> AAButtonTheme {
168-
stroke = prop
169-
return self
176+
public override init() {
177+
170178
}
179+
}
180+
181+
public class AAButtonThemeStatesSelect: AAObject {
182+
public var fill: String?
183+
public var style: AAStyle?
171184

172185
@discardableResult
173-
public func strokeWidth(_ prop: Float?) -> AAButtonTheme {
174-
strokeWidth = prop
186+
public func fill(_ prop: String?) -> AAButtonThemeStatesSelect {
187+
fill = prop
175188
return self
176189
}
177190

178191
@discardableResult
179-
public func style(_ prop: AAStyle?) -> AAButtonTheme {
192+
public func style(_ prop: AAStyle?) -> AAButtonThemeStatesSelect {
180193
style = prop
181194
return self
182195
}
183196

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-
225197
public override init() {
226-
198+
227199
}
228200
}

0 commit comments

Comments
 (0)