gtransm/gui/design/basepanel.cxx

51 lines
2.0 KiB
C++
Raw Normal View History

2025-04-02 10:36:48 +08:00
#include "basepanel.h"
2025-04-03 10:23:46 +08:00
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)
2025-04-02 10:36:48 +08:00
{
2025-04-03 10:23:46 +08:00
Init();
2025-04-03 16:49:08 +08:00
ManLayout();
2025-04-02 10:36:48 +08:00
}
void CBasePanel::Init()
{
2025-04-03 16:49:08 +08:00
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"));
2025-04-03 17:19:39 +08:00
dirctrl_ = new CModeDirCtrl(this);
2025-04-05 21:58:23 +08:00
dirctrl_->SetRootPath("transm://op");
2025-04-03 16:49:08 +08:00
rbtLocal_ = new wxRadioButton(this, wxID_ANY, _("Local"));
rbtRemote_ = new wxRadioButton(this, wxID_ANY, _("Remote"));
lbState_ = new wxStaticText(this, wxID_ANY, _("State"));
}
2025-04-02 10:36:48 +08:00
2025-04-03 16:49:08 +08:00
void CBasePanel::ManLayout()
{
auto* topSizer = new wxBoxSizer(wxVERTICAL);
2025-04-02 10:36:48 +08:00
auto* szL1 = new wxBoxSizer(wxHORIZONTAL);
auto* lbIp = new wxStaticText(this, wxID_ANY, _("ServerIP:"));
auto* lbPort = new wxStaticText(this, wxID_ANY, _("Port:"));
2025-04-03 16:49:08 +08:00
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);
2025-04-03 10:23:46 +08:00
2025-04-03 16:49:08 +08:00
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);
2025-04-03 10:23:46 +08:00
this->SetSizer(topSizer);
2025-04-03 16:49:08 +08:00
}