From: Mikko Rasa Date: Wed, 24 Nov 2010 18:28:33 +0000 (+0000) Subject: Put TrainPanels in a ScrolledWindow so the UI is usable on small screens X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=cafa5ec7024622a14fa94b4c992dafa7ab71c3f6;p=r2c2.git Put TrainPanels in a ScrolledWindow so the UI is usable on small screens Make the speed slider take all the horizontal space it can get --- diff --git a/source/remote/remote.cpp b/source/remote/remote.cpp index 830a06d..c53bddd 100644 --- a/source/remote/remote.cpp +++ b/source/remote/remote.cpp @@ -5,6 +5,7 @@ Copyright © 2009-2010 Mikkosoft Productions, Mikko Rasa Distributed under the GPL */ +#include #include #include #include @@ -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(); } diff --git a/source/remote/trainpanel.cpp b/source/remote/trainpanel.cpp index cfe0c10..7675b27 100644 --- a/source/remote/trainpanel.cpp +++ b/source/remote/trainpanel.cpp @@ -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);