ladanyi@1412: #include ladanyi@1412: ladanyi@1412: MainWin::MainWin(const std::string& title, Graph & graph, CoordinatesMap & cm, MapStorage & ms):mapwin("Map Setup", ms, gd_canvas),gd_canvas(graph, cm, ms) ladanyi@1412: { ladanyi@1412: set_title (title); ladanyi@1412: set_default_size(WIN_WIDTH,WIN_HEIGHT); ladanyi@1412: add(vbox); ladanyi@1412: ladanyi@1412: ag=Gtk::ActionGroup::create(); ladanyi@1412: ag->add( Gtk::Action::create("ShowMenu", "_Show") ); ladanyi@1412: ag->add( Gtk::Action::create("ShowMaps", "_Maps"), sigc::mem_fun(*this, &MainWin::showMaps)); ladanyi@1412: ag->add( Gtk::Action::create("FileMenu", "_File") ); ladanyi@1412: ag->add( Gtk::Action::create("FileQuit", "_Quit"), sigc::mem_fun(*this, &MainWin::quit)); ladanyi@1412: ag->add( Gtk::Action::create("ZoomMenu", "_Zoom") ); ladanyi@1412: ag->add( Gtk::Action::create("ZoomRezoom", "_Rezoom"), sigc::mem_fun(*this, &MainWin::rezoom)); //!!!!!! ladanyi@1412: ladanyi@1412: uim=Gtk::UIManager::create(); ladanyi@1412: uim->insert_action_group(ag); ladanyi@1412: add_accel_group(uim->get_accel_group()); ladanyi@1412: ladanyi@1412: try ladanyi@1412: { ladanyi@1412: ladanyi@1412: Glib::ustring ui_info = ladanyi@1412: "" ladanyi@1412: " " ladanyi@1412: " " ladanyi@1412: " " ladanyi@1412: " " ladanyi@1412: " " ladanyi@1412: " " ladanyi@1412: " " ladanyi@1412: " " ladanyi@1412: " " ladanyi@1412: " " ladanyi@1412: " " ladanyi@1412: ""; ladanyi@1412: ladanyi@1412: uim->add_ui_from_string(ui_info); ladanyi@1412: ladanyi@1412: } ladanyi@1412: catch(const Glib::Error& ex) ladanyi@1412: { ladanyi@1412: std::cerr << "building menus failed: " << ex.what(); ladanyi@1412: } ladanyi@1412: ladanyi@1412: Gtk::Widget* menubar = uim->get_widget("/MenuBar"); ladanyi@1412: if(menubar)vbox.pack_start(*menubar, Gtk::PACK_SHRINK); ladanyi@1412: ladanyi@1412: vbox.pack_start(gd_canvas); ladanyi@1412: ladanyi@1412: show_all_children(); ladanyi@1412: } ladanyi@1412: ladanyi@1412: void MainWin::showMaps() ladanyi@1412: { ladanyi@1412: mapwin.show(); ladanyi@1412: } ladanyi@1412: ladanyi@1412: void MainWin::quit() ladanyi@1412: { ladanyi@1412: hide(); ladanyi@1412: } ladanyi@1412: ladanyi@1412: void MainWin::rezoom() ladanyi@1412: { ladanyi@1412: gd_canvas.rezoom(); ladanyi@1412: } ladanyi@1412: