3 protected int m_NumberRow;
4 protected int m_NumberColumnFocused;
6 protected int m_MaxColumns;
10 protected CargoContainer m_ParentContainer;
11 protected ref SizeToChild m_Resizer1;
12 protected ref SizeToParent m_Resizer2;
16 m_ParentContainer = CargoContainer.Cast( parent );
17 #ifdef PLATFORM_CONSOLE
23 for (
int i = 0; i < m_MaxColumns; i++ )
25 Widget iconWidget = GetMainWidget().FindAnyWidget(
"Icon" + i );
27 iconWidget.SetUserID(i);
29 WidgetEventHandler.GetInstance().RegisterOnDropReceived( iconWidget,
this,
"DropReceived" );
30 WidgetEventHandler.GetInstance().RegisterOnDraggingOver( iconWidget,
this,
"DraggingOver" );
34 m_RootWidget.FindAnyWidget(
"SpacerTop" ).GetScript( m_Resizer2 );
39 for (
int i = 0; i < m_MaxColumns; i++ )
42 #ifdef PLATFORM_WINDOWS
43 #ifndef PLATFORM_CONSOLE
44 #ifndef SERVER_FOR_CONSOLE
49 EntityAI entity = grid.FindEntityInCargoOn( m_NumberRow, i );
52 Icon icon = m_ParentContainer.GetIcon( entity );
56 icon.SetActive(
false );
61 GetMainWidget().FindAnyWidget(
"Cursor" + i ).Show(
false );
69 m_NumberColumnFocused = 0;
72 void SetFocus(
int column )
74 m_NumberColumnFocused = column;
79 #ifdef PLATFORM_WINDOWS
80 #ifndef PLATFORM_CONSOLE
81 #ifndef SERVER_FOR_CONSOLE
85 EntityAI focused_item_new = grid.FindEntityInCargoOn( m_NumberRow, m_NumberColumnFocused );
86 if( focused_item_new )
88 Icon icon = m_ParentContainer.GetIcon( focused_item_new );
92 icon.SetActive(
true );
97 GetMainWidget().FindAnyWidget(
"Cursor" + column ).Show(
true );
105 bool GetIconSize(
int row,
int column, out
int width, out
int height)
107 #ifdef PLATFORM_WINDOWS
108 #ifndef PLATFORM_CONSOLE
109 #ifndef SERVER_FOR_CONSOLE
113 EntityAI focused_item_new = grid.FindEntityInCargoOn( row, column );
114 if( focused_item_new )
116 Icon icon = m_ParentContainer.GetIcon( focused_item_new );
120 width = icon.GetSizeX();
121 height = icon.GetSizeY();
134 int GetFocusedColumn()
136 return m_NumberColumnFocused;
139 override void SetLayoutName()
141 #ifdef PLATFORM_CONSOLE
174 if (
m_Parent.m_Parent.IsInherited( ContainerWithCargo ) )
176 ( ContainerWithCargo.Cast(
m_Parent.m_Parent ) ).DropReceived( w, m_NumberRow, receiver.GetUserID() );
178 else if (
m_Parent.m_Parent.IsInherited( ContainerWithCargoAndAttachments ) )
180 ( ContainerWithCargoAndAttachments.Cast(
m_Parent.m_Parent ) ).DropReceived( w, m_NumberRow, receiver.GetUserID(), m_ParentContainer );
184 (
HandsContainer.Cast(
m_Parent.m_Parent ) ).DropReceived( w, m_NumberRow, receiver.GetUserID(), m_ParentContainer );
194 if (
m_Parent.m_Parent.IsInherited( ContainerWithCargo ) )
196 ContainerWithCargo.Cast(
m_Parent.m_Parent ).DraggingOverGrid( w, m_NumberRow, receiver.GetUserID(),
null );
198 else if (
m_Parent.m_Parent.IsInherited( ContainerWithCargoAndAttachments ) )
200 ContainerWithCargoAndAttachments.Cast(
m_Parent.m_Parent ).DraggingOverGrid( w, m_NumberRow, receiver.GetUserID(),
null, m_ParentContainer );
204 (
HandsContainer.Cast(
m_Parent.m_Parent ) ).DraggingOverGrid( w, m_NumberRow, receiver.GetUserID(),
null, m_ParentContainer );
214 void ColumnOnDraggingOver0(
Widget w )
216 if(
m_Parent.m_Parent.IsInherited( ContainerWithCargo ) )
218 ContainerWithCargo.Cast(
m_Parent.m_Parent ).DraggingOverGrid( w, m_NumberRow, 0,
null );
220 else if(
m_Parent.m_Parent.IsInherited( ContainerWithCargoAndAttachments ) )
222 ContainerWithCargoAndAttachments.Cast(
m_Parent.m_Parent ).DraggingOverGrid( w, m_NumberRow, 0,
null, m_ParentContainer );
226 (
HandsContainer.Cast(
m_Parent.m_Parent ) ).DraggingOverGrid( w, m_NumberRow, 0,
null, m_ParentContainer );
234 void ColumnOnDraggingOver1(
Widget w )
236 if(
m_Parent.m_Parent.IsInherited( ContainerWithCargo ) )
238 ContainerWithCargo.Cast(
m_Parent.m_Parent ).DraggingOverGrid( w, m_NumberRow, 1,
null );
240 else if(
m_Parent.m_Parent.IsInherited( ContainerWithCargoAndAttachments ) )
242 ( ContainerWithCargoAndAttachments.Cast(
m_Parent.m_Parent ) ).DraggingOverGrid( w, m_NumberRow, 1,
null, m_ParentContainer );
246 (
HandsContainer.Cast(
m_Parent.m_Parent ) ).DraggingOverGrid( w, m_NumberRow, 1,
null, m_ParentContainer );
254 void ColumnOnDraggingOver2(
Widget w )
256 if(
m_Parent.m_Parent.IsInherited( ContainerWithCargo ) )
258 ContainerWithCargo.Cast(
m_Parent.m_Parent ).DraggingOverGrid( w, m_NumberRow, 2,
null );
260 else if(
m_Parent.m_Parent.IsInherited( ContainerWithCargoAndAttachments ) )
262 ContainerWithCargoAndAttachments.Cast(
m_Parent.m_Parent ).DraggingOverGrid( w, m_NumberRow, 2,
null, m_ParentContainer );
266 (
HandsContainer.Cast(
m_Parent.m_Parent ) ).DraggingOverGrid( w, m_NumberRow, 2,
null, m_ParentContainer );
274 void ColumnOnDraggingOver3(
Widget w )
276 if(
m_Parent.m_Parent.IsInherited( ContainerWithCargo ) )
278 ContainerWithCargo.Cast(
m_Parent.m_Parent ).DraggingOverGrid( w, m_NumberRow, 3,
null );
280 else if(
m_Parent.m_Parent.IsInherited( ContainerWithCargoAndAttachments ) )
282 ( ContainerWithCargoAndAttachments.Cast(
m_Parent.m_Parent ) ).DraggingOverGrid( w, m_NumberRow, 3,
null, m_ParentContainer );
286 (
HandsContainer.Cast(
m_Parent.m_Parent ) ).DraggingOverGrid( w, m_NumberRow, 3,
null, m_ParentContainer );
294 void ColumnOnDraggingOver4(
Widget w )
296 if(
m_Parent.m_Parent.IsInherited( ContainerWithCargo ) )
298 ContainerWithCargo.Cast(
m_Parent.m_Parent ).DraggingOverGrid( w, m_NumberRow, 4,
null );
300 else if(
m_Parent.m_Parent.IsInherited( ContainerWithCargoAndAttachments ) )
302 ( ContainerWithCargoAndAttachments.Cast(
m_Parent.m_Parent ) ).DraggingOverGrid( w, m_NumberRow, 4,
null, m_ParentContainer );
306 (
HandsContainer.Cast(
m_Parent.m_Parent ) ).DraggingOverGrid( w, m_NumberRow, 4,
null, m_ParentContainer );
314 void ColumnOnDraggingOver5(
Widget w )
316 if(
m_Parent.m_Parent.IsInherited( ContainerWithCargo ) )
318 ContainerWithCargo.Cast(
m_Parent.m_Parent ).DraggingOverGrid( w, m_NumberRow, 5,
null );
320 else if(
m_Parent.m_Parent.IsInherited( ContainerWithCargoAndAttachments ) )
322 ( ContainerWithCargoAndAttachments.Cast(
m_Parent.m_Parent ) ).DraggingOverGrid( w, m_NumberRow, 5,
null, m_ParentContainer );
326 (
HandsContainer.Cast(
m_Parent.m_Parent ) ).DraggingOverGrid( w, m_NumberRow, 5,
null, m_ParentContainer );
334 void ColumnOnDraggingOver6(
Widget w )
336 if(
m_Parent.m_Parent.IsInherited( ContainerWithCargo ) )
338 ContainerWithCargo.Cast(
m_Parent.m_Parent ).DraggingOverGrid( w, m_NumberRow, 6,
null );
340 else if(
m_Parent.m_Parent.IsInherited( ContainerWithCargoAndAttachments ) )
342 ( ContainerWithCargoAndAttachments.Cast(
m_Parent.m_Parent ) ).DraggingOverGrid( w, m_NumberRow, 6,
null, m_ParentContainer );
346 (
HandsContainer.Cast(
m_Parent.m_Parent ) ).DraggingOverGrid( w, m_NumberRow, 6,
null, m_ParentContainer );
354 void ColumnOnDraggingOver7(
Widget w )
356 if(
m_Parent.m_Parent.IsInherited( ContainerWithCargo ) )
358 ContainerWithCargo.Cast(
m_Parent.m_Parent ).DraggingOverGrid( w, m_NumberRow, 7,
null );
360 else if(
m_Parent.m_Parent.IsInherited( ContainerWithCargoAndAttachments ) )
362 ( ContainerWithCargoAndAttachments.Cast(
m_Parent.m_Parent ) ).DraggingOverGrid( w, m_NumberRow, 7,
null, m_ParentContainer );
366 (
HandsContainer.Cast(
m_Parent.m_Parent ) ).DraggingOverGrid( w, m_NumberRow, 7,
null, m_ParentContainer );
374 void ColumnOnDraggingOver8(
Widget w )
376 if(
m_Parent.m_Parent.IsInherited( ContainerWithCargo ) )
378 ContainerWithCargo.Cast(
m_Parent.m_Parent ).DraggingOverGrid( w, m_NumberRow, 8,
null );
380 else if(
m_Parent.m_Parent.IsInherited( ContainerWithCargoAndAttachments ) )
382 ( ContainerWithCargoAndAttachments.Cast(
m_Parent.m_Parent ) ).DraggingOverGrid( w, m_NumberRow, 8,
null, m_ParentContainer );
386 (
HandsContainer.Cast(
m_Parent.m_Parent ) ).DraggingOverGrid( w, m_NumberRow, 8,
null, m_ParentContainer );
394 void ColumnOnDraggingOver9(
Widget w )
396 if(
m_Parent.m_Parent.IsInherited( ContainerWithCargo ) )
398 ContainerWithCargo.Cast(
m_Parent.m_Parent ).DraggingOverGrid( w, m_NumberRow, 9,
null );
400 else if(
m_Parent.m_Parent.IsInherited( ContainerWithCargoAndAttachments ) )
402 ( ContainerWithCargoAndAttachments.Cast(
m_Parent.m_Parent ) ).DraggingOverGrid( w, m_NumberRow, 9,
null, m_ParentContainer );
406 (
HandsContainer.Cast(
m_Parent.m_Parent ) ).DraggingOverGrid( w, m_NumberRow, 9,
null, m_ParentContainer );
416 if(
m_Parent.m_Parent.IsInherited( ContainerWithCargo ) )
418 ( ContainerWithCargo.Cast(
m_Parent.m_Parent ) ).DropReceived( w, m_NumberRow, 0 );
420 else if(
m_Parent.m_Parent.IsInherited( ContainerWithCargoAndAttachments ) )
422 ( ContainerWithCargoAndAttachments.Cast(
m_Parent.m_Parent ) ).DropReceived( w, m_NumberRow, 0, m_ParentContainer );
436 if(
m_Parent.m_Parent.IsInherited( ContainerWithCargo ) )
438 ( ContainerWithCargo.Cast(
m_Parent.m_Parent ) ).DropReceived( w, m_NumberRow, 1 );
440 else if(
m_Parent.m_Parent.IsInherited( ContainerWithCargoAndAttachments ) )
442 ( ContainerWithCargoAndAttachments.Cast(
m_Parent.m_Parent ) ).DropReceived( w, m_NumberRow, 1, m_ParentContainer );
456 if(
m_Parent.m_Parent.IsInherited( ContainerWithCargo ) )
458 ( ContainerWithCargo.Cast(
m_Parent.m_Parent ) ).DropReceived( w, m_NumberRow, 2 );
460 else if(
m_Parent.m_Parent.IsInherited( ContainerWithCargoAndAttachments ) )
462 ( ContainerWithCargoAndAttachments.Cast(
m_Parent.m_Parent ) ).DropReceived( w, m_NumberRow, 2, m_ParentContainer );
476 if(
m_Parent.m_Parent.IsInherited( ContainerWithCargo ) )
478 ( ContainerWithCargo.Cast(
m_Parent.m_Parent ) ).DropReceived( w, m_NumberRow, 3 );
480 else if(
m_Parent.m_Parent.IsInherited( ContainerWithCargoAndAttachments ) )
482 ( ContainerWithCargoAndAttachments.Cast(
m_Parent.m_Parent ) ).DropReceived( w, m_NumberRow, 3, m_ParentContainer );
496 if(
m_Parent.m_Parent.IsInherited( ContainerWithCargo ) )
498 ( ContainerWithCargo.Cast(
m_Parent.m_Parent ) ).DropReceived( w, m_NumberRow, 4 );
500 else if(
m_Parent.m_Parent.IsInherited( ContainerWithCargoAndAttachments ) )
502 ( ContainerWithCargoAndAttachments.Cast(
m_Parent.m_Parent ) ).DropReceived( w, m_NumberRow, 4, m_ParentContainer );
516 if(
m_Parent.m_Parent.IsInherited( ContainerWithCargo ) )
518 ( ContainerWithCargo.Cast(
m_Parent.m_Parent ) ).DropReceived( w, m_NumberRow, 5 );
520 else if(
m_Parent.m_Parent.IsInherited( ContainerWithCargoAndAttachments ) )
522 ( ContainerWithCargoAndAttachments.Cast(
m_Parent.m_Parent ) ).DropReceived( w, m_NumberRow, 5, m_ParentContainer );
536 if(
m_Parent.m_Parent.IsInherited( ContainerWithCargo ) )
538 ( ContainerWithCargo.Cast(
m_Parent.m_Parent ) ).DropReceived( w, m_NumberRow, 6 );
540 else if(
m_Parent.m_Parent.IsInherited( ContainerWithCargoAndAttachments ) )
542 ( ContainerWithCargoAndAttachments.Cast(
m_Parent.m_Parent ) ).DropReceived( w, m_NumberRow, 6, m_ParentContainer );
556 if(
m_Parent.m_Parent.IsInherited( ContainerWithCargo ) )
558 ( ContainerWithCargo.Cast(
m_Parent.m_Parent ) ).DropReceived( w, m_NumberRow, 7 );
560 else if(
m_Parent.m_Parent.IsInherited( ContainerWithCargoAndAttachments ) )
562 ( ContainerWithCargoAndAttachments.Cast(
m_Parent.m_Parent ) ).DropReceived( w, m_NumberRow, 7, m_ParentContainer );
576 if(
m_Parent.m_Parent.IsInherited( ContainerWithCargo ) )
578 ( ContainerWithCargo.Cast(
m_Parent.m_Parent ) ).DropReceived( w, m_NumberRow, 8 );
580 else if(
m_Parent.m_Parent.IsInherited( ContainerWithCargoAndAttachments ) )
582 ( ContainerWithCargoAndAttachments.Cast(
m_Parent.m_Parent ) ).DropReceived( w, m_NumberRow, 8, m_ParentContainer );
596 if(
m_Parent.m_Parent.IsInherited( ContainerWithCargo ) )
598 ( ContainerWithCargo.Cast(
m_Parent.m_Parent ) ).DropReceived( w, m_NumberRow, 9 );
600 else if(
m_Parent.m_Parent.IsInherited( ContainerWithCargoAndAttachments ) )
602 ( ContainerWithCargoAndAttachments.Cast(
m_Parent.m_Parent ) ).DropReceived( w, m_NumberRow, 9, m_ParentContainer );
615 override void OnShow()
617 GetRootWidget().Show(
true );
620 override void OnHide()
622 GetRootWidget().Show(
false );
625 void SetNumber(
int number )
627 m_NumberRow = number;
635 void SetWidth(
int width,
bool immedUpdate =
true )
640 for ( i = width; i < m_MaxColumns; i++ )
642 GetMainWidget().FindAnyWidget(
"Icon" + i ).Show(
false,
false );
643 GetMainWidget().FindAnyWidget(
"Spacer" + i ).Show(
false,
false );
646 GetMainWidget().FindAnyWidget(
"Spacer10" ).Show( m_Width != 0,
false );
650 m_Resizer2.Refresh();
651 GetMainWidget().Update();
654 m_Resizer1.ResizeParentToChild();