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_ComboBoxIconComponent.c
Go to the documentation of this file.
1
class
SCR_ComboBoxIconComponent
:
SCR_ComboBoxComponent
2
{
3
[
Attribute
()]
4
protected
ref array<ResourceName>
m_aElementIcons
;
5
protected
ref array<float>
m_aElementIconRotations
;
6
7
[
Attribute
(
"ComboBoxIcon"
)]
8
protected
string
m_sIconWidgetName
;
9
10
protected
ImageWidget
m_IconWidget
;
11
protected
ref
ScriptInvoker
Event_OnCreateElement
=
new
ScriptInvoker
;
12
protected
ref
Color
m_cIconDisabledColor
=
new
Color
(0.8, 0.8, 0.8, 1);
13
14
protected
override
void
UpdateName
()
15
{
16
super.UpdateName();
17
18
if
(!
m_IconWidget
)
19
return
;
20
21
if
(
m_aElementIcons
&&
m_iSelectedItem
>= 0 &&
m_iSelectedItem
<
m_aElementIcons
.Count() &&
m_aElementIcons
[
m_iSelectedItem
] !=
string
.Empty)
22
{
23
m_IconWidget
.LoadImageTexture(0,
m_aElementIcons
[
m_iSelectedItem
]);
24
m_IconWidget
.SetImage(0);
25
m_IconWidget
.SetRotation(
m_aElementIconRotations
[
m_iSelectedItem
]);
26
m_IconWidget
.SetVisible(
true
);
27
}
28
else
{
29
m_IconWidget
.SetVisible(
false
);
30
}
31
}
32
33
//------------------------------------------------------------------------------------------------
34
int
AddItemAndIcon
(
string
item,
ResourceName
icon,
float
rotation
= 0, Managed
data
= null)
35
{
36
if
(!
m_aElementIcons
)
37
m_aElementIcons
=
new
array<ResourceName>;
38
39
if
(!
m_aElementIconRotations
)
40
m_aElementIconRotations
=
new
array<float>;
41
42
m_aElementIcons
.Insert(icon);
43
m_aElementIconRotations
.Insert(
rotation
);
44
45
int
i = super.AddItem(item,
false
,
data
);
46
return
i;
47
}
48
49
//------------------------------------------------------------------------------------------------
50
ImageWidget
GetIconWidget
()
51
{
52
return
m_IconWidget
;
53
}
54
55
//------------------------------------------------------------------------------------------------
56
override
int
AddItem
(
string
item,
bool
last =
false
, Managed
data
= null)
57
{
58
m_aElementIcons
.Insert(
string
.Empty);
59
int
i = super.AddItem(item, last,
data
);
60
return
i;
61
}
62
63
//------------------------------------------------------------------------------------------------
64
override
void
ClearAll
()
65
{
66
m_aElementIcons
.Clear();
67
super.ClearAll();
68
}
69
70
void
AllowFocus
(
bool
allowFocus)
71
{
72
if
(allowFocus)
73
m_wContentRoot
.ClearFlags(
WidgetFlags
.NOFOCUS);
74
else
75
m_wContentRoot
.SetFlags(
WidgetFlags
.NOFOCUS);
76
}
77
78
//------------------------------------------------------------------------------------------------
79
ScriptInvoker
GetOnCreateElement
()
80
{
81
return
Event_OnCreateElement
;
82
}
83
84
//------------------------------------------------------------------------------------------------
85
protected
override
void
OnCreateElement
(
Widget
elementWidget,
int
index
)
86
{
87
ImageWidget
iconWidget =
ImageWidget
.Cast(elementWidget.FindAnyWidget(
"Icon"
));
88
89
SCR_ButtonTextComponent
textComp =
SCR_ButtonTextComponent
.Cast(elementWidget.GetHandler(0));
90
91
if
(!iconWidget)
92
return
;
93
94
if
(
m_aElementIcons
&&
index
>= 0 &&
index
<
m_aElementIcons
.Count() &&
m_aElementIcons
[
index
] !=
string
.Empty)
95
{
96
iconWidget.LoadImageTexture(0,
m_aElementIcons
[
index
]);
97
iconWidget.SetImage(0);
98
iconWidget.SetRotation(
m_aElementIconRotations
[
m_iSelectedItem
]);
99
iconWidget.SetVisible(
true
);
100
}
101
else
102
{
103
iconWidget.SetVisible(
false
);
104
}
105
106
107
Event_OnCreateElement
.Invoke(elementWidget,
index
);
108
}
109
110
void
SetElementEnabled
(
int
index
,
bool
enable)
111
{
112
if
(
index
>= 0 &&
index
<
m_aElementWidgets
.Count())
113
{
114
m_aElementWidgets
[
index
].SetEnabled(enable);
115
116
ImageWidget
iconWidget =
ImageWidget
.Cast(
m_aElementWidgets
[
index
].FindAnyWidget(
"Icon"
));
117
if
(!iconWidget)
118
return
;
119
120
if
(enable)
121
iconWidget.SetColor(
Color
.FromInt(
Color
.WHITE));
122
else
123
iconWidget.SetColor(
m_cIconDisabledColor
);
124
}
125
}
126
127
//------------------------------------------------------------------------------------------------
128
override
void
RemoveItem
(
int
item,
bool
last =
false
)
129
{
130
if
(item <
m_aElementIcons
.Count())
131
m_aElementIcons
.Remove(item);
132
133
super.RemoveItem(item, last);
134
}
135
136
override
void
HandlerAttached
(
Widget
w)
137
{
138
m_IconWidget
=
ImageWidget
.Cast(w.FindAnyWidget(
m_sIconWidgetName
));
139
super.HandlerAttached(w);
140
}
141
};
index
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Definition
SCR_DestructionSynchronizationComponent.c:17
data
Get all prefabs that have the spawner data
Definition
SCR_EntityCatalogManagerComponent.c:320
Color
Definition
Color.c:13
ImageWidget
Definition
ImageWidget.c:13
ResourceName
Definition
ResourceName.c:13
SCR_ButtonTextComponent
Definition
SCR_ButtonTextComponent.c:3
SCR_ComboBoxComponent
Definition
SCR_ComboBoxComponent.c:2
SCR_ComboBoxComponent::m_wContentRoot
Widget m_wContentRoot
Definition
SCR_ComboBoxComponent.c:68
SCR_ComboBoxComponent::m_aElementWidgets
ref array< Widget > m_aElementWidgets
Definition
SCR_ComboBoxComponent.c:61
SCR_ComboBoxIconComponent
Definition
SCR_ComboBoxIconComponent.c:2
SCR_ComboBoxIconComponent::m_aElementIconRotations
ref array< float > m_aElementIconRotations
Definition
SCR_ComboBoxIconComponent.c:5
SCR_ComboBoxIconComponent::Event_OnCreateElement
ref ScriptInvoker Event_OnCreateElement
Definition
SCR_ComboBoxIconComponent.c:11
SCR_ComboBoxIconComponent::GetIconWidget
ImageWidget GetIconWidget()
Definition
SCR_ComboBoxIconComponent.c:50
SCR_ComboBoxIconComponent::m_IconWidget
ImageWidget m_IconWidget
Definition
SCR_ComboBoxIconComponent.c:10
SCR_ComboBoxIconComponent::GetOnCreateElement
ScriptInvoker GetOnCreateElement()
Definition
SCR_ComboBoxIconComponent.c:79
SCR_ComboBoxIconComponent::SetElementEnabled
void SetElementEnabled(int index, bool enable)
Definition
SCR_ComboBoxIconComponent.c:110
SCR_ComboBoxIconComponent::m_sIconWidgetName
string m_sIconWidgetName
Definition
SCR_ComboBoxIconComponent.c:8
SCR_ComboBoxIconComponent::m_aElementIcons
ref array< ResourceName > m_aElementIcons
Definition
SCR_ComboBoxIconComponent.c:4
SCR_ComboBoxIconComponent::AllowFocus
void AllowFocus(bool allowFocus)
Definition
SCR_ComboBoxIconComponent.c:70
SCR_ComboBoxIconComponent::UpdateName
override void UpdateName()
Definition
SCR_ComboBoxIconComponent.c:14
SCR_ComboBoxIconComponent::HandlerAttached
override void HandlerAttached(Widget w)
Definition
SCR_ComboBoxIconComponent.c:136
SCR_ComboBoxIconComponent::ClearAll
override void ClearAll()
Definition
SCR_ComboBoxIconComponent.c:64
SCR_ComboBoxIconComponent::AddItem
override int AddItem(string item, bool last=false, Managed data=null)
Definition
SCR_ComboBoxIconComponent.c:56
SCR_ComboBoxIconComponent::m_cIconDisabledColor
ref Color m_cIconDisabledColor
Definition
SCR_ComboBoxIconComponent.c:12
SCR_ComboBoxIconComponent::AddItemAndIcon
int AddItemAndIcon(string item, ResourceName icon, float rotation=0, Managed data=null)
Definition
SCR_ComboBoxIconComponent.c:34
SCR_ComboBoxIconComponent::RemoveItem
override void RemoveItem(int item, bool last=false)
Definition
SCR_ComboBoxIconComponent.c:128
SCR_ComboBoxIconComponent::OnCreateElement
override void OnCreateElement(Widget elementWidget, int index)
Definition
SCR_ComboBoxIconComponent.c:85
SCR_SelectionWidgetComponent::m_iSelectedItem
int m_iSelectedItem
Definition
SCR_SelectionWidgetComponent.c:9
Widget
Definition
Widget.c:13
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
rotation
RespawnSystemComponentClass GameComponentClass vector vector rotation
Definition
RespawnSystemComponent.c:23
WidgetFlags
WidgetFlags
Widget flags. See enf::Widget::SetFlags().
Definition
WidgetFlags.c:14
ScriptInvoker
ScriptInvokerBase< func > ScriptInvoker
Definition
tools.c:134
scripts
Game
UI
Components
WidgetLibrary
SCR_ComboBox
SCR_ComboBoxIconComponent.c
Generated by
1.17.0