Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_CheckboxEditorAttributeUIComponent.c
Go to the documentation of this file.
1
4{
6
7 override void Init(Widget w, SCR_BaseEditorAttribute attribute)
8 {
9 Widget checkboxWidget = w.FindAnyWidget(m_sUiComponentName);
10 if (!checkboxWidget)
11 return;
12
15 return;
16
17 m_SelectionBoxComponent.m_OnChanged.Insert(OnChangeCheckbox);
18
19 super.Init(w, attribute);
20 }
21
22 //Sets a default state for the UI and var value if conflicting attribute
24 {
25 m_SelectionBoxComponent.SetCurrentItem(0);
26
27 if (var)
28 var.SetBool(false);
29 }
30
32 {
33 super.SetFromVar(var);
34
35 if (!var)
36 return;
37
38 m_SelectionBoxComponent.SetCurrentItem((int)var.GetBool(), false, false);
39 }
40
41 protected void OnChangeCheckbox(SCR_SelectionWidgetComponent selectionBox, bool value)
42 {
43 OnChangeInternal(selectionBox.GetRootWidget(), value, 0, false);
44 }
45
46 override bool OnChangeInternal(Widget w, int x, int y, bool finished)
47 {
49 return false;
50
52 if (!attribute) return false;
53
54 SCR_BaseEditorAttributeVar var = attribute.GetVariable(true);
55
56 if (var.GetBool() == x)
57 return false;
58
59 var.SetBool(x);
60 super.OnChangeInternal(w, x, y, finished);
61 return false;
62 }
63
64 override void HandlerDeattached(Widget w)
65 {
67 m_SelectionBoxComponent.m_OnChanged.Remove(OnChangeCheckbox);
68 }
69};
Base Attribute Script for other attributes to inherent from to get and set varriables in Editor Attri...
sealed SCR_BaseEditorAttributeVar GetVariable(bool createWhenNull=false)
Get attribute this component represents return Editor attribute *SCR_BaseEditorAttribute GetAttribute()
void OnChangeCheckbox(SCR_SelectionWidgetComponent selectionBox, bool value)
override void SetFromVar(SCR_BaseEditorAttributeVar var)
override void Init(Widget w, SCR_BaseEditorAttribute attribute)
override bool OnChangeInternal(Widget w, int x, int y, bool finished)
override void SetVariableToDefaultValue(SCR_BaseEditorAttributeVar var)