1 | /*--------------------------------------------------------------------------*/ |
---|
2 | /* Volume Rendering Application */ |
---|
3 | /* Copyright (C) 2006-2007 Nicholas Schwarz */ |
---|
4 | /* */ |
---|
5 | /* This software is free software; you can redistribute it and/or modify it */ |
---|
6 | /* under the terms of the GNU Lesser General Public License as published by */ |
---|
7 | /* the Free Software Foundation; either Version 2.1 of the License, or */ |
---|
8 | /* (at your option) any later version. */ |
---|
9 | /* */ |
---|
10 | /* This software is distributed in the hope that it will be useful, but */ |
---|
11 | /* WITHOUT ANY WARRANTY; without even the implied warranty of */ |
---|
12 | /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser */ |
---|
13 | /* General Public License for more details. */ |
---|
14 | /* */ |
---|
15 | /* You should have received a copy of the GNU Lesser Public License along */ |
---|
16 | /* with this library; if not, write to the Free Software Foundation, Inc., */ |
---|
17 | /* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ |
---|
18 | /*--------------------------------------------------------------------------*/ |
---|
19 | |
---|
20 | #include "Fl_Connect.h" |
---|
21 | |
---|
22 | /*--------------------------------------------------------------------------*/ |
---|
23 | |
---|
24 | Fl_Connect::Fl_Connect(int x, int y, int w, int h, const char *l) |
---|
25 | : Fl_Double_Window(x, y, w, h, l) { |
---|
26 | |
---|
27 | // Resize to the correct size |
---|
28 | size(255, 115); |
---|
29 | |
---|
30 | // Set modal |
---|
31 | //set_modal(); |
---|
32 | |
---|
33 | // Create host input field |
---|
34 | _hostInput = new Fl_Input(45, 10, 200, 25, "Host:"); |
---|
35 | _hostInput -> value("localhost"); |
---|
36 | |
---|
37 | // Create port input field |
---|
38 | _portInput = new Fl_Input(45, 45, 200, 25, "Port:"); |
---|
39 | _portInput -> value("10001"); |
---|
40 | |
---|
41 | // Create connect button |
---|
42 | _connectButton = new Fl_Return_Button(45, 80, 95, 25, "Connect"); |
---|
43 | |
---|
44 | // Create exit button |
---|
45 | _exitButton = new Fl_Button(150, 80, 95, 25, "Exit"); |
---|
46 | |
---|
47 | } |
---|
48 | |
---|
49 | /*--------------------------------------------------------------------------*/ |
---|
50 | |
---|
51 | Fl_Connect::~Fl_Connect() { |
---|
52 | } |
---|
53 | |
---|
54 | /*--------------------------------------------------------------------------*/ |
---|
55 | |
---|
56 | const char* Fl_Connect::GetHost() { |
---|
57 | |
---|
58 | // Return host |
---|
59 | return _hostInput -> value(); |
---|
60 | |
---|
61 | } |
---|
62 | |
---|
63 | /*--------------------------------------------------------------------------*/ |
---|
64 | |
---|
65 | int Fl_Connect::GetPort() { |
---|
66 | |
---|
67 | // Return port |
---|
68 | return atoi(_portInput -> value()); |
---|
69 | |
---|
70 | } |
---|
71 | |
---|
72 | /*--------------------------------------------------------------------------*/ |
---|
73 | |
---|
74 | void Fl_Connect::SetConnectButtonCallback(Fl_Callback* cb, void* v) { |
---|
75 | |
---|
76 | // Set callback |
---|
77 | _connectButton -> callback(cb, v); |
---|
78 | |
---|
79 | } |
---|
80 | |
---|
81 | /*--------------------------------------------------------------------------*/ |
---|
82 | |
---|
83 | void Fl_Connect::SetExitButtonCallback(Fl_Callback* cb, void* v) { |
---|
84 | |
---|
85 | // Set callback |
---|
86 | _exitButton -> callback(cb, v); |
---|
87 | |
---|
88 | } |
---|
89 | |
---|
90 | /*--------------------------------------------------------------------------*/ |
---|