gtransm/gui/design/basepanel.cxx

50 lines
2.0 KiB
C++

#include "basepanel.h"
CBasePanel::CBasePanel(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name)
: wxPanel(parent, wxID_ANY, pos, size, style, name)
{
Init();
ManLayout();
}
void CBasePanel::Init()
{
edIp_ = new wxTextCtrl(this, wxID_ANY, _(""));
edPort_ = new wxTextCtrl(this, wxID_ANY, _(""));
btnConnect_ = new wxButton(this, wxID_ANY, _("Connect"));
btnDisconnect_ = new wxButton(this, wxID_ANY, _("DisConnect"));
dirctrl_ = new CModeDirCtrl(this);
rbtLocal_ = new wxRadioButton(this, wxID_ANY, _("Local"));
rbtRemote_ = new wxRadioButton(this, wxID_ANY, _("Remote"));
lbState_ = new wxStaticText(this, wxID_ANY, _("State"));
}
void CBasePanel::ManLayout()
{
auto* topSizer = new wxBoxSizer(wxVERTICAL);
auto* szL1 = new wxBoxSizer(wxHORIZONTAL);
auto* lbIp = new wxStaticText(this, wxID_ANY, _("ServerIP:"));
auto* lbPort = new wxStaticText(this, wxID_ANY, _("Port:"));
szL1->Add(lbIp, 0, wxALL | wxCENTER, g_BaseBorder);
szL1->Add(edIp_, 0, wxALL | wxEXPAND, g_BaseBorder);
szL1->Add(lbPort, 0, wxALL | wxCENTER, g_BaseBorder);
szL1->Add(edPort_, 0, wxALL | wxEXPAND, g_BaseBorder);
szL1->Add(btnConnect_, 0, wxALL | wxEXPAND, g_BaseBorder);
szL1->Add(btnDisconnect_, 0, wxALL | wxEXPAND, g_BaseBorder);
auto* szL2 = new wxBoxSizer(wxHORIZONTAL);
auto* lbCurMode = new wxStaticText(this, wxID_ANY, _("CurrentOperMode:"));
szL2->Add(lbCurMode, 0, wxALL | wxEXPAND, g_BaseBorder);
szL2->Add(rbtLocal_, 0, wxALL | wxEXPAND, g_BaseBorder);
szL2->Add(rbtRemote_, 0, wxALL | wxEXPAND, g_BaseBorder);
szL2->Add(lbState_, 0, wxALL | wxEXPAND, g_BaseBorder);
auto* szL3 = new wxBoxSizer(wxHORIZONTAL);
szL3->Add(dirctrl_, 1, wxALL | wxEXPAND, g_BaseBorder);
topSizer->Add(szL1, 0, wxEXPAND | wxALL, g_BaseBorder);
topSizer->Add(szL2, 0, wxEXPAND | wxALL, g_BaseBorder);
topSizer->Add(szL3, 1, wxEXPAND | wxALL, g_BaseBorder);
this->SetSizer(topSizer);
}