2 * \file qt2/QLMenubar.C
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 // Qt defines a macro 'signals' that clashes with a boost namespace.
14 // All is well if the namespace is visible first.
17 #include "QLMenubar.h"
18 #include "QLPopupMenu.h"
20 #include "MenuBackend.h"
32 QLMenubar::QLMenubar(LyXView * view, MenuBackend const & mbe)
33 : owner_(static_cast<QtView*>(view)), menubackend_(mbe)
35 Menu::const_iterator m = mbe.getMenubar().begin();
36 Menu::const_iterator end = mbe.getMenubar().end();
37 for (; m != end; ++m) {
38 pair<int, QLPopupMenu *> menu =
39 createMenu(owner_->menuBar(), &(*m), this, true);
40 name_map_[m->submenuname()] = menu.second;
42 /* The qt/mac menu code has a very silly hack that
43 moves some menu entries that it recognizes by name
44 (ex: "Preferences...") to the "LyX" menu. This
45 feature can only work if the menu entries are
46 always available. Since we build menus on demand,
47 we have to have a reasonable default value before
48 the menus have been explicitely opened. (JMarc)
50 menu.second->showing();
56 void QLMenubar::openByName(string const & name)
58 NameMap::const_iterator const cit = name_map_.find(name);
59 if (cit == name_map_.end())
62 // this will have to do I'm afraid.
63 cit->second->exec(QCursor::pos());
67 void QLMenubar::update()
71 QtView * QLMenubar::view()
77 MenuBackend const & QLMenubar::backend()
82 } // namespace frontend