lyx_mirror/src/frontends/qt4/GuiToc.cpp
Abdelrazak Younes ffa722e0b7 Cleanup Toc dialog and GuiView interaction. The toc models are now part of GuiView. The TocWidget is just a view of this model.
* GuiView::tocModel(): new method to access the toc models.
* TocModels: new class with code transferred from GuiToc.
* TocWidget: only needs a TocModels reference.

Thoughts:
- We should find a way to get rid of GuiToc.{c,h}
- tocModels() should perhaps be transferred to GuiWorkArea instead of GuiView in order to have Buffer dependent navigators.



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24578 a592a061-630c-0410-9148-cb99ea01b6c8
2008-05-02 12:09:51 +00:00

89 lines
1.5 KiB
C++

/**
* \file GuiToc.cpp
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author John Levon
* \author Abdelrazak Younes
* \author Angus Leeming
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "GuiToc.h"
#include "GuiView.h"
#include "DockView.h"
#include "TocWidget.h"
#include "qt_helpers.h"
#include "Buffer.h"
#include "BufferView.h"
#include "BufferParams.h"
#include "FuncRequest.h"
#include "support/debug.h"
#include "support/gettext.h"
#include "support/lassert.h"
using namespace std;
namespace lyx {
namespace frontend {
GuiToc::GuiToc(GuiView & parent, Qt::DockWidgetArea area, Qt::WindowFlags flags)
: DockView(parent, "toc", qt_("Outline"), area, flags)
{
widget_ = new TocWidget(parent.tocModels(), &parent);
setWidget(widget_);
}
GuiToc::~GuiToc()
{
delete widget_;
}
void GuiToc::updateView()
{
widget_->updateView();
}
bool GuiToc::initialiseParams(string const & data)
{
widget_->init(toqstr(data));
return true;
}
void GuiToc::dispatchParams()
{
}
void GuiToc::enableView(bool enable)
{
widget_->setEnabled(enable);
}
Dialog * createGuiToc(GuiView & lv)
{
GuiView & guiview = static_cast<GuiView &>(lv);
#ifdef Q_WS_MACX
// On Mac show as a drawer at the right
return new GuiToc(guiview, Qt::RightDockWidgetArea, Qt::Drawer);
#else
return new GuiToc(guiview);
#endif
}
} // namespace frontend
} // namespace lyx
#include "GuiToc_moc.cpp"