/** * \file qt2/QLMenubar.C * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * * \author John Levon * * Full author contact details are available in file CREDITS. */ #include // Qt defines a macro 'signals' that clashes with a boost namespace. // All is well if the namespace is visible first. #include "QtView.h" #include "QLMenubar.h" #include "QLPopupMenu.h" #include "MenuBackend.h" #include #include using std::pair; using std::string; namespace lyx { namespace frontend { QLMenubar::QLMenubar(LyXView * view, MenuBackend const & mbe) : owner_(static_cast(view)), menubackend_(mbe) { Menu::const_iterator m = mbe.getMenubar().begin(); Menu::const_iterator end = mbe.getMenubar().end(); for (; m != end; ++m) { pair menu = createMenu(owner_->menuBar(), &(*m), this, true); name_map_[m->submenuname()] = menu.second; #ifdef Q_WS_MACX /* The qt/mac menu code has a very silly hack that moves some menu entries that it recognizes by name (ex: "Preferences...") to the "LyX" menu. This feature can only work if the menu entries are always available. Since we build menus on demand, we have to have a reasonable default value before the menus have been explicitely opened. (JMarc) */ menu.second->showing(); #endif } } void QLMenubar::openByName(string const & name) { NameMap::const_iterator const cit = name_map_.find(name); if (cit == name_map_.end()) return; // this will have to do I'm afraid. cit->second->exec(QCursor::pos()); } void QLMenubar::update() {} QtView * QLMenubar::view() { return owner_; } MenuBackend const & QLMenubar::backend() { return menubackend_; } } // namespace frontend } // namespace lyx