1 // ============================================================================
3 // ============================================================================
5 #include "includes.hpp"
7 // ----------------------------------------------------------------------------
9 // ----------------------------------------------------------------------------
11 // ----------------------------------------------------------------------------
13 // ----------------------------------------------------------------------------
15 // IDs for the controls and the menu commands
22 // ----------------------------------------------------------------------------
23 // event tables and other macros for wxWindows
24 // ----------------------------------------------------------------------------
26 // the event tables connect the wxWindows events with the functions (event
27 // handlers) which process them. It can be also done at run-time, but for the
28 // simple menu events like this the static method is much simpler.
29 BEGIN_EVENT_TABLE( TestWindow, wxMDIChildFrame)
30 EVT_BUTTON( BUTTON_SENDCMD, TestWindow::OnButtonPressed)
31 EVT_BUTTON( BUTTON_CLOSE, TestWindow::OnButtonPressed)
34 // ============================================================================
36 // ============================================================================
39 // ----------------------------------------------------------------------------
40 // the application class
41 // ----------------------------------------------------------------------------
44 TestWindow::TestWindow(CitClient *sock, wxMDIParentFrame *MyMDI)
45 : wxMDIChildFrame(MyMDI, //parent
50 wxDEFAULT_FRAME_STYLE | wxTAB_TRAVERSAL,
57 /* SetIcon(wxICON(mondrian)); */
59 wxStaticText *sendcmd_label = new wxStaticText(this, -1, "Server command:");
60 wxStaticText *recvcmd_label = new wxStaticText(this, -1, "Response:");
61 wxStaticText *xfercmd_label = new wxStaticText(this, -1, "Send/receive data:");
63 sendcmd = new wxTextCtrl(
74 wxLayoutConstraints *c1 = new wxLayoutConstraints;
75 c1->top.SameAs(this, wxTop, 10);
76 c1->left.SameAs(this, wxLeft, 5);
79 sendcmd_label->SetConstraints(c1);
81 wxLayoutConstraints *c2 = new wxLayoutConstraints;
82 c2->left.RightOf(sendcmd_label, 5);
83 c2->centreY.SameAs(sendcmd_label, wxCentreY);
85 c2->right.SameAs(this, wxRight, 5);
86 sendcmd->SetConstraints(c2);
88 recvcmd = new wxTextCtrl(
99 wxLayoutConstraints *c3 = new wxLayoutConstraints;
100 c3->left.SameAs(sendcmd, wxLeft);
101 c3->right.SameAs(sendcmd, wxRight);
103 c3->top.Below(sendcmd, 5);
104 recvcmd->SetConstraints(c3);
106 wxLayoutConstraints *c4 = new wxLayoutConstraints;
107 c4->left.SameAs(sendcmd_label, wxLeft);
108 c4->centreY.SameAs(recvcmd, wxCentreY);
111 recvcmd_label->SetConstraints(c4);
113 cmd_button = new wxButton(
124 close_button = new wxButton(
135 wxLayoutConstraints *c5 = new wxLayoutConstraints;
136 c5->left.SameAs(this, wxLeft, 5);
137 c5->bottom.SameAs(this, wxBottom, 5);
140 cmd_button->SetConstraints(c5);
142 wxLayoutConstraints *c6 = new wxLayoutConstraints;
143 c6->right.SameAs(this, wxRight, 5);
144 c6->bottom.SameAs(this, wxBottom, 5);
147 close_button->SetConstraints(c6);
149 wxLayoutConstraints *c7 = new wxLayoutConstraints;
150 c7->top.Below(recvcmd, 5);
151 c7->centreX.SameAs(this, wxCentreX);
154 xfercmd_label->SetConstraints(c7);
156 xfercmd = new wxTextCtrl(
167 wxLayoutConstraints *c8 = new wxLayoutConstraints;
168 c8->left.SameAs(this, wxLeft, 5);
169 c8->right.SameAs(this, wxRight, 5);
170 c8->top.Below(xfercmd_label, 5);
171 c8->bottom.Above(cmd_button, -5);
172 xfercmd->SetConstraints(c8);
174 cmd_button->SetDefault();
183 void TestWindow::OnButtonPressed(wxCommandEvent& whichbutton) {
184 wxString sendbuf = "";
185 wxString recvbuf = "";
186 wxString xferbuf = "";
188 if (whichbutton.GetId()==BUTTON_CLOSE) {
191 else if (whichbutton.GetId()==BUTTON_SENDCMD) {
192 sendbuf = sendcmd->GetValue();
194 xferbuf = xfercmd->GetValue();
195 citsock->serv_trans(sendbuf, recvbuf, xferbuf);
196 recvcmd->SetValue(recvbuf);
197 xfercmd->SetValue(xferbuf);