Hi, I'm trying to write a small GUI with one Dialog window and lot of HBox and VBox, but I still have problems to get a good-loking and proportionated window. This [1] is my current GUI, but I would like to put more space between the Bottons and the HSeparator; something like this [2]. Best regards Guglie [1] http://n.ethz.ch/student/lucagu/pub/img/window_gtkmm.png [2] http://n.ethz.ch/student/lucagu/pub/img/window_glade.png ---------- BEGIN SOURCE CODE ---------- class warning_window : public Gtk::Dialog { public: warning_window(); virtual ~warning_window(); protected: //Signal handlers: bool on_delete_event(GdkEventAny* event); void on_button_cancel(); Glib::RefPtr<Gdk::Pixbuf> load_icon(const std::string& icon_name); void on_button_reboot(); //Member widgets: Gtk::VBox m_vbox_main, m_vbox_title, m_vbox_middle; Gtk::HBox m_hbox_images, m_hbox_txt, m_hbox_data; Gtk::HSeparator m_hsep_title, m_hsep_middle; Gtk::Button m_button_ok, m_button_cancel; Gtk::Label m_lbl_title, m_lbl_perc_txt, m_lbl_perc_data, m_lbl_time_txt, m_lbl_time_data; Gtk::Image m_img_perc, m_img_time; }; warning_window::warning_window() : m_button_ok(Gtk::Stock::OK), m_button_cancel(Gtk::Stock::CANCEL) { //set windows variables set_border_width(10); set_resizable(true); set_size_request(300, 300); set_title("Power low"); set_position(Gtk::WIN_POS_CENTER); get_vbox()->pack_start(m_vbox_main); m_vbox_main.set_spacing(10); // title m_lbl_title.set_justify(Gtk::JUSTIFY_CENTER); m_vbox_main.pack_start(m_lbl_title); m_lbl_title.set_text("Power low: reboot the computer?"); m_vbox_main.pack_start(m_hsep_title); // middle m_vbox_main.pack_start(m_vbox_middle); // images m_vbox_middle.pack_start(m_hbox_images); m_vbox_middle.set_spacing(10); m_img_perc.set(Gtk::Stock::FULLSCREEN, Gtk::ICON_SIZE_DIALOG); m_hbox_images.pack_start(m_img_perc); m_img_time.set(Gtk::Stock::HOME, Gtk::ICON_SIZE_DIALOG); m_hbox_images.pack_start(m_img_time); // text m_vbox_middle.pack_start(m_hbox_txt); m_hbox_txt.pack_start(m_lbl_perc_txt); m_lbl_perc_txt.set_text("Percent:"); m_hbox_txt.pack_start(m_lbl_time_txt); m_lbl_time_txt.set_text("Elapsed time:"); // data m_vbox_middle.pack_start(m_hbox_data); m_hbox_data.pack_start(m_lbl_perc_data); m_lbl_perc_data.set_text("10 %"); m_hbox_data.pack_start(m_lbl_time_data); m_lbl_time_data.set_text("20 : 12"); m_vbox_middle.set_spacing(10); //buttons add_button(Gtk::Stock::OK, 1); add_button(Gtk::Stock::CANCEL, 2); show_all_children(); } ---------- END SOURCE CODE ----------
Attachment:
signature.asc
Description: PGP signature