Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SCR_SpinboxEditorAttributeUIComponent.c
Go to the documentation of this file.
1
3
class
SCR_SpinboxEditorAttributeUIComponent
:
SCR_BaseEditorAttributeUIComponent
4
{
5
protected
SCR_SpinBoxComponent
m_SpinboxWidgetComponent
;
6
protected
bool
m_bInitCalled
;
7
8
override
void
Init
(
Widget
w,
SCR_BaseEditorAttribute
attribute)
9
{
10
Widget
spingBoxWidget = w.FindAnyWidget(
m_sUiComponentName
);
11
12
if
(!spingBoxWidget)
return
;
13
m_SpinboxWidgetComponent
=
SCR_SpinBoxComponent
.Cast(spingBoxWidget.FindHandler(
SCR_SpinBoxComponent
));
14
15
if
(!
m_SpinboxWidgetComponent
)
return
;
16
m_SpinboxWidgetComponent
.m_OnChanged.Insert(
OnChangeSpinbox
);
17
18
SCR_BaseEditorAttributeVar
var = attribute.
GetVariableOrCopy
();
19
if
(var)
20
{
21
SCR_BaseEditorAttributeFloatStringValues
spinboxData;
22
array<ref SCR_BaseEditorAttributeEntry> entries =
new
array<ref SCR_BaseEditorAttributeEntry>;
23
attribute.
GetEntries
(entries);
24
25
foreach
(SCR_BaseEditorAttributeEntry entry: entries)
26
{
27
spinboxData =
SCR_BaseEditorAttributeFloatStringValues
.Cast(entry);
28
if
(spinboxData)
29
{
30
int
count = spinboxData.GetValueCount();
31
32
for
(
int
i = 0; i < count; i++)
33
{
34
m_SpinboxWidgetComponent
.AddItem(spinboxData.GetValuesEntry(i).GetName(), i == count - 1);
35
}
36
37
continue
;
38
}
39
}
40
41
//Spin box uses text entries
42
if
(!spinboxData)
43
{
44
int
entriesCount = entries.Count();
45
for
(
int
i = 0; i < entriesCount; i++)
46
{
47
SCR_BaseEditorAttributeEntryText
entry =
SCR_BaseEditorAttributeEntryText
.Cast(entries[i]);
48
if
(entry)
49
m_SpinboxWidgetComponent
.AddItem(entry.GetText(), i == entriesCount - 1);
50
}
51
}
52
}
53
54
super.Init(w, attribute);
55
}
56
57
//Sets a default state for the UI and var value if conflicting attribute
58
override
void
SetVariableToDefaultValue
(
SCR_BaseEditorAttributeVar
var)
59
{
60
m_SpinboxWidgetComponent
.SetCurrentItem(0);
61
62
if
(var)
63
var.
SetInt
(0);
64
}
65
66
override
void
SetFromVar
(
SCR_BaseEditorAttributeVar
var)
67
{
68
super.SetFromVar(var);
69
70
if
(!var)
71
return
;
72
73
m_SpinboxWidgetComponent
.SetCurrentItem(var.
GetInt
(),
false
,
false
);
74
m_bInitCalled
=
true
;
75
}
76
77
override
bool
OnChangeInternal
(
Widget
w,
int
x,
int
y,
bool
finished)
78
{
79
SCR_BaseEditorAttribute
attribute =
GetAttribute
();
80
if
(!attribute)
return
false
;
81
SCR_BaseEditorAttributeVar
var = attribute.
GetVariable
(
true
);
82
83
if
(var.
GetInt
() == x)
84
return
false
;
85
86
var.
SetInt
(x);
87
super.OnChangeInternal(w, x, y, finished);
88
return
false
;
89
}
90
91
protected
void
OnChangeSpinbox
(
SCR_SpinBoxComponent
spinbox,
int
value)
92
{
93
if
(
m_bInitCalled
)
94
OnChangeInternal
(spinbox.GetRootWidget(), value, 0,
false
);
95
}
96
97
98
override
void
HandlerDeattached
(
Widget
w)
99
{
100
if
(
m_SpinboxWidgetComponent
)
101
m_SpinboxWidgetComponent
.m_OnChanged.Remove(
OnChangeSpinbox
);
102
}
103
};
SCR_BaseEditorAttributeEntryText
void SCR_BaseEditorAttributeEntryText(string text)
Definition
SCR_BaseEditorAttribute.c:494
SCR_BaseEditorAttributeFloatStringValues
void SCR_BaseEditorAttributeFloatStringValues(array< ref SCR_EditorAttributeFloatStringValueHolder > values)
Definition
SCR_BaseEditorAttribute.c:634
SCR_BaseEditorAttribute
Base Attribute Script for other attributes to inherent from to get and set varriables in Editor Attri...
Definition
SCR_BaseEditorAttribute.c:4
SCR_BaseEditorAttribute::GetVariable
sealed SCR_BaseEditorAttributeVar GetVariable(bool createWhenNull=false)
Definition
SCR_BaseEditorAttribute.c:307
SCR_BaseEditorAttribute::GetVariableOrCopy
sealed SCR_BaseEditorAttributeVar GetVariableOrCopy()
Definition
SCR_BaseEditorAttribute.c:326
SCR_BaseEditorAttribute::GetEntries
int GetEntries(notnull array< ref SCR_BaseEditorAttributeEntry > outEntries)
Definition
SCR_BaseEditorAttribute.c:458
SCR_BaseEditorAttributeUIComponent
Definition
SCR_BaseEditorAttributeUIComponent.c:4
SCR_BaseEditorAttributeUIComponent::GetAttribute
Get attribute this component represents return Editor attribute *SCR_BaseEditorAttribute GetAttribute()
Definition
SCR_BaseEditorAttributeUIComponent.c:59
SCR_BaseEditorAttributeUIComponent::m_sUiComponentName
string m_sUiComponentName
Definition
SCR_BaseEditorAttributeUIComponent.c:6
SCR_BaseEditorAttributeVar
Definition
SCR_BaseEditorAttributeVar.c:2
SCR_BaseEditorAttributeVar::GetInt
int GetInt()
Definition
SCR_BaseEditorAttributeVar.c:20
SCR_BaseEditorAttributeVar::SetInt
void SetInt(int value)
Definition
SCR_BaseEditorAttributeVar.c:12
SCR_SpinBoxComponent
Definition
SCR_SpinBoxComponent.c:2
SCR_SpinboxEditorAttributeUIComponent
Definition
SCR_SpinboxEditorAttributeUIComponent.c:4
SCR_SpinboxEditorAttributeUIComponent::Init
override void Init(Widget w, SCR_BaseEditorAttribute attribute)
Definition
SCR_SpinboxEditorAttributeUIComponent.c:8
SCR_SpinboxEditorAttributeUIComponent::OnChangeInternal
override bool OnChangeInternal(Widget w, int x, int y, bool finished)
Definition
SCR_SpinboxEditorAttributeUIComponent.c:77
SCR_SpinboxEditorAttributeUIComponent::SetFromVar
override void SetFromVar(SCR_BaseEditorAttributeVar var)
Definition
SCR_SpinboxEditorAttributeUIComponent.c:66
SCR_SpinboxEditorAttributeUIComponent::HandlerDeattached
override void HandlerDeattached(Widget w)
Definition
SCR_SpinboxEditorAttributeUIComponent.c:98
SCR_SpinboxEditorAttributeUIComponent::m_SpinboxWidgetComponent
SCR_SpinBoxComponent m_SpinboxWidgetComponent
Definition
SCR_SpinboxEditorAttributeUIComponent.c:5
SCR_SpinboxEditorAttributeUIComponent::m_bInitCalled
bool m_bInitCalled
Definition
SCR_SpinboxEditorAttributeUIComponent.c:6
SCR_SpinboxEditorAttributeUIComponent::OnChangeSpinbox
void OnChangeSpinbox(SCR_SpinBoxComponent spinbox, int value)
Definition
SCR_SpinboxEditorAttributeUIComponent.c:91
SCR_SpinboxEditorAttributeUIComponent::SetVariableToDefaultValue
override void SetVariableToDefaultValue(SCR_BaseEditorAttributeVar var)
Definition
SCR_SpinboxEditorAttributeUIComponent.c:58
Widget
Definition
Widget.c:13
scripts
Game
Editor
UI
Components
Attributes
SCR_SpinboxEditorAttributeUIComponent.c
Generated by
1.17.0