Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_SimpleWarningComponent.c
Go to the documentation of this file.
1//------------------------------------------------------------------------------------------------
3{
4 [Attribute("#AR-Account_LoginTimeout")]
5 protected string m_sWarning;
6
7 [Attribute(UIConstants.ICON_WARNING)]
8 protected string m_sIconName;
9
10 [Attribute(UIColors.GetColorAttribute(UIColors.WARNING))]
11 protected ref Color m_Color;
12
13 [Attribute(UIColors.GetColorAttribute(UIColors.WARNING))]
14 protected ref Color m_TextColor;
15
20
21 //------------------------------------------------------------------------------------------------
22 override void HandlerAttached(Widget w)
23 {
24 super.HandlerAttached(w);
25
26 m_wWarning = TextWidget.Cast(w.FindAnyWidget("WarningText"));
27 m_wWarningImage = ImageWidget.Cast(w.FindAnyWidget("WarningImage"));
28 m_wWarningImageSize = SizeLayoutWidget.Cast(w.FindAnyWidget("WarningImageSize"));
29 m_wWarningWrapper = w.FindAnyWidget("WarningWrapper");
32 }
33
34 //------------------------------------------------------------------------------------------------
39
40 //------------------------------------------------------------------------------------------------
45
46 //------------------------------------------------------------------------------------------------
47 void SetWarning(string text, string iconName, ResourceName imageset = string.Empty)
48 {
49 if (imageset.IsEmpty())
50 imageset = UIConstants.ICONS_IMAGE_SET;
51
52 if (m_wWarning)
53 m_wWarning.SetText(text);
54
55 if (m_wWarningImage && !iconName.IsEmpty())
56 m_wWarningImage.LoadImageFromSet(0, imageset, iconName);
57 }
58
59 //------------------------------------------------------------------------------------------------
60 void SetWarningColor(Color color, Color textColor)
61 {
62 if (m_wWarning)
63 m_wWarning.SetColor(textColor);
64
66 m_wWarningImage.SetColor(color);
67 }
68
69 //------------------------------------------------------------------------------------------------
70 void SetWarningVisible(bool visible, bool preserveSpace = true)
71 {
72 m_wRoot.SetVisible(visible || !visible && preserveSpace);
73
75 m_wWarningWrapper.SetVisible(visible);
76 }
77
78 //------------------------------------------------------------------------------------------------
79 void SetIconVisible(bool visible, bool preserveSpace = false)
80 {
82 m_wWarningImage.SetVisible(visible);
83
85 m_wWarningImageSize.SetVisible(visible || !visible && preserveSpace);
86 }
87
88 //------------------------------------------------------------------------------------------------
90 {
91 ScriptedWidgetEventHandler handler = SCR_WidgetTools.FindHandlerInChildren(root, SCR_SimpleWarningComponent);
92 if (handler)
93 return SCR_SimpleWarningComponent.Cast(handler);
94
95 return null;
96 }
97
98 //------------------------------------------------------------------------------------------------
100 {
101 return SCR_SimpleWarningComponent.Cast(w.FindHandler(SCR_SimpleWarningComponent));
102 }
103}
Definition Color.c:13
void SetWarningColor(Color color, Color textColor)
void SetIconVisible(bool visible, bool preserveSpace=false)
static SCR_SimpleWarningComponent FindComponentInHierarchy(notnull Widget root)
override void HandlerAttached(Widget w)
void SetWarningVisible(bool visible, bool preserveSpace=true)
static SCR_SimpleWarningComponent FindComponent(notnull Widget w)
void SetWarning(string text, string iconName, ResourceName imageset=string.Empty)
SCR_FieldOfViewSettings Attribute