Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
bannerhandlerbase.c
Go to the documentation of this file.
1 class BannerHandlerBase extends ScriptedWidgetEventHandler
2 {
3  protected Widget m_Root;
4  protected Widget m_Parent; //frame
5  protected Widget m_BannerBody;
6  protected Widget m_BannerWedge;
7  protected TextWidget m_BannerText;
8 
9  void BannerHandlerBase(Widget parent)
10  {
11  m_Parent = parent;
12  m_Root = GetGame().GetWorkspace().CreateWidgets("gui/layouts/new_ui/dlc_panels/BannerTemplate.layout", m_Parent);
13  m_Root.SetHandler(this);
14 
15  m_BannerBody = m_Root.FindAnyWidget("BadgeBody");
16  m_BannerWedge = m_Root.FindAnyWidget("BadgeWedge");
17  m_BannerText = TextWidget.Cast(m_Root.FindAnyWidget("BadgeText"));
18 
19  m_BannerBody.SetAlpha(1.0);
20  m_BannerWedge.SetAlpha(1.0);
21  }
22 
23  void SetBannerColor(int argb)
24  {
25  m_BannerBody.SetColor(argb);
26  m_BannerWedge.SetColor(argb);
27  }
28 
29  void SetBannerText(string text)
30  {
31  m_BannerText.SetText(text);
32  }
33 
34  override bool OnUpdate(Widget w)
35  {
36  if (w == m_BannerText)
37  {
38  float w0,h0,x0,y0;
39  m_BannerText.GetScreenSize(w0,h0);
40  float bannerBodyWidth = w0 + 20;
41 
42  m_BannerBody.SetScreenSize(bannerBodyWidth,h0);
43  m_BannerBody.GetScreenPos(x0,y0);
44 
45  m_BannerWedge.GetScreenSize(w0,h0);
46  m_BannerWedge.SetScreenPos(Math.Ceil(x0 - w0),y0);
47  }
48 
49  return super.OnUpdate(w);
50  }
51 }
GetGame
proto native CGame GetGame()
m_Parent
protected Widget m_Parent
Definition: sizetochild.c:92
TextWidget
Definition: enwidgets.c:219
OnUpdate
proto native void OnUpdate()
Definition: tools.c:349
Widget
Definition: enwidgets.c:189
Math
Definition: enmath.c:6
m_Root
protected Widget m_Root
Definition: sizetochild.c:91
ScriptedWidgetEventHandler
map: item x vector(index, width, height)
Definition: enwidgets.c:650