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), is_closing_(false)
{
widget_ = new TocWidget(parent, this);
setWidget(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::Drawer)) {
- setWindowFlags(Qt::Drawer);
- setFeatures(NoDockWidgetFeatures);
- // Setting features hides the dialog, see Qt's doc.
- show();
- }
widget_->updateView();
+ return;
}
void GuiToc::enableView(bool enable)
{
- widget_->setEnabled(enable);
+ if (!enable)
+ // In the opposite case, updateView() will be called anyway.
+ widget_->updateView();
+}
+
+
+void GuiToc::closeEvent(QCloseEvent * /*event*/)
+{
+ is_closing_ = true;
+ ((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);
+ GuiToc * toc;
+#ifdef Q_OS_MAC
+ // On Mac show at the right and floating
+ toc = new GuiToc(lv, Qt::RightDockWidgetArea);
+ toc->setFloating(true);
#else
- return new GuiToc(guiview);
+ toc = new GuiToc(lv);
#endif
+ return toc;
}
} // namespace frontend
} // namespace lyx
-#include "GuiToc_moc.cpp"
+#include "moc_GuiToc.cpp"