]> git.tdb.fi Git - r2c2.git/commitdiff
Put TrainPanels in a ScrolledWindow so the UI is usable on small screens
authorMikko Rasa <tdb@tdb.fi>
Wed, 24 Nov 2010 18:28:33 +0000 (18:28 +0000)
committerMikko Rasa <tdb@tdb.fi>
Wed, 24 Nov 2010 18:28:33 +0000 (18:28 +0000)
Make the speed slider take all the horizontal space it can get

source/remote/remote.cpp
source/remote/trainpanel.cpp

index 830a06d05a2f3fc07eb624718629c45772a1f5aa..c53bddda1c2f08c4578b09cca3e05bf93c66ca5f 100644 (file)
@@ -5,6 +5,7 @@ Copyright © 2009-2010  Mikkosoft Productions, Mikko Rasa
 Distributed under the GPL
 */
 
+#include <gtkmm/scrolledwindow.h>
 #include <gtkmm/separator.h>
 #include <msp/net/resolve.h>
 #include <msp/time/units.h>
@@ -38,8 +39,12 @@ Remote::Remote(int argc, char **argv):
        window.set_default_size(300, 200);
        window.set_border_width(5);
 
+       Gtk::ScrolledWindow *scroll = new Gtk::ScrolledWindow;
+       window.add(*manage(scroll));
+       scroll->set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
+
        train_box = new Gtk::VBox(false, 5);
-       window.add(*manage(train_box));
+       scroll->add(*manage(train_box));
 
        window.show_all();
 }
index cfe0c10fea9f609e8969acc9c8137dcedce3f655..7675b27f07e086c5ed6a258f2754598b9e4a2283 100644 (file)
@@ -32,14 +32,14 @@ TrainPanel::TrainPanel(Remote &r, R2C2::Client &c, R2C2::NetTrain &t):
        Gtk::HBox *hbox = new Gtk::HBox(false, 5);
        vbox->add(*manage(hbox));
 
-       hbox->add(*manage(scl_speed = new Gtk::HScale));
+       hbox->pack_start(*manage(scl_speed = new Gtk::HScale), true, true);
        scl_speed->set_digits(0);
        scl_speed->set_range(0, 200);
        scl_speed->set_increments(5, 5);
        scl_speed->set_size_request(210, -1);
        scl_speed->signal_value_changed().connect(sigc::mem_fun(this, &TrainPanel::ui_speed_changed));
 
-       hbox->add(*manage(chk_reverse = new Gtk::CheckButton("Rev")));
+       hbox->pack_start(*manage(chk_reverse = new Gtk::CheckButton("Rev")), false, true);
        chk_reverse->signal_toggled().connect(sigc::mem_fun(this, &TrainPanel::ui_reverse_changed));
 
        Gtk::HBox *func_box = new Gtk::HBox(false, 5);