Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_ContentEntryComponent.c
Go to the documentation of this file.
1 // Base for Mods & Scenario entries
3 
4 //------------------------------------------------------------------------------------------------
6 {
7  //const string WIDGET_ = "";
8  const string WIDGET_IMAGE_THUMBNAIL = "ImgThumbnail";
9  const string WIDGET_TEXT_LABEL = "TxtLabel";
10  const string WIDGET_TEXT_DESCRIPTION = "TxtDescription";
11  const string WIDGET_BTN_DOWNLOAD = "BtnDownload";
12 
13  // Widgets
14  protected ImageWidget m_wImgThumbnail;
15  protected TextWidget m_wTxtLabel;
16  protected TextWidget m_wTxtDescription;
17 
18  //------------------------------------------------------------------------------------------------
19  override void HandlerAttached(Widget w)
20  {
21  super.HandlerAttached(w);
22 
23  // Get widgets
24  m_wImgThumbnail = ImageWidget.Cast(w.FindAnyWidget(WIDGET_IMAGE_THUMBNAIL));
25  m_wTxtLabel = TextWidget.Cast(w.FindAnyWidget(WIDGET_TEXT_LABEL));
26  m_wTxtDescription = TextWidget.Cast(w.FindAnyWidget(WIDGET_TEXT_DESCRIPTION));
27  }
28 
29  //------------------------------------------------------------------------------------------------
31  protected void SetTextSafe(TextWidget txt, string str)
32  {
33  if (txt)
34  txt.SetText(str);
35  }
36 
37  //------------------------------------------------------------------------------------------------
38  void SetLabelText(string str) { SetTextSafe(m_wTxtLabel, str); }
39 
40  //------------------------------------------------------------------------------------------------
41  void SetDescriptionText(string str) { SetTextSafe(m_wTxtDescription, str); }
42 
43  //------------------------------------------------------------------------------------------------
44  void SetThumbnail(ResourceName image)
45  {
46  if (image.IsEmpty())
47  return;
48 
49  if (m_wImgThumbnail)
50  {
51  m_wImgThumbnail.LoadImageTexture(0, image, false, true);
52  int sx, sy;
53  m_wImgThumbnail.GetImageSize(0, sx, sy);
54  m_wImgThumbnail.SetSize(sx, sy);
55  }
56  }
57 
58 
59 };
SCR_ButtonBaseComponent
Base class for any button, regardless its own content.
Definition: SCR_ButtonBaseComponent.c:3
SCR_ContentEntryComponent
Base component for widgets displaying content data.
Definition: SCR_ContentEntryComponent.c:5