DayZ 1.24
Loading...
Searching...
No Matches
ClosableHeader Class Reference
Inheritance diagram for ClosableHeader:
[legend]
Collaboration diagram for ClosableHeader:
[legend]

Protected Member Functions

void ClosableHeader (LayoutHolder parent, string function_name)
 
void ~ClosableHeader ()
 
override void SetLayoutName ()
 
override void SetName (string name)
 
void OnDragHeader (Widget w, int x, int y)
 
void UpdateFlip (bool flipped)
 
void OnDropHeader (Widget w)
 
bool MouseEnter (Widget w, int x, int y)
 
bool MouseLeave (Widget w, Widget enter_w, int x, int y)
 
override void SetActive (bool active)
 

Protected Attributes

float m_SquareSize
 
int m_DefaultSort
 
Widget m_MovePanel
 
Widget m_PanelWidget
 
Widget m_DragRender
 
ButtonWidget m_MoveUp
 
ButtonWidget m_MoveDown
 
bool m_IsInLocalEquipment
 

Additional Inherited Members

- Private Member Functions inherited from Header
void Header (LayoutHolder parent, string function_name)
 
void SetName (string name)
 
void SetItemPreview (EntityAI entity_ai)
 
void DraggingOverHeader (Widget w, int x, int y, Widget receiver)
 
void OnDropReceivedFromHeader (Widget w, int x, int y, Widget receiver)
 
override void SetActive (bool active)
 
void ShowCollapseButton (bool state)
 
- Private Attributes inherited from Header
int m_DefaultColor
 
int m_DefaultFontSize
 
EntityAI m_Entity
 
Widget m_CollapseButton
 
Widget m_UpArrowButton
 
Widget m_DownArrowButton
 
TextWidget m_HeaderText
 

Detailed Description

Definition at line 1 of file ClosableHeader.c.

Constructor & Destructor Documentation

◆ ClosableHeader()

void ClosableHeader::ClosableHeader ( LayoutHolder parent,
string function_name )
inlineprotected

Definition at line 14 of file ClosableHeader.c.

15 {
16 m_MovePanel = GetMainWidget().FindAnyWidget("MovePanel");
17 m_PanelWidget = GetMainWidget().FindAnyWidget("PanelWidget");
18 m_DragRender = GetMainWidget().FindAnyWidget("Drag_Render");
19 m_MoveUp = ButtonWidget.Cast(GetMainWidget().FindAnyWidget("MoveUp"));
20 m_MoveDown = ButtonWidget.Cast(GetMainWidget().FindAnyWidget("MoveDown"));
21
22 WidgetEventHandler.GetInstance().RegisterOnClick(m_MoveUp, m_Parent, "MoveContainerUp");
23 WidgetEventHandler.GetInstance().RegisterOnClick(m_MoveDown, m_Parent, "MoveContainerDown");
24 WidgetEventHandler.GetInstance().RegisterOnMouseLeave(m_MoveUp, this, "MouseLeave");
25 WidgetEventHandler.GetInstance().RegisterOnMouseLeave(m_MoveDown, this, "MouseLeave");
26
27 WidgetEventHandler.GetInstance().RegisterOnDrag(GetMainWidget(), this, "OnDragHeader");
28 WidgetEventHandler.GetInstance().RegisterOnDrop(GetMainWidget(), this, "OnDropHeader");
29
30 WidgetEventHandler.GetInstance().RegisterOnMouseEnter(GetMainWidget(), this, "MouseEnter");
31 WidgetEventHandler.GetInstance().RegisterOnMouseLeave(GetMainWidget(), this, "MouseLeave");
32
33 float temp;
34 GetMainWidget().GetScreenSize(temp, m_SquareSize);
35
36 m_DefaultColor = m_PanelWidget.GetColor();
38
40 m_IsInLocalEquipment = GetParent().GetParent().GetParent().IsInherited(RightArea);
41 }
Widget m_Parent
Definition SizeToChild.c:86
ButtonWidget m_MoveUp
ButtonWidget m_MoveDown
int m_DefaultFontSize
Definition Header.c:4
int m_DefaultColor
Definition Header.c:3
static WidgetEventHandler GetInstance()
proto native Widget GetParent()
Get parent of the Effect.
Definition Effect.c:389
proto native Widget FindAnyWidget(string pathname)

