2 // control/window/layout.qc
13 void() Item_Layout_Update =
16 local vector lCurrent;
18 lCurrent = '0.0 0.0 0.0';
19 for( lChild = self._child ; lChild ; lChild = lChild._next ) {
20 if( Menu_HasRunFlag( lChild, RUNFLAG_HIDDEN ) )
23 if( self.direction_y ) {
24 if( self.alignment == ITEM_ALIGN_FIRST && lChild._child )
25 lChild.pos_x = lCurrent_x - lChild._child.size_x;
26 else if( self.alignment == ITEM_ALIGN_LEFT )
27 lChild.pos_x = lCurrent_x;
28 else if( self.alignment == ITEM_ALIGN_CENTER )
29 lChild.pos_x = lCurrent_x - lChild.size_x / 2;
31 lChild.pos_x = lCurrent_x - lChild.size_x;
33 lChild.pos_x = lCurrent_x;
35 if( self.direction_x ) {
36 if( self.alignment == ITEM_ALIGN_LEFT )
37 lChild.pos_y = lCurrent_y;
38 else if( self.alignment == ITEM_ALIGN_CENTER )
39 lChild.pos_y = lCurrent_y - lChild.size_y / 2;
40 else if( self.alignment == ITEM_ALIGN_FIRST && lChild._child )
41 lChild.pos_y = lCurrent_y - lChild._child.size_y;
43 lChild.pos_y = lCurrent_y - lChild.size_y;
45 lChild.pos_y = lCurrent_y;
47 if( self.direction_x )
48 lCurrent_x += lChild.size_x + self.direction_x;
49 else if( self.direction_y )
50 lCurrent_y += lChild.size_y + self.direction_y;
59 void() Item_Layout_Spawn =
65 self._update = Item_Layout_Update;