2 // control/window/composition.qc
6 Item_Arrangement_CalculateSize
9 void() Item_Arrangement_CalculateSize =
15 // TODO: this is garbage, fix this
19 for( lChild = self._child ; lChild ; lChild = lChild._next ) {
20 if( Menu_HasRunFlag( lChild, RUNFLAG_HIDDEN ) )
23 lMin_x = min( lMin_x, lChild.pos_x );
24 lMin_y = min( lMin_y, lChild.pos_y );
25 lMax_x = max( lMax_x, lChild.pos_x + lChild.size_x );
26 lMax_y = max( lMax_y, lChild.pos_y + lChild.size_y );
28 self.size = lMax - lMin;
33 Item_Arrangement_Update
36 void() Item_Arrangement_Update =
40 Item_Arrangement_CalculateSize();
42 if( self.direction_x ) {
43 if( self.alignment == ITEM_ALIGN_LEFT )
45 else if( self.alignment == ITEM_ALIGN_CENTER || self.alignment == ITEM_ALIGN_FIRST )
46 self.origin_y = self.size_y / 2;
48 self.origin_y = self.size_y;
51 if( self.direction_y ) {
52 if( self.alignment == ITEM_ALIGN_LEFT )
54 else if( self.alignment == ITEM_ALIGN_CENTER || self.alignment == ITEM_ALIGN_FIRST )
55 self.origin_x = self.size_x / 2;
57 self.origin_x = self.size_x;
64 Item_Arrangement_Spawn
67 void() Item_Arrangement_Spawn =
71 Item_Arrangement_Update();
73 self._update = Item_Arrangement_Update;