Removed this extra widget thing, because it is now developed in my private branch.
1 #include "background_chooser_dialog.h"
2 #include <gtkmm/stock.h>
3 #include "mapstorage.h"
5 BackgroundChooserDialog::BackgroundChooserDialog(MapStorage* ms) :
7 btnClear(Gtk::Stock::CLEAR)
9 set_has_separator(false);
11 Gtk::VBox* pVBox = get_vbox();
13 lblBackground.set_text("<b>Background image file</b>");
14 lblBackground.set_use_markup();
15 lblBackground.set_alignment(Gtk::ALIGN_LEFT);
16 lblScaling.set_text("<b>Scaling factor</b>");
17 lblScaling.set_use_markup();
18 lblScaling.set_alignment(Gtk::ALIGN_LEFT);
19 fcbBackground.set_width_chars(30);
20 fcbBackground.set_action(Gtk::FILE_CHOOSER_ACTION_OPEN);
21 if (mapstorage->isBackgroundSet())
23 fcbBackground.set_filename(mapstorage->getBackgroundFilename());
26 fcbBackground.signal_selection_changed().connect(
27 sigc::mem_fun(*this, &BackgroundChooserDialog::setBackground));
29 btnClear.signal_clicked().connect(
30 sigc::mem_fun(*this, &BackgroundChooserDialog::clearBackground));
32 pVBox->pack_start(lblBackground, Gtk::PACK_SHRINK);
33 pVBox->pack_start(box, Gtk::PACK_SHRINK);
34 box.pack_start(fcbBackground, Gtk::PACK_EXPAND_WIDGET);
35 box.pack_start(btnClear, Gtk::PACK_SHRINK);
36 pVBox->pack_start(lblScaling, Gtk::PACK_SHRINK);
37 pVBox->pack_start(sbScaling, Gtk::PACK_SHRINK);
39 add_button(Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE);
44 void BackgroundChooserDialog::clearBackground()
46 fcbBackground.unselect_all();
49 void BackgroundChooserDialog::setBackground()
51 mapstorage->setBackground(fcbBackground.get_filename());