#include "pmGrid.h"

pmGridframe::pmGridframe
        (       wxWindow * parent,
                const wxChar *title,
                Table theTable,
                int xpos,
                int ypos,
                int width,
                int height
        )
        : wxFrame(parent, -1, title,
                wxPoint(xpos, ypos),
                wxSize(width, height)
                )
{       RESULTATTR attribs = theTable.getAttribs();
        grid = new wxGrid(this, 0, 0, 400, 400);
        grid->CreateGrid(attribs.cRows, attribs.cColumns);
        wxString data = "";
        for (int i = 0; i < attribs.cColumns; i++)
        {       data = theTable.getSchema(i);
                grid->SetLabelValue(wxHORIZONTAL, data, i);
        }
        for (int row = 0; row < attribs.cRows; row++)
        {       for (int column = 0; column < attribs.cColumns; column++)
                {       data = theTable.getField(row, column, attribs.cColumns);
                        grid->SetCellValue(data, row, column);
                }
        }
        grid->UpdateDimensions();
}

pmGridframe::~pmGridframe()
{
}

BEGIN_EVENT_TABLE(pmGridframe, wxFrame)

END_EVENT_TABLE()