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", 7);
28 int result = d.run ();
29 floors = atoi (e.get_text().c_str());
31 if (floors < 2 || floors > 10)
33 Gtk::MessageDialog bad_dialog ("The number of floors entered was not within"
34 " the acceptable range");
39 // Good input, leave now
46 Gtk::Dialog d ("Elevator Dialog", true, true);
47 Gtk::Label l ("Enter the number of elevators to use [1-5]");
50 d.get_vbox()->pack_start (l);
51 d.get_vbox()->pack_start (e);
54 d.add_button ("gtk-ok", 7);
56 int result = d.run ();
57 elevators = atoi (e.get_text().c_str());
59 if (elevators < 1 || elevators > 5)
61 Gtk::MessageDialog bad_dialog ("The number of elevators entered was not within"
62 " the acceptable range");
67 // Good input, leave now
74 ElevatorGUI eg(floors, elevators);
87 void gui_update_position_label (int elevator, float new_position, Direction direction)
89 thegui->gui_update_position_label (elevator, new_position, direction);
92 void gui_unpress_call_button (int floor, Direction direction)
94 thegui->gui_unpress_call_button (floor, direction);
97 void gui_unpress_request_button (int elevator, int floor)
99 thegui->gui_unpress_request_button (elevator, floor);
102 void gui_open_door (int elevator, int floor)
104 thegui->gui_open_door (elevator, floor);
107 void gui_close_door (int elevator, int floor)
109 thegui->gui_close_door (elevator, floor);
112 /* vim: set ts=4 sts=4 sw=4 noet tw=112: */