Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
scriptconsolerenamepresetdialog.c
Go to the documentation of this file.
1 class ScriptConsoleRenamePresetDialog extends UIScriptedMenu
2 {
3  void ScriptConsoleRenamePresetDialog()
4  {
5 
6  }
7 
8  void ~ScriptConsoleRenamePresetDialog()
9  {
10  }
11 
12  override Widget Init()
13  {
14  layoutRoot = GetGame().GetWorkspace().CreateWidgets("gui/layouts/script_console/script_console_dialog_preset.layout");
15  m_Editbox = EditBoxWidget.Cast( layoutRoot.FindAnyWidget("PrimaryEditBox") );
16  m_Label = TextWidget.Cast( layoutRoot.FindAnyWidget("WindowLabel") );
17  m_Message = TextWidget.Cast( layoutRoot.FindAnyWidget("MessageText") );
18 
19  MissionBase mission = MissionBase.Cast( GetGame().GetMission() );
20 
21  UIScriptedMenu ui_menu = GetGame().GetUIManager().FindMenu(MENU_SCRIPTCONSOLE);
22  if ( ui_menu != NULL )
23  {
24  ScriptConsole scripted_console = ScriptConsole.Cast( ui_menu );
25  ScriptConsoleItemsTab tab = ScriptConsoleItemsTab.Cast(scripted_console.GetTabHandler(ScriptConsoleItemsTab));
26  if (tab)
27  {
28  m_Editbox.SetText( tab.GetCurrentPresetName() );
29  m_Label.SetText("RENAME PRESET");
30  m_Message.SetText( tab.GetCurrentPresetName() );
31  }
32  }
33 
34  return layoutRoot;
35  }
36 
37  override bool OnClick(Widget w, int x, int y, int button)
38  {
39  super.OnClick(w, x, y, button);
40 
41  if (w.GetUserID() == IDC_OK)
42  {
43  UIScriptedMenu ui_menu = GetGame().GetUIManager().FindMenu(MENU_SCRIPTCONSOLE);
44  if ( ui_menu != NULL )
45  {
46  ScriptConsole scripted_console = ScriptConsole.Cast( ui_menu );
47  ScriptConsoleItemsTab tab = ScriptConsoleItemsTab.Cast(scripted_console.GetTabHandler(ScriptConsoleItemsTab));
48  if (tab)
49  {
50  tab.RenamePreset( m_Editbox.GetText() );
51  Close();
52  return true;
53  }
54  }
55  }
56  else if (w.GetUserID() == IDC_CANCEL)
57  {
58  Close();
59  return true;
60  }
61 
62  return false;
63  }
64 
65  EditBoxWidget m_Editbox;
66  TextWidget m_Label;
67  TextWidget m_Message;
68 }
GetGame
proto native CGame GetGame()
UIScriptedMenu
Definition: dayzgame.c:63
mission
Mission mission
Definition: displaystatus.c:28
IDC_CANCEL
const int IDC_CANCEL
Definition: constants.c:128
EditBoxWidget
Definition: enwidgets.c:353
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
MissionBase
Definition: missiongameplay.c:1