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 #include "MenuBackend.h"
16 #include "QLMenubar.h"
17 #include "QLPopupMenu.h"
27 QLMenubar::QLMenubar(LyXView * view, MenuBackend const & mbe)
28 : owner_(static_cast<QtView*>(view)), menubackend_(mbe)
30 Menu::const_iterator m = mbe.getMenubar().begin();
31 Menu::const_iterator end = mbe.getMenubar().end();
32 for (; m != end; ++m) {
33 pair<int, QLPopupMenu *> menu =
34 createMenu(owner_->menuBar(), &(*m), this, true);
35 name_map_[m->submenuname()] = menu.second;
37 /* The qt/mac menu code has a very silly hack that
38 moves some menu entries that it recognizes by name
39 (ex: "Preferences...") to the "LyX" menu. This
40 feature can only work if the menu entries are
41 always available. Since we build menus on demand,
42 we have to have a reasonable default value before
43 the menus have been explicitely opened. (JMarc)
45 menu.second->showing();
51 void QLMenubar::openByName(string const & name)
53 NameMap::const_iterator const cit = name_map_.find(name);
54 if (cit == name_map_.end())
57 // this will have to do I'm afraid.
58 cit->second->exec(QCursor::pos());
62 void QLMenubar::update()
66 QtView * QLMenubar::view()
72 MenuBackend const & QLMenubar::backend()