@@ -11,10 +11,47 @@ local mixin_helper = require("library.mixin_helper")
11
11
12
12
local class = {Methods = {}}
13
13
local methods = class .Methods
14
+ local private = setmetatable ({}, {__mode = " k" })
14
15
15
16
local trigger_check_change
16
17
local each_last_check_change
17
18
19
+ --[[
20
+ % Init
21
+
22
+ **[Internal]**
23
+
24
+ @ self (FCMCtrlCheckbox)
25
+ ]]
26
+ function class :Init ()
27
+ if private [self ] then
28
+ return
29
+ end
30
+
31
+ private [self ] = {
32
+ Check = 0 ,
33
+ }
34
+ end
35
+
36
+ --[[
37
+ % GetCheck
38
+
39
+ **[Override]**
40
+
41
+ Override Changes:
42
+ - Hooks into control state preservation.
43
+
44
+ @ self (FCMCtrlCheckbox)
45
+ : (number)
46
+ ]]
47
+ function methods :GetCheck ()
48
+ if mixin .FCMControl .UseStoredState (self ) then
49
+ return private [self ].Check
50
+ end
51
+
52
+ return self :GetCheck__ ()
53
+ end
54
+
18
55
--[[
19
56
% SetCheck
20
57
@@ -29,7 +66,11 @@ Override Changes:
29
66
function methods :SetCheck (checked )
30
67
mixin_helper .assert_argument_type (2 , checked , " number" )
31
68
32
- self :SetCheck__ (checked )
69
+ if mixin .FCMControl .UseStoredState (self ) then
70
+ private [self ].Check = checked
71
+ else
72
+ self :SetCheck__ (checked )
73
+ end
33
74
34
75
trigger_check_change (self )
35
76
end
@@ -78,4 +119,38 @@ methods.AddHandleCheckChange, methods.RemoveHandleCheckChange, trigger_check_cha
78
119
}
79
120
)
80
121
122
+ --[[
123
+ % StoreState
124
+
125
+ **[Fluid] [Internal] [Override]**
126
+
127
+ Override Changes:
128
+ - Stores `FCMCtrlCheckbox`-specific properties.
129
+
130
+ *Do not disable this method. Override as needed but call the parent first.*
131
+
132
+ @ self (FCMCtrlCheckbox)
133
+ ]]
134
+ function methods :StoreState ()
135
+ mixin .FCMControl .StoreState (self )
136
+ private [self ].Check = self :GetCheck__ ()
137
+ end
138
+
139
+ --[[
140
+ % RestoreState
141
+
142
+ **[Fluid] [Internal] [Override]**
143
+
144
+ Override Changes:
145
+ - Restores `FCMCtrlCheckbox`-specific properties.
146
+
147
+ *Do not disable this method. Override as needed but call the parent first.*
148
+
149
+ @ self (FCMCtrlCheckbox)
150
+ ]]
151
+ function methods :RestoreState ()
152
+ mixin .FCMControl .RestoreState (self )
153
+ self :SetCheck__ (private [self ].Check )
154
+ end
155
+
81
156
return class
0 commit comments