Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
scriptconsoleuniversalinfodialog.c
Go to the documentation of this file.
1 class ScriptConsoleUniversalInfoDialog extends UIScriptedMenu
2 {
3  private const int EDITBOX_TEXT_SIZE = 16;
4 
5  private TextWidget m_Label;
6  private ScrollWidget m_ContentScroll;
7  private MultilineEditBoxWidget m_Content;
8  private ButtonWidget m_OKButton;
9 
10  void ScriptConsoleUniversalInfoDialog();
11  void ~ScriptConsoleUniversalInfoDialog();
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);
35  ScriptConsoleItemsTab tab = ScriptConsoleItemsTab.Cast(scriptedConsole.GetTabHandler(ScriptConsoleItemsTab));
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  {
64  m_ContentScroll.SetAlpha(1);
65  }
66  }
67 }
GetGame
proto native CGame GetGame()
UIScriptedMenu
Definition: dayzgame.c:63
Close
void Close()
y
Icon y
MENU_SCRIPTCONSOLE
const int MENU_SCRIPTCONSOLE
Definition: constants.c:175
ScriptConsoleItemsTab
Definition: scriptconsoleitemstab.c:3
Init
class InventoryGridController extends ScriptedWidgetEventHandler Init
Definition: uihintpanel.c:46
TextWidget
Definition: enwidgets.c:219
x
Icon x
IDC_OK
const int IDC_OK
Definition: constants.c:127
Widget
Definition: enwidgets.c:189
OnClick
override bool OnClick(Widget w, int x, int y, int button)
buttons clicks
Definition: dayzgame.c:146