]> code.citadel.org Git - citadel.git/commitdiff
Cool testwindow
authorArt Cancro <ajc@citadel.org>
Sat, 1 May 1999 02:24:10 +0000 (02:24 +0000)
committerArt Cancro <ajc@citadel.org>
Sat, 1 May 1999 02:24:10 +0000 (02:24 +0000)
daphne/includes.hpp
daphne/testwindow.cpp

index 200f13cc588f2ee48fe0952ec434bd853fc08611..b65b710ea20d0c0533fa45d7ae45c6d33f502704 100644 (file)
@@ -159,6 +159,7 @@ private:
        wxPanel *panel;
        wxTextCtrl *sendcmd;
        wxTextCtrl *recvcmd;
+       wxTextCtrl *xfercmd;
        wxButton *cmd_button;
        wxButton *close_button;
        void OnButtonPressed(wxCommandEvent& whichbutton);
index b7fc420957b03436af0681668b21c0cf1a9205e1..8cbf2832b68681c5c27e119b8129cb63956aa760 100644 (file)
@@ -56,32 +56,62 @@ TestWindow::TestWindow(CitClient *sock, wxMDIParentFrame *MyMDI)
        // set the frame icon
        /* SetIcon(wxICON(mondrian)); */
 
-       panel = new wxPanel(this);
+       wxStaticText *sendcmd_label = new wxStaticText(this, -1, "Server command:");
+       wxStaticText *recvcmd_label = new wxStaticText(this, -1, "Response:");
+       wxStaticText *xfercmd_label = new wxStaticText(this, -1, "Send/receive data:");
 
        sendcmd = new wxTextCtrl(
-               panel,
+               this,
                -1,
                "",
-               wxPoint(10,10),
-               wxSize(300,30),
+               wxDefaultPosition,
+               wxDefaultSize,
                0, // no style
                wxDefaultValidator,
                "sendcmd"
                );
 
+        wxLayoutConstraints *c1 = new wxLayoutConstraints;
+        c1->top.SameAs(this, wxTop, 10);
+        c1->left.SameAs(this, wxLeft, 5);
+       c1->width.AsIs();
+       c1->height.AsIs();
+        sendcmd_label->SetConstraints(c1);
+
+       wxLayoutConstraints *c2 = new wxLayoutConstraints;
+       c2->left.RightOf(sendcmd_label, 5);
+       c2->centreY.SameAs(sendcmd_label, wxCentreY);
+       c2->height.AsIs();
+       c2->right.SameAs(this, wxRight, 5);
+       sendcmd->SetConstraints(c2);
+
        recvcmd = new wxTextCtrl(
-               panel,
+               this,
                -1,
                "",
-               wxPoint(10,100),
-               wxSize(300,30),
-               0, // no style
+               wxDefaultPosition,
+               wxDefaultSize,
+               wxTE_READONLY,
                wxDefaultValidator,
                "sendcmd"
                );
 
+       wxLayoutConstraints *c3 = new wxLayoutConstraints;
+       c3->left.SameAs(sendcmd, wxLeft);
+       c3->right.SameAs(sendcmd, wxRight);
+       c3->height.AsIs();
+       c3->top.Below(sendcmd, 5);
+       recvcmd->SetConstraints(c3);
+
+       wxLayoutConstraints *c4 = new wxLayoutConstraints;
+       c4->left.SameAs(sendcmd_label, wxLeft);
+       c4->centreY.SameAs(recvcmd, wxCentreY);
+       c4->height.AsIs();
+       c4->width.AsIs();
+       recvcmd_label->SetConstraints(c4);
+       
        cmd_button = new wxButton(
-               panel,
+               this,
                BUTTON_SENDCMD,
                "Send command",
                wxPoint(10,300),
@@ -92,7 +122,7 @@ TestWindow::TestWindow(CitClient *sock, wxMDIParentFrame *MyMDI)
                );
 
        close_button = new wxButton(
-               panel,
+               this,
                BUTTON_CLOSE,
                "Close",
                wxPoint(150,300),
@@ -102,7 +132,49 @@ TestWindow::TestWindow(CitClient *sock, wxMDIParentFrame *MyMDI)
                "close_button"
                );
 
-       Show(TRUE);
+       wxLayoutConstraints *c5 = new wxLayoutConstraints;
+       c5->left.SameAs(this, wxLeft, 5);
+       c5->bottom.SameAs(this, wxBottom, 5);
+       c5->width.AsIs();
+       c5->height.AsIs();
+       cmd_button->SetConstraints(c5);
+
+       wxLayoutConstraints *c6 = new wxLayoutConstraints;
+       c6->right.SameAs(this, wxRight, 5);
+       c6->bottom.SameAs(this, wxBottom, 5);
+       c6->width.AsIs();
+       c6->height.AsIs();
+       close_button->SetConstraints(c6);
+
+       wxLayoutConstraints *c7 = new wxLayoutConstraints;
+       c7->top.Below(recvcmd, 5);
+       c7->centreX.SameAs(this, wxCentreX);
+       c7->width.AsIs();
+       c7->height.AsIs();
+       xfercmd_label->SetConstraints(c7);
+
+       xfercmd = new wxTextCtrl(
+               this,
+               -1,
+               "",
+               wxDefaultPosition,
+               wxDefaultSize,
+               wxTE_MULTILINE,
+               wxDefaultValidator,
+               "xfercmd"
+               );
+
+       wxLayoutConstraints *c8 = new wxLayoutConstraints;
+       c8->left.SameAs(this, wxLeft, 5);
+       c8->right.SameAs(this, wxRight, 5);
+       c8->top.Below(xfercmd_label, 5);
+       c8->bottom.Above(cmd_button, -5);
+       xfercmd->SetConstraints(c8);
+
+        SetAutoLayout(TRUE);
+        Show(TRUE);
+        Layout();
+
 }
 
 
@@ -110,6 +182,7 @@ TestWindow::TestWindow(CitClient *sock, wxMDIParentFrame *MyMDI)
 void TestWindow::OnButtonPressed(wxCommandEvent& whichbutton) {
        wxString sendbuf = "";
        wxString recvbuf = "";
+       wxString xferbuf = "";
 
        if (whichbutton.GetId()==BUTTON_CLOSE) {
                delete this;
@@ -117,7 +190,9 @@ void TestWindow::OnButtonPressed(wxCommandEvent& whichbutton) {
        else if (whichbutton.GetId()==BUTTON_SENDCMD) {
                sendbuf = sendcmd->GetValue();
                recvcmd->Clear();
-               citsock->serv_trans(sendbuf, recvbuf);
+               xferbuf = xfercmd->GetValue();
+               citsock->serv_trans(sendbuf, recvbuf, xferbuf);
                recvcmd->SetValue(recvbuf);
+               xfercmd->SetValue(xferbuf);
        }
 }