4 protected Widget m_DownIcon;
5 protected Widget m_ContentParent;
7 protected ScrollWidget m_ScrollWidget;
8 protected ref SizeToChild m_ContentResize;
9 protected bool m_ShouldChangeSize =
true;
10 protected bool m_IsProcessing =
false;
14 m_MainWidget.Show(
true,
false);
16 m_ContentParent = m_MainWidget.FindAnyWidget(
"ContentParent");
17 m_ContentParent.GetScript(m_ContentResize);
19 m_ScrollWidget = ScrollWidget.Cast(m_MainWidget.FindAnyWidget(
"Scroller"));
20 m_MainWidget = m_MainWidget.FindAnyWidget(
"Content");
26 m_Body.Insert(m_VicinityContainer);
30 WidgetEventHandler.GetInstance().RegisterOnChildRemove(m_MainWidget,
this,
"OnChildRemove");
31 RecomputeOpenedContainers();
34 override void UnfocusGrid()
37 for (
int i = 0; i < m_OpenedContainers.Count(); i++ )
39 active_container =
Container.Cast( m_OpenedContainers.Get( i ) );
40 active_container.UnfocusGrid();
44 override bool IsActive()
46 if( m_OpenedContainers.Count() <= m_ActiveIndex )
50 Container active_container =
Container.Cast( m_OpenedContainers.Get( m_ActiveIndex ) );
51 return active_container.IsActive( );
54 override void SetActive(
bool active )
56 super.SetActive( active );
58 UpdateSelectionIcons();
61 override ScrollWidget GetScrollWidget()
63 return m_ScrollWidget;
66 override void UpdateSelectionIcons()
68 #ifdef PLATFORM_CONSOLE
69 ScrollToActiveContainer();
76 m_UpIcon.GetScreenSize(
x,
y );
78 float top_y = GetCurrentContainerTopY();
79 m_UpIcon.SetPos( 0,
Math.Clamp( top_y, 0, 99999 ) );
81 #ifndef PLATFORM_CONSOLE
83 m_DownIcon.GetScreenSize( x2, y2 );
84 float bottom_y = GetCurrentContainerBottomY() - y2;
86 float diff = bottom_y - ( top_y +
y );
92 m_DownIcon.SetPos( 0, bottom_y );
97 float GetCurrentContainerTopY()
99 float x,
y, cont_screen_pos;
100 m_MainWidget.GetScreenPos(
x,
y );
101 if ( m_OpenedContainers.IsValidIndex( m_ActiveIndex ) )
102 cont_screen_pos =
Container.Cast( m_OpenedContainers.Get( m_ActiveIndex ) ).GetFocusedContainerYScreenPos();
104 return cont_screen_pos -
y;
107 float GetCurrentContainerBottomY()
109 float x,
y, cont_screen_pos, cont_screen_height;
110 m_MainWidget.GetScreenPos(
x,
y );
112 if ( m_OpenedContainers.IsValidIndex( m_ActiveIndex ) )
114 cont_screen_pos =
Container.Cast( m_OpenedContainers.Get( m_ActiveIndex ) ).GetFocusedContainerYScreenPos();
115 cont_screen_height =
Container.Cast( m_OpenedContainers.Get( m_ActiveIndex ) ).GetFocusedContainerHeight();
118 return cont_screen_pos -
y + cont_screen_height;
121 override void SetSameLevelNextActive()
123 m_VicinityContainer.SetSameLevelNextActive();
126 override void SetSameLevelPreviousActive()
128 m_VicinityContainer.SetSameLevelPreviousActive();
132 override void ExpandCollapseContainer()
137 c.ExpandCollapseContainer();
143 void OnLeftPanelDropReceived(
Widget w,
int x,
int y,
Widget receiver )
145 m_VicinityContainer.OnLeftPanelDropReceived( w,
x,
y, receiver );
148 override void DraggingOverHeader(
Widget w,
int x,
int y,
Widget receiver )
150 m_VicinityContainer.DraggingOverHeader( w,
x,
y, receiver );
153 override void SetLayoutName()
155 #ifdef PLATFORM_CONSOLE
182 EntityAI item = GetFocusedContainer().GetFocusedItem();
188 return m_VicinityContainer;
191 override void SetParentWidget()
196 override void OnShow()
202 override void Refresh()
206 m_MainWidget.Update();
208 m_ScrollWidget.Update();
210 UpdateSelectionIcons();
211 m_ShouldChangeSize =
true;
214 override void UpdateInterval()
216 m_IsProcessing =
true;
217 super.UpdateInterval();
218 m_IsProcessing =
false;
222 m_ContentParent.GetScreenSize(
x,
y );
223 m_MainWidget.GetScreenSize( x2, y2 );
225 m_ShouldChangeSize =
true;
228 m_ContentResize.ResizeParentToChild( changed_size );
229 if ( changed_size || m_ShouldChangeSize )
231 m_MainWidget.Update();
233 m_ScrollWidget.Update();
234 m_ShouldChangeSize =
false;
236 CheckScrollbarVisibility();