3 // =========================================================================
5 // =========================================================================
7 #include "includes.hpp"
9 // ----------------------------------------------------------------------------
11 // ----------------------------------------------------------------------------
13 // IDs for the controls and the menu commands
20 // ----------------------------------------------------------------------------
21 // event tables and other macros for wxWindows
22 // ----------------------------------------------------------------------------
24 // the event tables connect the wxWindows events with the functions (event
25 // handlers) which process them. It can be also done at run-time, but for the
26 // simple menu events like this the static method is much simpler.
27 BEGIN_EVENT_TABLE( Hosts, wxMDIChildFrame)
28 EVT_BUTTON( BUTTON_ADD, Hosts::OnButtonPressed)
29 EVT_BUTTON( BUTTON_FINISH, Hosts::OnButtonPressed)
32 // ============================================================================
34 // ============================================================================
37 // ----------------------------------------------------------------------------
38 // the application class
39 // ----------------------------------------------------------------------------
42 Hosts::Hosts( CitClient *sock,
43 wxMDIParentFrame *MyMDI)
44 : wxMDIChildFrame(MyMDI, //parent
49 wxDEFAULT_FRAME_STYLE | wxTAB_TRAVERSAL,
59 /* SetIcon(wxICON(mondrian)); */
61 wxButton *add_button = new wxButton(
72 wxButton *finish_button = new wxButton(
83 wxLayoutConstraints *c1 = new wxLayoutConstraints;
84 c1->bottom.SameAs(this, wxBottom, 5);
85 c1->left.SameAs(this, wxLeft, 10);
86 c1->height.AsIs(); c1->width.AsIs();
87 add_button->SetConstraints(c1);
89 wxLayoutConstraints *c3 = new wxLayoutConstraints;
90 c3->bottom.SameAs(add_button, wxBottom);
91 c3->right.SameAs(this, wxRight, 10);
92 c3->height.AsIs(); c3->width.AsIs();
93 finish_button->SetConstraints(c3);
95 wxStaticText *server_host_label = new wxStaticText(
96 this, -1, "Server host");
98 server_host = new wxTextCtrl(this, -1);
100 wxStaticText *server_port_label = new wxStaticText(
101 this, -1, "Server port");
103 server_port = new wxTextCtrl(this, -1);
105 wxLayoutConstraints *c4 = new wxLayoutConstraints;
106 c4->top.SameAs(this, wxTop, 10);
107 c4->left.SameAs(this, wxLeft, 10);
108 c4->height.AsIs(); c4->width.AsIs();
109 server_host_label->SetConstraints(c4);
111 wxLayoutConstraints *c5 = new wxLayoutConstraints;
112 c5->centreY.SameAs(server_host_label, wxCentreY);
113 c5->left.RightOf(server_host_label, 10);
114 c5->right.SameAs(this, wxRight, 10);
116 server_host->SetConstraints(c5);
118 wxLayoutConstraints *c6 = new wxLayoutConstraints;
119 c6->top.Below(server_host_label, 15);
120 c6->left.SameAs(this, wxLeft, 10);
121 c6->height.AsIs(); c6->width.AsIs();
122 server_port_label->SetConstraints(c6);
124 wxLayoutConstraints *c7 = new wxLayoutConstraints;
125 c7->centreY.SameAs(server_port_label, wxCentreY);
126 c7->left.SameAs(server_host, wxLeft);
127 c7->right.PercentOf(this, wxWidth, 50);
129 server_port->SetConstraints(c7);
132 /* wxLayoutConstraints *c8 = new wxLayoutConstraints;
133 c8->centreY.SameAs(server_port, wxCentreY);
134 c8->left.RightOf(server_port, 5);
135 c8->width.AsIs(); c8->height.AsIs();
136 server_autoconnect->SetConstraints(c8); */
149 void Hosts::OnButtonPressed(wxCommandEvent& whichbutton) {
150 if (whichbutton.GetId() == BUTTON_FINISH) {
152 } else if (whichbutton.GetId() == BUTTON_ADD) {
153 ini->Write("/BBSList/Host", server_host->GetValue());
154 ini->Write("/BBSList/Port", server_port->GetValue());