Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_SelectionMenuEntryIconComponent.c
Go to the documentation of this file.
1//------------------------------------------------------------------------------------------------
3{
4 [Attribute("Icon")]
5 protected string m_sIcon;
6
7 [Attribute("255 255 255 255")]
8 protected ref Color m_cDefaultColor;
9
10 [Attribute("255 255 255 255")]
11 protected ref Color m_cAltColor;
12
14
16 protected string m_sImage;
17
18 //------------------------------------------------------------------------------------------------
19 // Override
20 //------------------------------------------------------------------------------------------------
21
22 //------------------------------------------------------------------------------------------------
23 override void HandlerAttached(Widget w)
24 {
25 super.HandlerAttached(w);
26
27 m_wIcon = ImageWidget.Cast(m_wRoot.FindAnyWidget(m_sIcon));
28 }
29
30 //------------------------------------------------------------------------------------------------
32 override void SetEntry(SCR_SelectionMenuEntry entry)
33 {
34 // Clear previous referenced entry
35 if (m_Entry)
36 {
37 m_Entry.GetOnIconChange().Remove(OnEntryIconChange);
38 }
39
40 // Setup new entry
41 super.SetEntry(entry);
42
43 if (!entry)
44 return;
45
46 m_Entry.GetOnIconChange().Insert(OnEntryIconChange);
47 }
48
49 //------------------------------------------------------------------------------------------------
50 // Custom
51 //------------------------------------------------------------------------------------------------
52
53 //------------------------------------------------------------------------------------------------
54 void SetImage(ResourceName texture, string image)
55 {
56 m_sTexture = texture;
57 m_sImage = image;
58
60 }
61
62 //------------------------------------------------------------------------------------------------
63 void SetLayoutSize(float size)
64 {
65 if (m_wSizeLayout)
67 }
68
69 //------------------------------------------------------------------------------------------------
70 void SetIconColor(Color color = null)
71 {
72 if (!m_wIcon)
73 return;
74
75 if (color == null)
76 m_wIcon.SetColor(m_cDefaultColor);
77 else
78 m_wIcon.SetColor(color);
79 }
80
81 //------------------------------------------------------------------------------------------------
83 {
84 return Color.FromInt(m_cAltColor.PackToInt());
85 }
86
87 //------------------------------------------------------------------------------------------------
88 // Callback
89 //------------------------------------------------------------------------------------------------
90
91 //------------------------------------------------------------------------------------------------
92 protected void OnEntryIconChange(SCR_SelectionMenuEntry entry, ResourceName texture, string image)
93 {
94 SetImage(texture, image);
95 }
96}
int size
Definition Color.c:13
SCR_SelectionMenuEntry m_Entry
Widget m_wSizeLayout
void SetImage(ResourceName texture, string image)
void SetLayoutSize(float size)
void OnEntryIconChange(SCR_SelectionMenuEntry entry, ResourceName texture, string image)
ImageWidget m_wIcon
string m_sIcon
ResourceName m_sTexture
override void SetEntry(SCR_SelectionMenuEntry entry)
Set entry holding data driving this visuals.
override void HandlerAttached(Widget w)
ref Color m_cDefaultColor
string m_sImage
Color GetAltColor()
ref Color m_cAltColor
void SetIconColor(Color color=null)
Base class for all final Reforger interactive elements.
static bool SetTexture(ImageWidget widget, ResourceName texture, string image="")
SCR_FieldOfViewSettings Attribute