2002-06-19 05:20:29 +00:00
|
|
|
|
/**
|
2002-09-26 08:57:43 +00:00
|
|
|
|
* \file qt2/Menubar_pimpl.C
|
2002-09-24 13:57:09 +00:00
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-06-19 05:20:29 +00:00
|
|
|
|
*
|
2002-09-24 13:57:09 +00:00
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
*
|
|
|
|
|
* Full author contact details are available in file CREDITS
|
2002-06-19 05:20:29 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "Menubar_pimpl.h"
|
|
|
|
|
#include "MenuBackend.h"
|
|
|
|
|
#include "LyXAction.h"
|
|
|
|
|
#include "kbmap.h"
|
|
|
|
|
#include "buffer.h"
|
|
|
|
|
#include "lyxfunc.h"
|
|
|
|
|
#include "FloatList.h"
|
|
|
|
|
#include "support/lstrings.h"
|
|
|
|
|
#include "support/LAssert.h"
|
2002-12-17 20:37:13 +00:00
|
|
|
|
#include "qt_helpers.h"
|
2002-06-19 05:20:29 +00:00
|
|
|
|
#include "debug.h"
|
|
|
|
|
|
|
|
|
|
#include "QtView.h"
|
2002-08-25 18:26:45 +00:00
|
|
|
|
#include "QLPopupMenu.h"
|
2002-09-24 13:57:09 +00:00
|
|
|
|
|
2002-06-19 05:20:29 +00:00
|
|
|
|
#include <qmenubar.h>
|
2002-09-12 02:10:19 +00:00
|
|
|
|
#include <qcursor.h>
|
2002-09-24 13:57:09 +00:00
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
#include <algorithm>
|
|
|
|
|
|
2002-06-19 05:20:29 +00:00
|
|
|
|
using std::endl;
|
|
|
|
|
using std::vector;
|
|
|
|
|
using std::max;
|
|
|
|
|
using std::min;
|
|
|
|
|
using std::for_each;
|
2002-09-12 02:10:19 +00:00
|
|
|
|
using std::pair;
|
2002-06-19 05:20:29 +00:00
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
|
2002-09-24 13:57:09 +00:00
|
|
|
|
Menubar::Pimpl::Pimpl(LyXView * view, MenuBackend const & mbe)
|
2002-06-21 16:40:54 +00:00
|
|
|
|
: owner_(static_cast<QtView*>(view)), menubackend_(mbe)
|
2002-06-19 05:20:29 +00:00
|
|
|
|
{
|
2002-07-21 01:38:24 +00:00
|
|
|
|
Menu::const_iterator m = mbe.getMenubar().begin();
|
|
|
|
|
Menu::const_iterator end = mbe.getMenubar().end();
|
|
|
|
|
for (; m != end; ++m) {
|
2002-09-12 02:10:19 +00:00
|
|
|
|
pair<int, QLPopupMenu *> menu =
|
|
|
|
|
createMenu(owner_->menuBar(), &(*m), this, true);
|
|
|
|
|
name_map_[m->submenuname()] = menu.second;
|
2002-06-19 05:20:29 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-05-14 09:17:22 +00:00
|
|
|
|
Menubar::Pimpl::~Pimpl()
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
2002-09-12 02:10:19 +00:00
|
|
|
|
void Menubar::Pimpl::openByName(string const & name)
|
2002-06-19 05:20:29 +00:00
|
|
|
|
{
|
2002-09-24 13:57:09 +00:00
|
|
|
|
NameMap::const_iterator const cit = name_map_.find(name);
|
|
|
|
|
if (cit == name_map_.end())
|
2002-09-12 02:10:19 +00:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// this will have to do I'm afraid.
|
|
|
|
|
cit->second->exec(QCursor::pos());
|
2002-06-19 05:20:29 +00:00
|
|
|
|
}
|
2003-05-14 09:17:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Menubar::Pimpl::update()
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QtView * Menubar::Pimpl::view()
|
|
|
|
|
{
|
|
|
|
|
return owner_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MenuBackend const & Menubar::Pimpl::backend()
|
|
|
|
|
{
|
|
|
|
|
return menubackend_;
|
|
|
|
|
}
|