Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
modsmenusimpleentry.c
Go to the documentation of this file.
1
class
ModsMenuSimpleEntry
extends
ScriptedWidgetEventHandler
2
{
3
protected
ButtonWidget
m_ModButton
;
4
protected
ImageWidget
m_Icon
;
5
protected
Widget
m_Hover
;
6
7
protected
bool
m_HasLogoOver
;
8
protected
ModInfo
m_Data
;
9
protected
ModsMenuSimple
m_ParentMenu
;
10
11
void
ModsMenuSimpleEntry
(
ModInfo
data,
int
index,
Widget
parent,
ModsMenuSimple
parent_menu)
12
{
13
m_ModButton
= ButtonWidget.Cast(
g_Game
.GetWorkspace().CreateWidgets(
"gui/layouts/new_ui/mods_menu/mods_menu_simple_entry.layout"
, parent));
14
m_Icon
= ImageWidget.Cast(
m_ModButton
.FindAnyWidget(
"Icon"
));
15
m_Hover
=
m_ModButton
.FindAnyWidget(
"Overlay"
);
16
m_Data
= data;
17
m_ParentMenu
= parent_menu;
18
19
m_ModButton
.SetSort(index);
20
m_ModButton
.SetHandler(
this
);
21
22
LoadData
();
23
}
24
25
void
~ModsMenuSimpleEntry
()
26
{
27
delete
m_ModButton
;
28
}
29
30
void
LoadData
()
31
{
32
string
logo =
m_Data
.GetLogo();
33
string
logo_over =
m_Data
.GetLogoOver();
34
35
if
(logo !=
""
)
36
{
37
m_Icon
.LoadImageFile(0, logo);
38
}
39
else
40
{
41
m_Icon
.LoadImageFile(0,
ModInfo
.
DEFAULT_LOGO
);
42
}
43
44
if
(logo_over !=
""
)
45
{
46
m_Icon
.LoadImageFile(1, logo_over);
47
}
48
else
49
{
50
m_Icon
.LoadImageFile(1,
ModInfo
.
DEFAULT_LOGO_OVER
);
51
}
52
m_HasLogoOver
=
true
;
53
}
54
55
override
bool
OnClick
(
Widget
w,
int
x
,
int
y
,
int
button)
56
{
57
if
( w ==
m_ModButton
)
58
{
59
m_ParentMenu
.Select(
m_Data
);
60
return
true
;
61
}
62
return
false
;
63
}
64
65
override
bool
OnMouseEnter
(
Widget
w,
int
x
,
int
y
)
66
{
67
if
( w ==
m_ModButton
)
68
{
69
if
(
m_HasLogoOver
)
70
m_Icon
.SetImage( 1 );
71
m_Hover
.Show(
true
);
72
return
true
;
73
}
74
return
false
;
75
}
76
77
override
bool
OnMouseLeave
(
Widget
w,
Widget
enterW,
int
x
,
int
y
)
78
{
79
if
( enterW !=
m_ModButton
)
80
{
81
if
(
m_HasLogoOver
)
82
m_Icon
.SetImage( 0 );
83
m_Hover
.Show(
false
);
84
return
true
;
85
}
86
return
false
;
87
}
88
89
override
bool
OnFocus
(
Widget
w,
int
x
,
int
y
)
90
{
91
if
( w ==
m_ModButton
)
92
{
93
if
(
m_HasLogoOver
)
94
m_Icon
.SetImage( 1 );
95
m_Hover
.Show(
true
);
96
return
true
;
97
}
98
return
false
;
99
}
100
101
override
bool
OnFocusLost
(
Widget
w,
int
x
,
int
y
)
102
{
103
if
( w ==
m_ModButton
)
104
{
105
if
(
m_HasLogoOver
)
106
m_Icon
.SetImage( 0 );
107
m_Hover
.Show(
false
);
108
return
true
;
109
}
110
return
false
;
111
}
112
}
ModInfo
Definition
modinfo.c:2
ModInfo::DEFAULT_LOGO
static const string DEFAULT_LOGO
Definition
modinfo.c:19
ModInfo::DEFAULT_LOGO_OVER
static const string DEFAULT_LOGO_OVER
Definition
modinfo.c:21
ScriptedWidgetEventHandler
map: item x vector(index, width, height)
Definition
enwidgets.c:657
ScriptedWidgetEventHandler::m_ModButton
ButtonWidget m_ModButton
Definition
modsmenusimpleentry.c:3
ScriptedWidgetEventHandler::m_ParentMenu
ModsMenuDetailed m_ParentMenu
Definition
modsmenudetailedentry.c:22
ScriptedWidgetEventHandler::~ModsMenuSimpleEntry
void ~ModsMenuSimpleEntry()
Definition
modsmenusimpleentry.c:25
ScriptedWidgetEventHandler::m_HasLogoOver
bool m_HasLogoOver
Definition
modsmenusimpleentry.c:7
ScriptedWidgetEventHandler::OnMouseLeave
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
Definition
modsmenusimpleentry.c:77
ScriptedWidgetEventHandler::m_Icon
ImageWidget m_Icon
Definition
modsmenusimpleentry.c:4
ScriptedWidgetEventHandler::m_Data
ref map< ref ModInfo, ref ModsMenuDetailedEntry > m_Data
Definition
modsmenudetailed.c:7
ScriptedWidgetEventHandler::LoadData
void LoadData()
Definition
modsmenudetailedentry.c:95
ScriptedWidgetEventHandler::ModsMenuSimple
void ModsMenuSimple(array< ref ModInfo > data, Widget parent, ModsMenuDetailed detail_menu)
Definition
modsmenusimple.c:11
ScriptedWidgetEventHandler::OnFocusLost
override bool OnFocusLost(Widget w, int x, int y)
Definition
modsmenusimpleentry.c:101
ScriptedWidgetEventHandler::m_Hover
Widget m_Hover
Definition
modsmenusimpleentry.c:5
ScriptedWidgetEventHandler::OnMouseEnter
override bool OnMouseEnter(Widget w, int x, int y)
Definition
modsmenusimpleentry.c:65
ScriptedWidgetEventHandler::ModsMenuSimpleEntry
void ModsMenuSimpleEntry(ModInfo data, int index, Widget parent, ModsMenuSimple parent_menu)
Definition
modsmenusimpleentry.c:11
ScriptedWidgetEventHandler::OnFocus
override bool OnFocus(Widget w, int x, int y)
Definition
modsmenusimpleentry.c:89
ScriptedWidgetEventHandler::OnClick
override bool OnClick(Widget w, int x, int y, int button)
Definition
modsmenusimpleentry.c:55
Widget
Definition
enwidgets.c:190
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
x
Icon x
y
Icon y
Games
Dayz
scripts
5_mission
gui
newui
modsmenu
modsmenusimpleentry.c
Generated by
1.17.0