Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_WorkshopAddonLineComponent.c
Go to the documentation of this file.
1 /*
2 Component to be attached to addon lines.
3 */
4 
5 //----------------------------------------------------------------------------------------------
7 {
8  protected ref SCR_WorkshopDownloadSequence m_DownloadRequest;
9 
10  //------------------------------------------------------------------------------------------------
11  override bool OnClick(Widget w, int x, int y, int button)
12  {
13  bool result = super.OnClick(w, x, y, button);
14  OnOpenDetailsButton();
15 
16  return result;
17  }
18 
19  //----------------------------------------------------------------------------------------------
20  override void HandlerDeattached(Widget w)
21  {
22  super.HandlerDeattached(w);
23 
24  if (m_Item)
25  m_Item.m_OnChanged.Remove(UpdateAllWidgets);
26  }
27 
28  //----------------------------------------------------------------------------------------------
29  override void Init(SCR_WorkshopItem item)
30  {
31  super.Init(item);
32 
33  // OnChanged is called whenever something happens with the workshop item.
34  // Simplest approach is to refresh whole line associated with the workshop item on this event.
35  item.m_OnChanged.Insert(UpdateAllWidgets);
36  }
37 
38  //----------------------------------------------------------------------------------------------
39  override void OnDeleteButton()
40  {
41  super.OnDeleteButton();
42 
43  SCR_DeleteAddonDialog.CreateDeleteAddon(m_Item);
44  }
45 
46  //----------------------------------------------------------------------------------------------
47  override void OnActionButton()
48  {
49  super.OnActionButton();
50 
51  if (!m_Item)
52  return;
53 
54  SCR_WorkshopUiCommon.ExecutePrimaryAction(m_Item, m_DownloadRequest);
55  }
56 
57  //----------------------------------------------------------------------------------------------
58  override void OnUpdateButton()
59  {
60  super.OnUpdateButton();
61 
62  if (!m_Item)
63  return;
64 
65  SCR_WorkshopUiCommon.ExecutePrimaryAction(m_Item, m_DownloadRequest);
66  }
67 
68  //----------------------------------------------------------------------------------------------
69  override void UpdateAllWidgets()
70  {
71  if (m_bCanUpdate && m_Item)
72  HandleEnableButtons(m_Item.GetEnabled());
73 
74  super.UpdateAllWidgets();
75  }
76 
77  //----------------------------------------------------------------------------------------------
78  bool IsWorkshopItemEnabled()
79  {
80  if (!m_Item)
81  return false;
82 
83  return m_Item.GetEnabled();
84  }
85 }
SCR_AddonLineBaseComponent
Definition: SCR_AddonLineBaseComponent.c:7
SCR_DeleteAddonDialog
private void SCR_DeleteAddonDialog(SCR_WorkshopItem item, string preset)
Definition: SCR_WorkshopUiCommon.c:615
SCR_WorkshopDownloadSequence
Definition: SCR_WorkshopDownloadSequence.c:9
m_Item
NewsFeedItem m_Item
Definition: SCR_NewsSubMenu.c:2
SCR_WorkshopItem
Definition: SCR_WorkshopItem.c:21
SCR_WorkshopAddonLineComponent
Definition: SCR_WorkshopAddonLineComponent.c:6
m_DownloadRequest
protected ref SCR_WorkshopDownloadSequence m_DownloadRequest
Definition: SCR_ContentBrowser_AddonsSubMenu.c:50
SCR_WorkshopUiCommon
Definition: SCR_WorkshopUiCommon.c:5