]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiToc.cpp
Add missing initialization
[lyx.git] / src / frontends / qt4 / GuiToc.cpp
index 4b30e572ec4a96e6dd78f99581121219c9b931cd..e124a468b428c48cf161d2341fa84c5633d973f2 100644 (file)
@@ -33,37 +33,17 @@ namespace lyx {
 namespace frontend {
 
 GuiToc::GuiToc(GuiView & parent, Qt::DockWidgetArea area, Qt::WindowFlags flags)
-       : DockView(parent, "toc", qt_("Outline"), area, flags)
+       : DockView(parent, "toc", qt_("Outline"), area, flags),
+         widget_(new TocWidget(parent, this)),
+         is_closing_(false)
 {
-       setObjectName("toc");
-       widget_ = new TocWidget(parent, this);
        setWidget(widget_);
-}
-
-
-GuiToc::~GuiToc()
-{
-       delete widget_;
+       setFocusProxy(widget_);
 }
 
 
 void GuiToc::updateView()
 {
-#ifndef Q_WS_MACX
-               widget_->updateView();
-               return;
-#endif
-
-       // Special code for Mac drawer.
-       if (windowFlags() & Qt::Drawer && lyxview().isFullScreen()) {
-               setWindowFlags(Qt::Widget);
-               setFeatures(DockWidgetClosable);
-               show();
-       } else if (windowFlags() & Qt::Widget && !lyxview().isFullScreen()) {
-               setWindowFlags(Qt::Drawer);
-               setFeatures(NoDockWidgetFeatures);
-               show();
-       }
        widget_->updateView();
 }
 
@@ -82,23 +62,40 @@ void GuiToc::dispatchParams()
 
 void GuiToc::enableView(bool enable)
 {
-       widget_->setEnabled(enable);
+       if (!enable)
+               // In the opposite case, updateView() will be called anyway.
+               widget_->updateViewNow();
+}
+
+
+void GuiToc::closeEvent(QCloseEvent * /*event*/)
+{
+       is_closing_ = true;
+       static_cast<GuiView *>(parent())->updateToolbars();
+       is_closing_ = false;
+}
+
+
+void GuiToc::doDispatch(Cursor & cur, FuncRequest const & cmd)
+{
+       widget_->doDispatch(cur, cmd);
+}
+
+
+bool GuiToc::getStatus(Cursor & cur, FuncRequest const & cmd,
+       FuncStatus & status) const
+{
+       return widget_->getStatus(cur, cmd, status);
 }
 
 
 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
+       return new GuiToc(lv);
 }
 
 
 } // namespace frontend
 } // namespace lyx
 
-#include "GuiToc_moc.cpp"
+#include "moc_GuiToc.cpp"