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_quit_button_clicked ();
44 bool on_timer_tick ();
45 sigc::connection timer_;
46 static const int timer_tick_ms_ = 500;
48 int number_of_floors_;
49 int number_of_elevators_;
51 enum { RUNNING, PAUSED } simulation_status_;
53 ElevatorController ec_;
55 // holds custom CallButton which knows it's direction and floor#
56 CallButtonVector call_buttons_;
58 // holds custom position label which knows it's elevator#
59 PositionLabelVector position_labels_;
61 // holds custom RequestButton which knows it's elevator# and floor#
62 RequestButtonVector request_buttons_;
64 // holds custom ElevatorDoor which knows it's elevator# and floor#
65 ElevatorDoorVector elevator_doors_;
67 // Holds the Play / Pause button and Quit button
68 Gtk::Button button_playpause_, button_quit_;
70 // Holds the Table which holds everything
74 #endif /* ELEVATORGUI_HPP */
76 /* vim: set ts=4 sts=4 sw=4 noet tw=112: */