2 #include "elevatorgui.hpp"
4 static ElevatorGUI *thegui = NULL;
6 int main (int argc, char *argv[])
12 Gtk::Main app(argc, argv);
14 //#define USE_STATIC_FLOORS
15 #ifndef USE_STATIC_FLOORS
18 Gtk::Dialog d ("Floor Dialog", true, true);
19 Gtk::Label l ("Enter the number of floors to use [2-10]");
22 d.get_vbox()->pack_start (l);
23 d.get_vbox()->pack_start (e);
26 d.add_button ("gtk-ok", Gtk::RESPONSE_OK);
27 e.set_activates_default (true);
28 d.set_default_response (Gtk::RESPONSE_OK);
30 int result = d.run ();
31 floors = atoi (e.get_text().c_str());
33 if (floors < 2 || floors > 10)
35 Gtk::MessageDialog bad_dialog ("The number of floors entered was not within"
36 " the acceptable range");
41 // Good input, leave now
48 Gtk::Dialog d ("Elevator Dialog", true, true);
49 Gtk::Label l ("Enter the number of elevators to use [1-5]");
52 d.get_vbox()->pack_start (l);
53 d.get_vbox()->pack_start (e);
56 d.add_button ("gtk-ok", Gtk::RESPONSE_OK);
57 e.set_activates_default (true);
58 d.set_default_response (Gtk::RESPONSE_OK);
60 int result = d.run ();
61 elevators = atoi (e.get_text().c_str());
63 if (elevators < 1 || elevators > 5)
65 Gtk::MessageDialog bad_dialog ("The number of elevators entered was not within"
66 " the acceptable range");
71 // Good input, leave now
78 ElevatorGUI eg(floors, elevators);
91 void gui_update_position_label (int elevator, float new_position, Direction direction)
93 thegui->gui_update_position_label (elevator, new_position, direction);
96 void gui_unpress_call_button (int floor, Direction direction)
98 thegui->gui_unpress_call_button (floor, direction);
101 void gui_unpress_request_button (int elevator, int floor)
103 thegui->gui_unpress_request_button (elevator, floor);
106 void gui_open_door (int elevator, int floor)
108 thegui->gui_open_door (elevator, floor);
111 void gui_close_door (int elevator, int floor)
113 thegui->gui_close_door (elevator, floor);
116 /* vim: set ts=4 sts=4 sw=4 noet tw=112: */