COIN-OR::LEMON - Graph Library

Changeset 5:b7c36be1e35c in glemon-0.x for main_win.cc


Ignore:
Timestamp:
06/02/05 01:30:13 (16 years ago)
Author:
Akos Ladanyi
Branch:
gui
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk/gui@1917
Message:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • main_win.cc

    r1 r5  
    11#include <main_win.h>
    22
    3 MainWin::MainWin(const std::string& title, Graph & graph, CoordinatesMap & cm, MapStorage & ms):mapwin("Map Setup", ms, gd_canvas),gd_canvas(graph, cm, ms)
     3MainWin::MainWin(const std::string& title, Graph & graph, CoordinatesMap & cm,
     4    MapStorage & ms):mapwin("Map Setup", ms, gd_canvas),gd_canvas(graph, cm, ms)
    45{
    56  set_title (title);
     
    89
    910  ag=Gtk::ActionGroup::create();
     11
     12  ag->add( Gtk::Action::create("FileMenu", "_File") );
     13  ag->add( Gtk::Action::create("FileNew", Gtk::Stock::NEW),
     14      sigc::mem_fun(*this, &MainWin::newFile));
     15  ag->add( Gtk::Action::create("FileOpen", Gtk::Stock::OPEN),
     16      sigc::mem_fun(*this, &MainWin::openFile));
     17  ag->add( Gtk::Action::create("FileSave", Gtk::Stock::SAVE),
     18      sigc::mem_fun(*this, &MainWin::saveFile));
     19  ag->add( Gtk::Action::create("FileSaveAs", Gtk::Stock::SAVE_AS),
     20      sigc::mem_fun(*this, &MainWin::saveFileAs));
     21  ag->add( Gtk::Action::create("FileQuit", Gtk::Stock::QUIT),
     22      sigc::mem_fun(*this, &MainWin::quit));
     23
     24  ag->add( Gtk::Action::create("ViewMenu", "_View") );
     25  ag->add( Gtk::Action::create("ViewZoomIn", Gtk::Stock::ZOOM_IN),
     26      sigc::mem_fun(this->gd_canvas, &GraphDisplayerCanvas::zoomIn));
     27  ag->add( Gtk::Action::create("ViewZoomOut", Gtk::Stock::ZOOM_OUT),
     28      sigc::mem_fun(this->gd_canvas, &GraphDisplayerCanvas::zoomOut));
     29  ag->add( Gtk::Action::create("ViewZoomFit", Gtk::Stock::ZOOM_FIT),
     30      sigc::mem_fun(this->gd_canvas, &GraphDisplayerCanvas::zoomFit));
     31  ag->add( Gtk::Action::create("ViewZoom100", Gtk::Stock::ZOOM_100),
     32      sigc::mem_fun(this->gd_canvas, &GraphDisplayerCanvas::zoom100));
     33 
    1034  ag->add( Gtk::Action::create("ShowMenu", "_Show") );
    11   ag->add( Gtk::Action::create("ShowMaps", "_Maps"), sigc::mem_fun(*this, &MainWin::showMaps));
    12   ag->add( Gtk::Action::create("FileMenu", "_File") );
    13   ag->add( Gtk::Action::create("FileQuit", "_Quit"), sigc::mem_fun(*this, &MainWin::quit));
    14   ag->add( Gtk::Action::create("ZoomMenu", "_Zoom") );
    15   ag->add( Gtk::Action::create("ZoomRezoom", "_Rezoom"), sigc::mem_fun(*this, &MainWin::rezoom)); //!!!!!!
     35  ag->add( Gtk::Action::create("ShowMaps", "_Maps"),
     36      sigc::mem_fun(*this, &MainWin::showMaps));
    1637
    1738  uim=Gtk::UIManager::create();
     
    2647      "  <menubar name='MenuBar'>"
    2748      "    <menu action='FileMenu'>"
     49      "      <menuitem action='FileNew'/>"
     50      "      <menuitem action='FileOpen'/>"
     51      "      <menuitem action='FileSave'/>"
     52      "      <menuitem action='FileSaveAs'/>"
    2853      "      <menuitem action='FileQuit'/>"
     54      "    </menu>"
     55      "    <menu action='ViewMenu'>"
     56      "      <menuitem action='ViewZoomIn' />"
     57      "      <menuitem action='ViewZoomOut' />"
     58      "      <menuitem action='ViewZoomFit' />"
     59      "      <menuitem action='ViewZoom100' />"
    2960      "    </menu>"
    3061      "    <menu action='ShowMenu'>"
    3162      "      <menuitem action='ShowMaps'/>"
    3263      "    </menu>"
    33       "    <menu action='ZoomMenu'>"
    34       "      <menuitem action='ZoomRezoom'/>"
    35       "    </menu>"
    3664      "  </menubar>"
     65      "  <toolbar name='ToolBar'>"
     66      "    <toolitem action='FileNew' />"
     67      "    <toolitem action='FileOpen' />"
     68      "    <toolitem action='FileSave' />"
     69      "    <separator />"
     70      "    <toolitem action='ViewZoomIn' />"
     71      "    <toolitem action='ViewZoomOut' />"
     72      "    <toolitem action='ViewZoomFit' />"
     73      "    <toolitem action='ViewZoom100' />"
     74      "  </toolbar>"
    3775      "</ui>";
    3876
     
    4684
    4785  Gtk::Widget* menubar = uim->get_widget("/MenuBar");
    48   if(menubar)vbox.pack_start(*menubar, Gtk::PACK_SHRINK);
     86  if (menubar){
     87    vbox.pack_start(*menubar, Gtk::PACK_SHRINK);
     88  }
    4989
    50   vbox.pack_start(gd_canvas);
     90  Gtk::Widget* toolbar = uim->get_widget("/ToolBar");
     91  if (toolbar)
     92  {
     93    static_cast<Gtk::Toolbar*>(toolbar)->set_toolbar_style(Gtk::TOOLBAR_ICONS);
     94    vbox.pack_start(*toolbar, Gtk::PACK_SHRINK);
     95  }
     96
     97  Gtk::ScrolledWindow* pScrolledWindow = manage(new Gtk::ScrolledWindow());
     98  pScrolledWindow->add(gd_canvas);
     99  vbox.pack_start(*pScrolledWindow);
     100  //vbox.pack_start(gd_canvas);
    51101
    52102  show_all_children();
     
    63113}
    64114
    65 void MainWin::rezoom()
     115void MainWin::newFile()
    66116{
    67   gd_canvas.rezoom();
     117  std::cerr << "MainWin::newFile(): not yet implemented" << std::endl;
    68118}
    69119
     120void MainWin::openFile()
     121{
     122  std::cerr << "MainWin::openFile(): not yet implemented" << std::endl;
     123}
     124
     125void MainWin::saveFile()
     126{
     127  std::cerr << "MainWin::saveFile(): not yet implemented" << std::endl;
     128}
     129
     130void MainWin::saveFileAs()
     131{
     132  std::cerr << "MainWin::saveFileAs(): not yet implemented" << std::endl;
     133}
Note: See TracChangeset for help on using the changeset viewer.