//////////////////////////////////////////////////////////////////////
// This file was auto-generated by codelite's wxCrafter Plugin
// wxCrafter project file: codeformatterdlg.wxcp
// Do not modify this file by hand!
//////////////////////////////////////////////////////////////////////

#include "codeformatterdlgbase.h"

#include "PHPFormatterBuffer.h"

// Declare the bitmap loading function
extern void wxCrafterGgLOZbInitBitmapResources();

static bool bBitmapLoaded = false;

CodeFormatterBaseDlg::CodeFormatterBaseDlg(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos,
                                           const wxSize& size, long style)
    : wxDialog(parent, id, title, pos, size, style)
{
    if(!bBitmapLoaded) {
        // We need to initialise the default bitmap handler
        wxXmlResource::Get()->AddHandler(new wxBitmapXmlHandler);
        wxCrafterGgLOZbInitBitmapResources();
        bBitmapLoaded = true;
    }

    wxBoxSizer* bSizerMain = new wxBoxSizer(wxVERTICAL);
    this->SetSizer(bSizerMain);

    m_mainPanel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(this, wxSize(-1, -1)), wxTAB_TRAVERSAL);

    bSizerMain->Add(m_mainPanel, 1, wxALL | wxEXPAND, WXC_FROM_DIP(5));

    wxBoxSizer* boxSizer359 = new wxBoxSizer(wxVERTICAL);
    m_mainPanel->SetSizer(boxSizer359);

    wxBoxSizer* boxSizer360 = new wxBoxSizer(wxHORIZONTAL);

    boxSizer359->Add(boxSizer360, 1, wxALL | wxEXPAND, WXC_FROM_DIP(5));

    m_dvListCtrl =
        new clThemedOrderedListCtrl(m_mainPanel, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_mainPanel, wxSize(-1, -1)),
                                    wxDV_NO_HEADER | wxDV_ROW_LINES | wxDV_SINGLE);

    boxSizer360->Add(m_dvListCtrl, 1, wxALL | wxEXPAND, WXC_FROM_DIP(5));

    m_dvListCtrl->AppendTextColumn(_("name"), wxDATAVIEW_CELL_INERT, WXC_FROM_DIP(-2), wxALIGN_LEFT, 0);
    boxSizerFormatter = new wxBoxSizer(wxVERTICAL);

    boxSizer360->Add(boxSizerFormatter, 3, wxEXPAND, WXC_FROM_DIP(5));

    wxBoxSizer* boxSizer371 = new wxBoxSizer(wxHORIZONTAL);

    boxSizer359->Add(boxSizer371, 0, wxALL | wxALIGN_CENTER_HORIZONTAL, WXC_FROM_DIP(5));

    m_button_ok =
        new wxButton(m_mainPanel, wxID_OK, _("&OK"), wxDefaultPosition, wxDLG_UNIT(m_mainPanel, wxSize(-1, -1)), 0);
    m_button_ok->SetDefault();

    boxSizer371->Add(m_button_ok, 0, wxALL, WXC_FROM_DIP(5));

    m_button_cancel = new wxButton(m_mainPanel, wxID_CANCEL, _("Cancel"), wxDefaultPosition,
                                   wxDLG_UNIT(m_mainPanel, wxSize(-1, -1)), 0);

    boxSizer371->Add(m_button_cancel, 0, wxALL, WXC_FROM_DIP(5));

    m_button_revert = new wxButton(m_mainPanel, wxID_REVERT, _("Defaults"), wxDefaultPosition,
                                   wxDLG_UNIT(m_mainPanel, wxSize(-1, -1)), 0);
    m_button_revert->SetToolTip(_("Revert all changes and load factory defaults"));

    boxSizer371->Add(m_button_revert, 0, wxALL, WXC_FROM_DIP(5));

    SetName(wxT("CodeFormatterBaseDlg"));
    SetSize(wxDLG_UNIT(this, wxSize(-1, -1)));
    if(GetSizer()) {
        GetSizer()->Fit(this);
    }
    if(GetParent()) {
        CentreOnParent(wxBOTH);
    } else {
        CentreOnScreen(wxBOTH);
    }
    if(!wxPersistenceManager::Get().Find(this)) {
        wxPersistenceManager::Get().RegisterAndRestore(this);
    } else {
        wxPersistenceManager::Get().Restore(this);
    }
    // Connect events
    m_dvListCtrl->Bind(wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, &CodeFormatterBaseDlg::OnSelectionChanged, this);
    m_button_ok->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &CodeFormatterBaseDlg::OnOK, this);
    m_button_revert->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &CodeFormatterBaseDlg::OnRevert, this);
}

CodeFormatterBaseDlg::~CodeFormatterBaseDlg()
{
    m_dvListCtrl->Unbind(wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, &CodeFormatterBaseDlg::OnSelectionChanged, this);
    m_button_ok->Unbind(wxEVT_COMMAND_BUTTON_CLICKED, &CodeFormatterBaseDlg::OnOK, this);
    m_button_revert->Unbind(wxEVT_COMMAND_BUTTON_CLICKED, &CodeFormatterBaseDlg::OnRevert, this);
}
