7 protected ref array<ref Widget> m_aWidgetCells =
new array<ref Widget>();
8 protected ref array<bool> m_aPreventContentChange =
new array<bool>;
10 protected ref array<SCR_ButtonComponent> m_aInnerButtons =
new array<SCR_ButtonComponent>;
12 protected Color m_cColorContent;
14 protected ref Widget m_wHoverWidget;
17 protected int m_iButtonPaddingLeft;
19 protected int m_iButtonPaddingTop;
21 protected int m_iButtonPaddingRigh;
23 protected int m_iButtonPaddingBottom;
25 protected bool m_bColorizeFocusLost =
true;
28 void SetColorizeFocusLost(
bool colorize) { m_bColorizeFocusLost = colorize; }
31 override protected void HandlerAttached(Widget w)
33 super.HandlerAttached(w);
34 HorizontalLayoutSlot.SetPadding(
m_wOverlay, m_iButtonPaddingLeft, m_iButtonPaddingTop, m_iButtonPaddingRigh, m_iButtonPaddingBottom);
35 m_cColorContent = COLOR_CONTENT_DEFAULT;
39 override bool OnMouseEnter(Widget w,
int x,
int y)
41 if (!m_bColorizeFocusLost)
44 super.OnMouseEnter(w, x, y);
51 override bool OnMouseLeave(Widget w, Widget enterW,
int x,
int y)
53 super.OnMouseLeave(w, enterW, x, y);
55 if (!m_bColorizeFocusLost)
57 m_OnHoverLeave.Invoke();
65 override protected void ColorizeWidgets(Color colorBackground, Color colorContent,
float speed = -1)
68 speed = m_fAnimationRate;
70 m_cColorContent = colorContent;
71 ColorizeCellPart(
"Background", colorBackground, speed,
false);
72 ColorizeCellPart(
"Content", m_cColorContent, speed,
true);
76 void InsertWidgetCells(array<string> cellNames)
80 foreach (
string cellName : cellNames)
82 Widget w =
m_wRoot.FindAnyWidget(cellName);
85 m_aWidgetCells.Insert(w);
86 m_aPreventContentChange.Insert(
false);
93 void SetupInnerButton(
string widgetName)
95 Widget w =
m_wRoot.FindAnyWidget(widgetName);
105 button.m_OnFocus.Insert(OnInnerButtonFocus);
110 protected void OnInnerButtonFocus(Widget w)
123 protected void ColorizeCellPart(
string partName, Color c,
float speed,
float prevent)
125 for (
int i = 0; i < m_aWidgetCells.Count(); i++)
127 if (i > m_aPreventContentChange.Count())
130 if (prevent && m_aPreventContentChange[i])
135 Widget w = m_aWidgetCells[i];
137 string name = w.GetName();
141 wPart = w.FindAnyWidget(partName);
144 wPart = w.FindAnyWidget(
"Overlay");
147 AnimateWidget.Color(wPart, c, speed);
153 void ColorizeCellPart(
string partName, Color c,
float speed,
float prevent,
int id)
158 Widget w = m_aWidgetCells[id];
162 wPart = w.FindAnyWidget(partName);
165 wPart = w.FindAnyWidget(
"Overlay");
168 AnimateWidget.Color(wPart, c, speed);
172 void PreventContentColoringOn(
int iCellId,
bool bPrevent)
174 m_aPreventContentChange[iCellId] = bPrevent;
178 Color GetColorContent()
180 return Color.FromInt(m_cColorContent.PackToInt());