Add spacing to the GUI
authorIra W. Snyder <devel@irasnyder.com>
Tue, 9 Oct 2007 20:56:48 +0000 (13:56 -0700)
committerIra W. Snyder <devel@irasnyder.com>
Tue, 9 Oct 2007 20:56:48 +0000 (13:56 -0700)
Also, remove an extra table column that was not needed.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
elevatorgui.cpp

index 2c82772..4ca5fe9 100644 (file)
@@ -13,7 +13,7 @@ ElevatorGUI::ElevatorGUI (int floors, int elevators)
        , timer_()
 
        /* GUI Elements */
-       , table_(floors+1, elevators+3)
+       , table_(floors+1, elevators+2)
        , button_playpause_(Gtk::Stock::MEDIA_PLAY)
        , button_stop_(Gtk::Stock::STOP)
        , button_quit_(Gtk::Stock::QUIT)
@@ -27,6 +27,11 @@ ElevatorGUI::ElevatorGUI (int floors, int elevators)
        int i, j, e, f, e_num, f_num, f_attach;
        std::ostringstream str;
 
+       /* Set Table Spacing / Window Border Size */
+       table_.set_col_spacings (8);
+       table_.set_row_spacings (8);
+       set_border_width (10);
+
        /* Fill in all of the ElevatorDoors and CallButtons */
        for (f_attach=0, f=floors-1; f>=0; --f, ++f_attach)
        {
@@ -51,6 +56,11 @@ ElevatorGUI::ElevatorGUI (int floors, int elevators)
                        call_buttons_.push_back (callbutton);
                        box->pack_start (*callbutton);
                }
+               else // we are on the top floor, create a dummy label
+               {
+                       Gtk::Label *label = new Gtk::Label ("");
+                       box->pack_start (*label);
+               }
 
                /* Only create the DOWN CallButton if we are not on the bottom floor */
                if (f != 0)
@@ -69,6 +79,11 @@ ElevatorGUI::ElevatorGUI (int floors, int elevators)
                        call_buttons_.push_back (callbutton);
                        box->pack_end (*callbutton);
                }
+               else // we are on the bottom floor, create a dummy label
+               {
+                       Gtk::Label *label = new Gtk::Label ("");
+                       box->pack_end (*label);
+               }
 
                for (e=0; e<elevators; ++e) // run left-to-right
                {