Show
Ignore:
Timestamp:
12/05/06 20:00:24 (2 years ago)
Author:
baxissimo
Message:

Improvements to dxut mostly (adding scrollbar)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/luigi/arranger.d

    r11 r37  
    306306        FlowRow currentRow = new FlowRow(xgap); 
    307307        foreach(Arrangeable c ; m_items)  
     308        { 
     309            Size s = c.preferred_size(rect.size); 
     310            currentWidth += s.width + xgap; 
     311            if(currentWidth > rect.width) 
    308312            { 
    309                 Size s = c.preferred_size(rect.size); 
    310                 currentWidth += s.width + xgap; 
    311                 if(currentWidth > rect.width) 
    312                 { 
    313                     currentWidth = s.width - xgap; 
    314                     rows ~= currentRow; 
    315                     currentRow = new FlowRow(xgap); 
    316                 } 
    317                 currentRow.add(c); 
     313                currentWidth = s.width - xgap; 
     314                rows ~= currentRow; 
     315                currentRow = new FlowRow(xgap); 
    318316            } 
     317            currentRow.add(c); 
     318        } 
    319319        rows ~= currentRow; 
    320320        float totalHeight = 0; 
    321321        foreach(FlowRow r ; rows) 
    322            
    323                 totalHeight += r.size.height; 
    324            
     322       
     323            totalHeight += r.size.height; 
     324       
    325325        totalHeight += ygap*(rows.length - 1); 
    326326 
     
    346346        case A.Left: 
    347347            foreach(FlowRow r; rows)  
    348                
    349                     r.position = Point(0, y-rect.y); 
    350                     r.arrange(); 
    351                     y += r.size.height + ygap; 
    352                
     348           
     349                r.position = Point(0, y-rect.y); 
     350                r.arrange(); 
     351                y += r.size.height + ygap; 
     352           
    353353            break; 
    354354        case A.Right: 
    355355            foreach(FlowRow r; rows) 
    356                
    357                     float x = rect.x2 - r.size.width; 
    358                     r.position = Point(x-rect.x, y-rect.y); 
    359                     r.arrange(); 
    360                     y += r.size.height + ygap; 
    361                
     356           
     357                float x = rect.x2 - r.size.width; 
     358                r.position = Point(x-rect.x, y-rect.y); 
     359                r.arrange(); 
     360                y += r.size.height + ygap; 
     361           
    362362            break; 
    363363 
     
    365365        default: 
    366366            foreach(FlowRow r; rows) 
    367                
    368                     float x = rect.x + (rect.width - r.size.width)/2; 
    369                     r.position = Point(x-rect.x, y-rect.y); 
    370                     r.arrange(); 
    371                     y += r.size.height + ygap; 
    372                
     367           
     368                float x = rect.x + (rect.width - r.size.width)/2; 
     369                r.position = Point(x-rect.x, y-rect.y); 
     370                r.arrange(); 
     371                y += r.size.height + ygap; 
     372           
    373373            break; 
    374374        } 
    375375        foreach(Arrangeable item ; m_items) 
    376            
    377                item.arrange(); 
    378            
     376       
     377            item.arrange(); 
     378       
    379379    } 
    380380 
     
    428428        float y = y0 + (rect.height / 2); 
    429429        foreach(Arrangeable item ; m_items) 
    430            
    431                Size s = item.preferred_size(rect.size); 
    432                item.set_rect(Rect(x, y-(s.height/2), s.width, s.height)); 
    433                x += s.width + xgap; 
    434            
     430       
     431            Size s = item.preferred_size(rect.size); 
     432            item.set_rect(Rect(x, y-(s.height/2), s.width, s.height)); 
     433            x += s.width + xgap; 
     434       
    435435    } 
    436436 
     
    440440        float width = 0; 
    441441        foreach(Arrangeable item ; m_items) 
    442            
    443                Size s = item.preferred_size(rect.size); 
    444                width += s.width; 
    445            
     442       
     443            Size s = item.preferred_size(rect.size); 
     444            width += s.width; 
     445       
    446446        width += xgap * (m_items.length - 1); 
    447447        m_rect.width = width; 
     
    453453        float maxHeight = 0; 
    454454        foreach(Arrangeable item ; m_items) 
    455            
    456                maxHeight = math.fmax(maxHeight, item.preferred_size(rect.size).height); 
    457            
     455       
     456            maxHeight = math.fmax(maxHeight, item.preferred_size(rect.size).height); 
     457       
    458458        return maxHeight; 
    459459    } 
     
    637637        heights[] = 0; 
    638638 
    639         foreach(c, inout w; widths) { 
    640             foreach(r, inout h; heights) { 
     639        foreach(c, inout w; widths)  
     640        { 
     641            foreach(r, inout h; heights)  
     642            { 
    641643                int i = r * grid.cols + c; 
    642644                if(i < m_items.length)