DayZ 1.24
Loading...
Searching...
No Matches
ScriptConsoleUniversalInfoDialog.c
Go to the documentation of this file.
1class ScriptConsoleUniversalInfoDialog extends UIScriptedMenu
2{
3 private const int EDITBOX_TEXT_SIZE = 16;
4
5 private TextWidget m_Label;
9
12
13 override Widget Init()
14 {
15 layoutRoot = GetGame().GetWorkspace().CreateWidgets("gui/layouts/script_console/script_console_universal_info_dialog.layout");
16 m_Label = TextWidget.Cast(layoutRoot.FindAnyWidget("Label"));
17 m_ContentScroll = ScrollWidget.Cast(layoutRoot.FindAnyWidget("ContentScroll"));
18 m_ContentScroll.VScrollToPos(0);
19 m_Content = MultilineEditBoxWidget.Cast(layoutRoot.FindAnyWidget("Content"));
20 m_OKButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("MessageText"));
21
22 return layoutRoot;
23 }
24
25 override bool OnClick(Widget w, int x, int y, int button)
26 {
27 super.OnClick(w, x, y, button);
28
29 if (w.GetUserID() == IDC_OK)
30 {
31 UIScriptedMenu consoleMenu = GetGame().GetUIManager().FindMenu(MENU_SCRIPTCONSOLE);
32 if (consoleMenu != null)
33 {
34 ScriptConsole scriptedConsole = ScriptConsole.Cast(consoleMenu);
36 if (tab)
37 {
38 Close();
39 return true;
40 }
41 }
42 }
43
44 return false;
45 }
46
47 void SetLabel(string label)
48 {
49 m_Label.SetText(label);
50 }
51
52 void SetContent(string content)
53 {
54 m_Content.SetText(content);
55 m_Content.Update();
56 float contentSizeX, contentSizeY = 0;
57 m_Content.GetSize(contentSizeX, contentSizeY);
58 m_Content.SetSize(contentSizeX, EDITBOX_TEXT_SIZE * m_Content.GetLinesCount());
59 float y_c = m_ContentScroll.GetContentHeight();
60 float x, y;
61 m_Content.GetScreenSize(x, y);
62 if (y > y_c)
63 m_ContentScroll.SetAlpha(1);
64 }
65}
Icon x
Icon y
void Close()
void SetContent(string content)
MultilineEditBoxWidget m_Content
void ~ScriptConsoleUniversalInfoDialog()
override bool OnClick(Widget w, int x, int y, int button)
void ScriptConsoleUniversalInfoDialog()
proto native CGame GetGame()
const int MENU_SCRIPTCONSOLE
Definition constants.c:175
const int IDC_OK
Definition constants.c:127