COIN-OR::LEMON - Graph Library

source: glemon/background_chooser_dialog.cc @ 3:2cc5ed6e6255

Last change on this file since 3:2cc5ed6e6255 was 1:67188bd752db, checked in by Peter Hegyi <hegyi@…>, 16 years ago

SVN revision 3500 made compilable with Lemon 1.0.

File size: 1.5 KB
Line 
1#include <background_chooser_dialog.h>
2#include <gtkmm/stock.h>
3#include <mapstorage.h>
4
5BackgroundChooserDialog::BackgroundChooserDialog(MapStorage* ms) :
6  mapstorage(ms),
7  btnClear(Gtk::Stock::CLEAR)
8{
9  set_has_separator(false);
10
11  Gtk::VBox* pVBox = get_vbox();
12
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())
22  {
23    fcbBackground.set_filename(mapstorage->getBackgroundFilename());
24  }
25
26  fcbBackground.signal_selection_changed().connect(
27    sigc::mem_fun(*this, &BackgroundChooserDialog::setBackground));
28
29  btnClear.signal_clicked().connect(
30    sigc::mem_fun(*this, &BackgroundChooserDialog::clearBackground));
31
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);
38
39  add_button(Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE);
40
41  show_all_children();
42}
43
44void BackgroundChooserDialog::clearBackground()
45{
46  fcbBackground.unselect_all();
47}
48
49void BackgroundChooserDialog::setBackground()
50{
51  mapstorage->setBackground(fcbBackground.get_filename());
52}
Note: See TracBrowser for help on using the repository browser.