Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ImageGalleryComponent.c
Go to the documentation of this file.
1//------------------------------------------------------------------------------------------------
3{
4 [Attribute("", UIWidgets.ResourceAssignArray, "")]
5 protected ref array<ref ResourceName> m_aResourceNames;
6
7 protected ref array<ref SCR_ImageGalleryButtonComponent> m_aImages = new array <ref SCR_ImageGalleryButtonComponent>;
8
9 private Widget m_wPagingSpinbox;
10 private SCR_SpinBoxPagingComponent m_wPagingSpinboxComponent;
11
12
13 //[Attribute(defvalue: "", desc: "When the texture is an image set, define the quad name here")]
14 //private string m_sImageName;
15
16 protected ref array<Widget> m_aElementWidgets = new array<Widget>();
18
19 //protected ScrollLayoutWidget m_wScrollLayout;
20
22
24
25 protected int m_iSelectedItemIndex;
27
29 protected bool m_bItemSelected = false;
30
31 protected const ResourceName LAYOUT_GALLERY_ELEMENT = "{F7C52551E0B04BE1}UI/layouts/WidgetLibrary/ImageWidgets/WLib_ImageGalleryItem.layout";
32
33 //------------------------------------------------------------------------------------------------
34 override void HandlerAttached(Widget w)
35 {
36 super.HandlerAttached(w);
37 m_wRoot = w;
38 Init();
39 }
40
41 //------------------------------------------------------------------------------------------------
42 void Init()
43 {
44 if (!m_wRoot)
45 return;
46
47 m_wGalleryGrid = m_wRoot.FindAnyWidget("GalleryGrid");
48 m_MainImage = ImageWidget.Cast(m_wRoot.FindAnyWidget("MainImage"));
49 m_wPagingSpinbox = m_wRoot.FindAnyWidget("PagingSpinbox");
50 if (m_wPagingSpinbox)
51 {
52 m_wPagingSpinboxComponent = SCR_SpinBoxPagingComponent.Cast(m_wPagingSpinbox.FindHandler(SCR_SpinBoxPagingComponent));
53
54 if (m_wPagingSpinboxComponent)
55 m_wPagingSpinboxComponent.m_OnChanged.Insert(Paging);
56 }
57 m_Workspace = GetGame().GetWorkspace();
58
59 if (!m_Workspace)
60 return;
61
63 return;
64
65
67
68 /*
69 foreach (ResourceName content : m_aResourceNames)
70 {
71 // Create tab button
72 Widget button = m_Workspace.CreateWidgets(LAYOUT_GALLERY_ELEMENT, m_wGalleryGrid);
73
74 if (!button)
75 continue;
76
77 SCR_ImageGalleryButtonComponent galleryButtonComponent = SCR_ImageGalleryButtonComponent.Cast(button.FindHandler(SCR_ImageGalleryButtonComponent));
78
79 if (!galleryButtonComponent)
80 continue;
81
82 galleryButtonComponent.SetImage(content);
83 galleryButtonComponent.m_OnClicked.Insert(OnImageSelected);
84 HorizontalLayoutSlot.SetPadding(button, 4, 4, 4, 4);
85 m_aImages.Insert(galleryButtonComponent);
86 if (!m_aImages.IsEmpty() && !m_bItemSelected)
87 OnImageSelected(m_aImages[0]);
88
89 }
90 */
91
92
93 }
94
95 //------------------------------------------------------------------------------------------------
96 int AddItem(string item)
97 {
98 int i = -1;
100 m_aResourceNames = new array<ref ResourceName>;
101
102 i = m_aResourceNames.InsertAt(item, 0);
103
104
106 return i;
107 }
108
109 //------------------------------------------------------------------------------------------------
110 void RemoveItem(int item)
111 {
112 if (!m_aResourceNames || item < 0 || item > m_aResourceNames.Count())
113 return;
114
115 //m_aElementWidgets[item].RemoveFromHierarchy();
116 m_aResourceNames.Remove(item);
118 //m_iSelectedItemIndex = -1;
119
120 }
121
122 //------------------------------------------------------------------------------------------------
124 {
126 }
127
128 //------------------------------------------------------------------------------------------------
130 {
132 return string.Empty;
133
135 }
136
137 //------------------------------------------------------------------------------------------------
138 void OnImageSelected(string item)
139 {
140 m_MainImage.LoadImageTexture(0,item, false, true);
141 }
142
143 //------------------------------------------------------------------------------------------------
144 void SetPagingLayout(int index, int maxIndex)
145 {
146
147 m_wPagingSpinboxComponent.SetCurrentItem(index);
148 m_wPagingSpinboxComponent.SetPageCount(maxIndex);
149 if (m_aResourceNames && !m_aResourceNames.IsEmpty())
151 }
152
153 //------------------------------------------------------------------------------------------------
154 void Paging()
155 {
156 if (!m_aResourceNames.IsEmpty())
157 OnImageSelected(m_aResourceNames[m_wPagingSpinboxComponent.GetCurrentIndex()]);
158 }
159
160 void SetCanNavigate(bool canNavigate)
161 {
162 m_wPagingSpinboxComponent.SetCanNavigate(canNavigate);
163 }
164
165
166
167
168};
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
SCR_FieldOfViewSettings Attribute