mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 11:16:55 +00:00
Step by step ..
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4777 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
c05fc80d16
commit
e58bd15f39
@ -1,3 +1,8 @@
|
||||
2002-07-25 John Levon <levon@movementarian.org>
|
||||
|
||||
* Menubar_pimpl.C: split create/fill of menus into
|
||||
two functions
|
||||
|
||||
2002-07-25 John Levon <moz@compsoc.man.ac.uk>
|
||||
|
||||
* Menubar_pimpl.C: make it compile again
|
||||
|
@ -75,36 +75,39 @@ Menubar::Pimpl::Pimpl(LyXView * view, MenuBackend const & mbe)
|
||||
Menu tomenu;
|
||||
Menu const frommenu = menubackend_.getMenu(m->submenuname());
|
||||
menubackend_.expand(frommenu, tomenu, owner_->buffer());
|
||||
makeMenu(owner_->menuBar(), m, tomenu);
|
||||
fillMenu(createMenu(owner_->menuBar(), m), tomenu);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Menubar::Pimpl::makeMenu(QMenuData * parent, MenuItem const * item, Menu const & menu)
|
||||
QPopupMenu * Menubar::Pimpl::createMenu(QMenuData * parent, MenuItem const * item)
|
||||
{
|
||||
// FIXME: does this leak or not ?
|
||||
QPopupMenu * pm = new QPopupMenu();
|
||||
int const parentid = parent->insertItem(getLabel(*item).c_str(), pm);
|
||||
|
||||
MenuItemInfo const info(parent, parentid, item);
|
||||
items_[item->label()] = info;
|
||||
return pm;
|
||||
}
|
||||
|
||||
|
||||
void Menubar::Pimpl::fillMenu(QMenuData * qmenu, Menu const & menu)
|
||||
{
|
||||
Menu::const_iterator m = menu.begin();
|
||||
Menu::const_iterator end = menu.end();
|
||||
for (; m != end; ++m) {
|
||||
// FIXME: handle the special stuff here
|
||||
if (m->kind() == MenuItem::Separator) {
|
||||
pm->insertSeparator();
|
||||
qmenu->insertSeparator();
|
||||
} else if (m->kind() == MenuItem::Submenu) {
|
||||
makeMenu(pm, m, *m->submenu());
|
||||
fillMenu(createMenu(qmenu, m), *m->submenu());
|
||||
} else {
|
||||
pm->insertItem(getLabel(*m).c_str(), m->action());
|
||||
MenuItemInfo const info(pm, m->action(), m);
|
||||
qmenu->insertItem(getLabel(*m).c_str(), m->action());
|
||||
MenuItemInfo const info(qmenu, m->action(), m);
|
||||
items_[m->label()] = info;
|
||||
updateItem(info);
|
||||
}
|
||||
}
|
||||
|
||||
MenuItemInfo const info(parent, parentid, item);
|
||||
items_[item->label()] = info;
|
||||
updateSubmenu(info);
|
||||
}
|
||||
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
class LyXView;
|
||||
class QtView;
|
||||
class QMenuData;
|
||||
class QPopupMenu;
|
||||
class Menu;
|
||||
class MenuItem;
|
||||
class MenuBackend;
|
||||
@ -64,7 +65,10 @@ public:
|
||||
|
||||
private:
|
||||
/// create a menu
|
||||
void makeMenu(QMenuData * parent, MenuItem const * item, Menu const & menu);
|
||||
QPopupMenu * createMenu(QMenuData * parent, MenuItem const * item);
|
||||
|
||||
/// populate a menu (recursively)
|
||||
void fillMenu(QMenuData * qmenu, Menu const & menu);
|
||||
|
||||
/// special handling updating a submenu label
|
||||
void updateSubmenu(MenuItemInfo const & i);
|
||||
|
Loading…
Reference in New Issue
Block a user