#include "RemoteControl.h"

RemoteControl::RemoteControl(wxWindow* parent) : wxPanel(parent)
{
    Init();
    SetGrid();
}

RemoteControl::~RemoteControl()
{
}

void RemoteControl::Init()
{
    grid_ = new wxGrid(this, wxID_ANY);
    auto* topSizer = new wxBoxSizer(wxVERTICAL);

    auto* dirSizer = new wxBoxSizer(wxHORIZONTAL);
    textCtrl_ = new wxTextCtrl(this, wxID_ANY);
    dirSizer->Add(textCtrl_, 1, wxALL | wxEXPAND, gBorder);

    btnHome_ = new wxButton(this, wxID_ANY, _("Home"));
    dirSizer->Add(btnHome_, 0, wxALL | wxCENTER, gBorder);

    btnGet_ = new wxButton(this, wxID_ANY, _("Get"));
    dirSizer->Add(btnGet_, 0, wxALL | wxCENTER, gBorder);

    btnUpLevel_ = new wxButton(this, wxID_ANY, _("UpLevel"));
    dirSizer->Add(btnUpLevel_, 0, wxALL | wxCENTER, gBorder);

    btnRefresh_ = new wxButton(this, wxID_ANY, _("Refresh"));
    dirSizer->Add(btnRefresh_, 0, wxALL | wxCENTER, gBorder);

    auto* bottomSizer = new wxBoxSizer(wxHORIZONTAL);
    bottomSizer->Add(grid_, 1, wxEXPAND);

    topSizer->Add(dirSizer, 0, wxALL | wxEXPAND);
    topSizer->Add(bottomSizer, 1, wxEXPAND | wxCENTER);
    SetSizer(topSizer);
    Layout();
}

void RemoteControl::SetGrid()
{
    grid_->CreateGrid(10, 5);
    grid_->SetColLabelValue(0, _("FullPath"));
    grid_->SetColLabelValue(1, _("FileSize"));
    grid_->SetColLabelValue(2, _("FileType"));
    grid_->SetColLabelValue(3, _("LastModified"));
    grid_->SetColLabelValue(4, _("Permissions"));

    grid_->SetColSize(0, 200);
    grid_->SetColSize(1, 100);
    grid_->SetColSize(2, 100);
    grid_->SetColSize(3, 150);
    grid_->SetColSize(4, 100);
}