COIN-OR::LEMON - Graph Library

source: lemon-0.x/gui/map_win.cc @ 1881:f40cdc2057c2

Last change on this file since 1881:f40cdc2057c2 was 1849:a4d1362397fe, checked in by Hegyi Péter, 14 years ago

Notebook style is provided. Without opportunity to close tabs. :-) But with all other necessary things (I think).

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