References FindAnyWidget(), WidgetEventHandler::GetInstance(), GetParent(), Header::m_DefaultColor, Header::m_DefaultFontSize, m_DragRender, m_IsInLocalEquipment, m_MoveDown, m_MovePanel, m_MoveUp, m_PanelWidget, m_Parent, and m_SquareSize.

◆ ~ClosableHeader()

void ClosableHeader::~ClosableHeader ( )
inlineprotected

Definition at line 43 of file ClosableHeader.c.

44 {
45 if (InventoryItem.Cast(m_Entity))
46 InventoryItem.Cast(m_Entity).GetOnItemFlipped().Remove(UpdateFlip);
47 }
void UpdateFlip(bool flipped)
EntityAI m_Entity
Definition Header.c:6

References Header::m_Entity, and UpdateFlip().

Member Function Documentation

◆ MouseEnter()

bool ClosableHeader::MouseEnter ( Widget w,
int x,
int y )
inlineprotected

Definition at line 143 of file ClosableHeader.c.

144 {
146 {
147#ifdef PLATFORM_CONSOLE
148 m_MovePanel.Show(GetGame().GetInput().IsEnabledMouseAndKeyboardEvenOnServer());
149#else
150 m_MovePanel.Show(true);
151#endif
152 }
153 PrepareOwnedTooltip(m_Entity, x, y);
154 return true;
155 }
ActionInput GetInput()
Definition ActionBase.c:989
Icon x
Icon y
proto native CGame GetGame()
proto native Widget GetDragWidget()

References GetDragWidget(), GetGame(), GetInput(), Header::m_Entity, m_IsInLocalEquipment, m_MovePanel, x, and y.

◆ MouseLeave()

bool ClosableHeader::MouseLeave ( Widget w,
Widget enter_w,
int x,
int y )
inlineprotected

Definition at line 157 of file ClosableHeader.c.

158 {
160 {
162 m_MovePanel.Show(false);
163 }
164 HideOwnedTooltip();
165 return true;
166 }
Widget m_CollapseButton
Definition Header.c:8

References Header::m_CollapseButton, m_IsInLocalEquipment, m_MoveDown, m_MovePanel, and m_MoveUp.

◆ OnDragHeader()

void ClosableHeader::OnDragHeader ( Widget w,
int x,
int y )
inlineprotected

Definition at line 66 of file ClosableHeader.c.

67 {
69 if (parent && GetMainWidget() && m_Entity)
70 {
72 item_preview_drag.SetFlags(WidgetFlags.EXACTPOS);
73 m_DefaultSort = GetRootWidget().GetSort();
74 item_preview_drag.GetParent().GetParent().GetParent().GetParent().GetParent().GetParent().GetParent().GetParent().AddChild(GetRootWidget());
76 {
78 item_preview_drag.SetView(m_Entity.GetViewIndex());
79 }
80
81 ItemManager.GetInstance().SetIsDragging(true);
82
83 parent.HideContent(true);
84
85 m_PanelWidget.Show(false);
87 item_preview_drag.Show(true);
88
89 int ww, hh;
90 GetGame().GetInventoryItemSize(InventoryItem.Cast(m_Entity), ww, hh);
92 {
93 m_Entity.GetOnItemFlipped().Insert(UpdateFlip);
94 if (m_Entity.GetInventory().GetFlipCargo())
96 else
98 }
99 }
100 }
static ItemManager GetInstance()
WidgetFlags
Definition EnWidgets.c:58

References GetGame(), ItemManager::GetInstance(), m_DefaultSort, m_DragRender, Header::m_Entity, m_PanelWidget, m_Parent, m_SquareSize, and UpdateFlip().

◆ OnDropHeader()

void ClosableHeader::OnDropHeader ( Widget w)
inlineprotected

Definition at line 116 of file ClosableHeader.c.

117 {
119 parent.GetMainWidget().AddChild(GetRootWidget());
120 GetRootWidget().SetSort(0);
121 if (parent)
122 {
123 //
126 {
127 item_preview_drag.SetItem(null); //TODO: is this safe?
128 }
129 //
130
131 m_PanelWidget.Show(true);
132 m_DragRender.Show(false);
133
134 parent.ShowContent(true);
135
136 ItemManager.GetInstance().HideDropzones();
137 ItemManager.GetInstance().SetIsDragging(false);
138 }
139 if (InventoryItem.Cast(m_Entity))
140 InventoryItem.Cast(m_Entity).GetOnItemFlipped().Remove(UpdateFlip);
141 }

