4 [
Attribute(
"", UIWidgets.ResourceAssignArray,
"")]
5 protected ref array<ref ResourceName> m_aResourceNames;
7 protected ref array<ref SCR_ImageGalleryButtonComponent> m_aImages =
new array <ref SCR_ImageGalleryButtonComponent>;
9 private Widget m_wPagingSpinbox;
16 protected ref array<Widget> m_aElementWidgets =
new array<Widget>();
23 Widget m_wGalleryGrid;
25 protected int m_iSelectedItemIndex;
26 protected ImageWidget m_MainImage;
28 protected WorkspaceWidget m_Workspace;
29 protected bool m_bItemSelected =
false;
31 protected const ResourceName LAYOUT_GALLERY_ELEMENT =
"{F7C52551E0B04BE1}UI/layouts/WidgetLibrary/ImageWidgets/WLib_ImageGalleryItem.layout";
34 override void HandlerAttached(Widget w)
36 super.HandlerAttached(w);
47 m_wGalleryGrid =
m_wRoot.FindAnyWidget(
"GalleryGrid");
48 m_MainImage = ImageWidget.Cast(
m_wRoot.FindAnyWidget(
"MainImage"));
49 m_wPagingSpinbox =
m_wRoot.FindAnyWidget(
"PagingSpinbox");
54 if (m_wPagingSpinboxComponent)
55 m_wPagingSpinboxComponent.m_OnChanged.Insert(Paging);
62 if (!m_aResourceNames)
66 SetPagingLayout(0, m_aResourceNames.Count());
96 int AddItem(
string item)
99 if (!m_aResourceNames)
100 m_aResourceNames =
new array<ref ResourceName>;
102 i = m_aResourceNames.InsertAt(item, 0);
105 SetPagingLayout(0, m_aResourceNames.Count());
110 void RemoveItem(
int item)
112 if (!m_aResourceNames || item < 0 || item > m_aResourceNames.Count())
116 m_aResourceNames.Remove(item);
117 SetPagingLayout(0, m_aResourceNames.Count());
123 int GetCurrentIndex()
125 return m_iSelectedItemIndex;
129 string GetCurrentItem()
131 if (!m_aResourceNames || m_iSelectedItemIndex < 0 || m_iSelectedItemIndex >= m_aResourceNames.Count())
134 return m_aResourceNames[m_iSelectedItemIndex];
138 void OnImageSelected(
string item)
140 m_MainImage.LoadImageTexture(0,item,
false,
true);
144 void SetPagingLayout(
int index,
int maxIndex)
147 m_wPagingSpinboxComponent.SetCurrentItem(
index);
148 m_wPagingSpinboxComponent.SetPageCount(maxIndex);
149 if (m_aResourceNames && !m_aResourceNames.IsEmpty())
150 OnImageSelected(m_aResourceNames[0]);
156 if (!m_aResourceNames.IsEmpty())
157 OnImageSelected(m_aResourceNames[m_wPagingSpinboxComponent.GetCurrentIndex()]);
160 void SetCanNavigate(
bool canNavigate)
162 m_wPagingSpinboxComponent.SetCanNavigate(canNavigate);