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

#include "wxCodeCompletionBoxBase.h"

#include "codelite_exports.h"

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

static bool bBitmapLoaded = false;

wxCodeCompletionBoxBase::wxCodeCompletionBoxBase(wxWindow* parent, long style)
    : wxPopupWindow(parent, style)
{
    if(!bBitmapLoaded) {
        // We need to initialise the default bitmap handler
        wxXmlResource::Get()->AddHandler(new wxBitmapXmlHandler);
        wxC9ED9AInitBitmapResources();
        bBitmapLoaded = true;
    }

    wxBoxSizer* mainSizer = new wxBoxSizer(wxHORIZONTAL);
    this->SetSizer(mainSizer);

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

    mainSizer->Add(m_mainPanel, 1, wxEXPAND, WXC_FROM_DIP(0));

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

    m_list = new clThemedListCtrl(m_mainPanel, wxID_ANY, wxDefaultPosition, wxDLG_UNIT(m_mainPanel, wxSize(-1, -1)),
                                  wxDV_NO_HEADER | wxDV_ROW_LINES | wxDV_SINGLE | wxBORDER_NONE);

    boxSizer43->Add(m_list, 1, wxALL | wxEXPAND, WXC_FROM_DIP(1));

    SetName(wxT("wxCodeCompletionBoxBase"));
    SetSize(wxDLG_UNIT(this, wxSize(-1, -1)));
    if(GetSizer()) {
        GetSizer()->Fit(this);
    }
    // Connect events
    m_list->Connect(wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED,
                    wxDataViewEventHandler(wxCodeCompletionBoxBase::OnSelectionChanged), NULL, this);
    m_list->Connect(wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED,
                    wxDataViewEventHandler(wxCodeCompletionBoxBase::OnSelectionActivated), NULL, this);
}

wxCodeCompletionBoxBase::~wxCodeCompletionBoxBase()
{
    m_list->Disconnect(wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED,
                       wxDataViewEventHandler(wxCodeCompletionBoxBase::OnSelectionChanged), NULL, this);
    m_list->Disconnect(wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED,
                       wxDataViewEventHandler(wxCodeCompletionBoxBase::OnSelectionActivated), NULL, this);
}
