DayZ 1.24
Loading...
Searching...
No Matches
Header.c
Go to the documentation of this file.
2{
3 protected int m_DefaultColor;
4 protected int m_DefaultFontSize;
5
6 protected EntityAI m_Entity;
7
12
13 void Header(LayoutHolder parent, string function_name)
14 {
15 m_CollapseButton = GetMainWidget().FindAnyWidget("collapse_button");
16 m_UpArrowButton = GetMainWidget().FindAnyWidget("opened");
17 m_DownArrowButton = GetMainWidget().FindAnyWidget("closed");
18
19#ifdef PLATFORM_CONSOLE
20 m_CollapseButton.Show(false);
21#else
23 WidgetEventHandler.GetInstance().RegisterOnDropReceived(m_CollapseButton, m_Parent, "OnDropReceivedFromHeader");
24#endif
25 WidgetEventHandler.GetInstance().RegisterOnDropReceived(GetMainWidget(), m_Parent, "OnDropReceivedFromHeader");
26 WidgetEventHandler.GetInstance().RegisterOnDraggingOver(GetMainWidget(), this, "DraggingOverHeader");
27
28 m_HeaderText = TextWidget.Cast(GetMainWidget().FindAnyWidget("TextWidget0"));
29
30 m_DefaultColor = GetRootWidget().GetColor();
31 }
32
33 void SetName(string name)
34 {
35 name.ToUpper();
36 m_HeaderText.SetText(name);
37 }
38
40 {
41#ifndef PLATFORM_CONSOLE
43 ItemPreviewWidget item_preview = ItemPreviewWidget.Cast(GetMainWidget().FindAnyWidget("Render"));
44 item_preview.SetItem(entity_ai);
45 item_preview.SetView(entity_ai.GetViewIndex());
46#endif
47 }
48
50 {
51 if (w == null)
52 return;
53
55 parent_container.DraggingOverHeader(w, x, y, receiver);
56 }
57
59 {
61 parent_container.OnDropReceivedFromHeader(w, x, y, receiver);
62 }
63
64 override void SetActive(bool active)
65 {
66 super.SetActive(active);
67
68 if (active)
69 GetMainWidget().SetColor(ARGBF(1, 1, 0, 0));
70 else
71 GetMainWidget().SetColor(m_DefaultColor);
72 }
73
75 {
77 }
78}
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
Icon x
Icon y
Widget m_Parent
Definition SizeToChild.c:86
Definition Header.c:2
void OnDropReceivedFromHeader(Widget w, int x, int y, Widget receiver)
Definition Header.c:58
EntityAI m_Entity
Definition Header.c:6
void DraggingOverHeader(Widget w, int x, int y, Widget receiver)
Definition Header.c:49
int m_DefaultFontSize
Definition Header.c:4
Widget m_DownArrowButton
Definition Header.c:10
void ShowCollapseButton(bool state)
Definition Header.c:74
void SetItemPreview(EntityAI entity_ai)
Definition Header.c:39
void SetName(string name)
Definition Header.c:33
override void SetActive(bool active)
Definition Header.c:64
int m_DefaultColor
Definition Header.c:3
Widget m_CollapseButton
Definition Header.c:8
Widget m_UpArrowButton
Definition Header.c:9
TextWidget m_HeaderText
Definition Header.c:11
void Header(LayoutHolder parent, string function_name)
Definition Header.c:13
static WidgetEventHandler GetInstance()
proto native Widget FindAnyWidget(string pathname)
int ARGBF(float fa, float fr, float fg, float fb)
Converts <0.0, 1.0> ARGB into color.
Definition proto.c:332