References ItemManager::GetInstance(), m_DragRender, Header::m_Entity, m_PanelWidget, m_Parent, and UpdateFlip().

◆ SetActive()

override void ClosableHeader::SetActive ( bool active)
inlineprotected

Definition at line 168 of file ClosableHeader.c.

169 {
170 super.SetActive(active);
171 if (active)
172 m_PanelWidget.SetColor(ARGBF(1, 1, 0, 0));
173 else
175 }
int ARGBF(float fa, float fr, float fg, float fb)
Converts <0.0, 1.0> ARGB into color.
Definition proto.c:332

References ARGBF(), Header::m_DefaultColor, and m_PanelWidget.

◆ SetLayoutName()

override void ClosableHeader::SetLayoutName ( )
inlineprotected

Definition at line 49 of file ClosableHeader.c.

50 {
51 m_LayoutName = WidgetLayoutName.ClosableHeader;
52 }
const string ClosableHeader

References WidgetLayoutName::ClosableHeader.

◆ SetName()

override void ClosableHeader::SetName ( string name)
inlineprotected

Definition at line 54 of file ClosableHeader.c.

55 {
56 name.ToUpper();
57
58 m_HeaderText.SetText(name);
59 m_HeaderText.Update();
60
61 float x, y;
62 m_HeaderText.GetScreenSize(x, y);
63 m_PanelWidget.SetSize(1, y + InventoryMenu.GetHeightMultiplied(10));
64 }
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
void InventoryMenu()
TextWidget m_HeaderText
Definition Header.c:11

References InventoryMenu(), Header::m_HeaderText, m_PanelWidget, name, x, and y.

◆ UpdateFlip()

void ClosableHeader::UpdateFlip ( bool flipped)
inlineprotected

Definition at line 102 of file ClosableHeader.c.

103 {
106 {
107 int ww, hh;
108 GetGame().GetInventoryItemSize(InventoryItem.Cast(m_Entity), ww, hh);
109 if (flipped)
111 else
113 }
114 }

References GetGame(), m_DragRender, Header::m_Entity, and m_SquareSize.

Referenced by OnDragHeader(), OnDropHeader(), and ~ClosableHeader().

Member Data Documentation

◆ m_DefaultSort

int ClosableHeader::m_DefaultSort
protected

Definition at line 4 of file ClosableHeader.c.

Referenced by OnDragHeader().

◆ m_DragRender

Widget ClosableHeader::m_DragRender
protected

Definition at line 8 of file ClosableHeader.c.

Referenced by ClosableHeader(), OnDragHeader(), OnDropHeader(), and UpdateFlip().

◆ m_IsInLocalEquipment

bool ClosableHeader::m_IsInLocalEquipment
protected

Definition at line 12 of file ClosableHeader.c.

Referenced by ClosableHeader(), MouseEnter(), and MouseLeave().

◆ m_MoveDown

ButtonWidget ClosableHeader::m_MoveDown
protected

Definition at line 10 of file ClosableHeader.c.

Referenced by ClosableHeader(), and MouseLeave().

◆ m_MovePanel

Widget ClosableHeader::m_MovePanel
protected

Definition at line 6 of file ClosableHeader.c.

Referenced by ClosableHeader(), MouseEnter(), and MouseLeave().

◆ m_MoveUp

ButtonWidget ClosableHeader::m_MoveUp
protected

Definition at line 9 of file ClosableHeader.c.

Referenced by ClosableHeader(), and MouseLeave().

◆ m_PanelWidget

Widget ClosableHeader::m_PanelWidget
protected

Definition at line 7 of file ClosableHeader.c.

Referenced by ClosableHeader(), OnDragHeader(), OnDropHeader(), SetActive(), and SetName().

◆ m_SquareSize

float ClosableHeader::m_SquareSize
protected

Definition at line 3 of file ClosableHeader.c.

Referenced by ClosableHeader(), OnDragHeader(), and UpdateFlip().


The documentation for this class was generated from the following file: