5 protected string m_sWarning;
8 protected string m_sIconName;
11 protected ref Color m_Color;
14 protected ref Color m_TextColor;
16 protected TextWidget m_wWarning;
17 protected Widget m_wWarningWrapper;
18 protected ImageWidget m_wWarningImage;
19 protected SizeLayoutWidget m_wWarningImageSize;
22 override void HandlerAttached(Widget w)
24 super.HandlerAttached(w);
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");
37 SetWarning(m_sWarning, m_sIconName);
41 void ResetWarningColor()
43 SetWarningColor(
m_Color, m_TextColor);
47 void SetWarning(
string text,
string iconName)
50 m_wWarning.SetText(text);
52 if (m_wWarningImage && !iconName.IsEmpty())
53 m_wWarningImage.LoadImageFromSet(0,
UIConstants.ICONS_IMAGE_SET, iconName);
57 void SetWarningColor(Color color, Color textColor)
60 m_wWarning.SetColor(textColor);
63 m_wWarningImage.SetColor(color);
67 void SetWarningVisible(
bool visible,
bool preserveSpace =
true)
69 m_wRoot.SetVisible(visible || !visible && preserveSpace);
71 if (m_wWarningWrapper)
72 m_wWarningWrapper.SetVisible(visible);
76 void SetIconVisible(
bool visible,
bool preserveSpace =
false)
79 m_wWarningImage.SetVisible(visible);
81 if (m_wWarningImageSize)
82 m_wWarningImageSize.SetVisible(visible || !visible && preserveSpace);