COIN-OR::LEMON - Graph Library

source: glemon-0.x/map_win.cc @ 163:443bc769b344

Last change on this file since 163:443bc769b344 was 146:afd1d8bfcccd, checked in by Hegyi Péter, 18 years ago

Size of MapWin? cannot be changed.

File size: 2.9 KB
RevLine 
[53]1#include "map_win.h"
[6]2#include <set>
3
[30]4bool MapWin::closeIfEscapeIsPressed(GdkEventKey* e)
[6]5{
[8]6  if(e->keyval==GDK_Escape)
7  {
[96]8    mytab.closeMapWin();
[95]9    //    hide();
[8]10  }
11  return true;
12}
[6]13
[96]14MapWin::MapWin(const std::string& title, std::vector<std::string> eml, std::vector<std::string> nml, NoteBookTab & mw):mytab(mw)
[8]15{
16  set_title(title);
17  set_default_size(200, 50);
[6]18
[146]19  set_resizable(false);
20
[30]21  signal_key_press_event().connect(sigc::mem_fun(*this, &MapWin::closeIfEscapeIsPressed));
[6]22
[81]23  e_combo_array=new MapSelector * [EDGE_PROPERTY_NUM];
[8]24
[81]25  table=new Gtk::Table(EDGE_PROPERTY_NUM, 1, false);
[28]26
27  for(int i=0;i<EDGE_PROPERTY_NUM;i++)
[6]28  {
[114]29    e_combo_array[i]=new MapSelector(eml, mytab.getActiveEdgeMap(i), edge_property_strings[i], true);
[8]30
[81]31    (*table).attach((*(e_combo_array[i])),0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
[94]32
33    e_combo_array[i]->signal_cbt_ch().connect(sigc::bind(sigc::mem_fun(*this, &MapWin::edgeMapChanged), i));
[121]34    e_combo_array[i]->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &MapWin::newMapWinNeeded));
[6]35  }
36
[28]37  vbox.pack_start(*(new Gtk::Label("Edge properties")));
[8]38
[28]39  vbox.pack_start(*table);
40
41  vbox.pack_start(*(new Gtk::HSeparator));
42
[81]43  n_combo_array=new MapSelector * [NODE_PROPERTY_NUM];
[28]44
[81]45  table=new Gtk::Table(NODE_PROPERTY_NUM, 1, false);
[28]46
47  for(int i=0;i<NODE_PROPERTY_NUM;i++)
48  {
[114]49    n_combo_array[i]=new MapSelector(nml, mytab.getActiveNodeMap(i), node_property_strings[i], false);
[28]50
[81]51    (*table).attach((*(n_combo_array[i])),0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
[94]52
53    n_combo_array[i]->signal_cbt_ch().connect(sigc::bind(sigc::mem_fun(*this, &MapWin::nodeMapChanged), i));
[121]54    n_combo_array[i]->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &MapWin::newMapWinNeeded));
[28]55  }
56
57  add(vbox);
58
59  vbox.pack_start(*(new Gtk::Label("Node properties")));
60
61  vbox.pack_start(*table);
[6]62
63  show_all_children();
64
65}
66
[94]67void MapWin::nodeMapChanged(std::string mapname, int prop)
68{
[96]69  mytab.propertyChange(false, prop, mapname);
[94]70}
71
72void MapWin::edgeMapChanged(std::string mapname, int prop)
73{
[96]74  mytab.propertyChange(true, prop, mapname);
[94]75}
76
[121]77void MapWin::newMapWinNeeded(bool itisedge)
[94]78{
[121]79  mytab.popupNewMapWin(itisedge);
[94]80}
81
82void MapWin::update(std::vector<std::string> eml, std::vector<std::string> nml)
[53]83{
84  for(int i=0;i<EDGE_PROPERTY_NUM;i++)
85  {
[94]86    e_combo_array[i]->update_list(eml);
[81]87  }
[53]88
89  for(int i=0;i<NODE_PROPERTY_NUM;i++)
90  {
[94]91    n_combo_array[i]->update_list(nml);
[53]92  }
93}
94
[40]95void MapWin::registerNewEdgeMap(std::string newmapname)
[38]96{
[40]97  for(int i=0;i<EDGE_PROPERTY_NUM;i++)
98  {
99    //filling in combo box with choices
[81]100    e_combo_array[i]->append_text((Glib::ustring)newmapname);
[40]101  }
[38]102}
103
[40]104void MapWin::registerNewNodeMap(std::string newmapname)
[38]105{
[41]106  for(int i=0;i<NODE_PROPERTY_NUM;i++)
[40]107  {
108    //filling in combo box with choices
[82]109    n_combo_array[i]->append_text((Glib::ustring)newmapname);
[40]110  }
[38]111}
[95]112
113bool MapWin::on_delete_event(GdkEventAny * event)
114{
115  event=event;
[96]116  mytab.closeMapWin();
[95]117  return true;
118}
Note: See TracBrowser for help on using the repository browser.