1 #ifndef ELEVATORGUI_HPP
2 #define ELEVATORGUI_HPP
10 #include "elevatorcontroller.hpp"
12 #include "elevatordoor.hpp"
13 #include "callbutton.hpp"
14 #include "positionlabel.hpp"
15 #include "requestbutton.hpp"
18 typedef std::vector<CallButton*> CallButtonVector;
19 typedef std::vector<PositionLabel*> PositionLabelVector;
20 typedef std::vector<RequestButton*> RequestButtonVector;
21 typedef std::vector<ElevatorDoor*> ElevatorDoorVector;
24 class ElevatorGUI : public Gtk::Window
27 ElevatorGUI (int floors, int elevators);
29 /* Functions to be called from Elevator to change GUI status */
30 void gui_update_position_label (int elevator, float new_position, Direction direction);
31 void gui_unpress_call_button (int floor, Direction direction);
32 void gui_unpress_request_button (int elevator, int floor);
33 void gui_open_door (int elevator, int floor);
34 void gui_close_door (int elevator, int floor);
37 /* Callbacks from button presses */
38 void on_call_button_toggled (CallButton *button);
39 void on_request_button_toggled (RequestButton *button);
40 void on_playpause_button_clicked ();
41 void on_stop_button_clicked ();
42 void on_quit_button_clicked ();
45 bool on_timer_tick ();
46 sigc::connection timer_;
47 static const int timer_tick_ms_ = 500;
49 int number_of_floors_;
50 int number_of_elevators_;
52 enum { STOPPED, RUNNING, PAUSED } simulation_status_;
54 ElevatorController ec_;
56 // holds custom CallButton which knows it's direction and floor#
57 CallButtonVector call_buttons_;
59 // holds custom position label which knows it's elevator#
60 PositionLabelVector position_labels_;
62 // holds custom RequestButton which knows it's elevator# and floor#
63 RequestButtonVector request_buttons_;
65 // holds custom ElevatorDoor which knows it's elevator# and floor#
66 ElevatorDoorVector elevator_doors_;
68 // Holds the Play / Pause button, Stop button, and Quit button
69 Gtk::Button button_playpause_, button_stop_, button_quit_;
71 // Holds the Table which holds everything
75 #endif /* ELEVATORGUI_HPP */
77 /* vim: set ts=4 sts=4 sw=4 noet tw=112: */