#include "LogControl.h"
#include <wx/datetime.h>
LogControl::LogControl(wxWindow* parent) : wxPanel(parent)
{
Init();
}
void LogControl::Init()
listBox_ = new wxListBox(this, wxID_ANY);
auto* topSizer = new wxBoxSizer(wxVERTICAL);
topSizer->Add(listBox_, 1, wxEXPAND);
SetSizer(topSizer);
Layout();
LogControl::~LogControl()
void LogControl::AddLog(const wxString& msg)
std::unique_lock<std::mutex> lock(mutex_);
auto now = wxDateTime::UNow();
auto strTime = now.Format("%H:%M:%S.%l");
listBox_->Append(strTime + wxT(" ") + msg);
listBox_->SetSelection(listBox_->GetCount() - 1);