//
//  UIGrid.cpp
//  emptyExample
//
//  Created by Robert Tubb on 22/05/2013.
//
//

#include "UIGrid.h"



template<class T> void UIGrid<T>::print(){
    cout << "uh \n";
}

template<class T> UIGrid<T>::UIGrid(int ax,int ay, int awidth, int aheight, int numColumns,int numRows,  int spacing,ofColor hi, ofColor lo, ofColor bg)
{
    
    // grid of what ?
    double cw = width/(double)numColumns;
    double ch = height/(double)numRows;
    
    double eWidth = cw - spacing;
    double eHeight = ch - spacing;
    double ex,ey;
    double radius = (eWidth < eHeight ? eWidth : eHeight)/6.0;
    double thickness = radius;
    for(int i=0; i< numColumns; i++){
        ex = x + i*cw + spacing/2.0;
        for(int j=0; j<numRows; j++){
            // make buttons
            
            ey = y + j*ch + spacing/2.0;
            T *butt = new T(ex,ey,eWidth,eHeight,thickness,radius,hi,bg,lo,bg);
        
            
            subElements.push_back(butt);
        }
    }
    
}

